diff --git a/conreq/app/components.py b/conreq/app/components.py index b4ca60e4..f4b9778f 100644 --- a/conreq/app/components.py +++ b/conreq/app/components.py @@ -54,14 +54,7 @@ def tabbed_viewport( def _default_tab(*tab_groups: list[Tab], default_tab: Callable = None) -> Tab: - if default_tab: - return default_tab - - for tabs in tab_groups: - if tabs: - return tabs[0] - - return None + return default_tab or next((tabs[0] for tabs in tab_groups if tabs), None) def _tabbed_viewport_tabs( diff --git a/conreq/settings.py b/conreq/settings.py index f64ffcb6..bdacc619 100644 --- a/conreq/settings.py +++ b/conreq/settings.py @@ -5,6 +5,7 @@ https://docs.djangoproject.com/en/dev/ref/settings/ """ + import logging import os import secrets @@ -427,12 +428,7 @@ # Add conditional apps if DEBUG: - # Performance analysis tools - INSTALLED_APPS.append("silk") - # API docs generator - INSTALLED_APPS.append("drf_spectacular") - INSTALLED_APPS.append("drf_spectacular_sidecar") - + INSTALLED_APPS.extend(("silk", "drf_spectacular", "drf_spectacular_sidecar")) # Automatically delete dangling files INSTALLED_APPS.append("django_cleanup.apps.CleanupConfig") diff --git a/conreq/utils/generic.py b/conreq/utils/generic.py index 0455ead5..c922db63 100644 --- a/conreq/utils/generic.py +++ b/conreq/utils/generic.py @@ -8,10 +8,14 @@ def is_key_value_in_iter( ) -> bool: """Iterate through a iterable (list, tuple, etc) containing dicts to check if a specific key/value pair exists.""" - for item in search_list: - if item.__contains__(key) and item[key] == value: - return item if return_item else True - return False + return next( + ( + item if return_item else True + for item in search_list + if item.__contains__(key) and item[key] == value + ), + False, + ) def replace_item_in_list(search_for, replace_with, search_list): diff --git a/setup.py b/setup.py index a16a33f4..e9bcb829 100644 --- a/setup.py +++ b/setup.py @@ -36,9 +36,12 @@ # Requirements requirements = [] with (ROOT_DIR / "requirements" / "main.txt").open() as f: - for line in map(str.strip, f): - if not line.startswith("#") and not line.startswith("git+"): - requirements.append(line) + requirements.extend( + line + for line in map(str.strip, f) + if not line.startswith("#") and not line.startswith("git+") + ) + PACKAGE["install_requires"] = requirements