Skip to content

Commit

Permalink
'Refactored by Sourcery' (#144)
Browse files Browse the repository at this point in the history
Co-authored-by: Sourcery AI <>
  • Loading branch information
sourcery-ai[bot] authored Feb 4, 2022
1 parent 54407f8 commit c28435a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 21 deletions.
9 changes: 1 addition & 8 deletions conreq/app/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 2 additions & 6 deletions conreq/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
https://docs.djangoproject.com/en/dev/ref/settings/
"""


import logging
import os
import secrets
Expand Down Expand Up @@ -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")

Expand Down
12 changes: 8 additions & 4 deletions conreq/utils/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
9 changes: 6 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down

0 comments on commit c28435a

Please sign in to comment.