-
-
Notifications
You must be signed in to change notification settings - Fork 10
Community App Store (Sourcery refactored) #184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,9 +34,7 @@ def _parse_env_value(value: Any, default_value: Any, return_type: Callable) -> A | |
return default_value | ||
if return_type in {list, dict} and isinstance(value, str): | ||
return json.loads(value) | ||
if not isinstance(value, return_type): | ||
return return_type(value) | ||
return value | ||
return value if isinstance(value, return_type) else return_type(value) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
|
||
def get_env( | ||
|
@@ -137,10 +135,7 @@ def get_database_engine() -> str: | |
if _DB_ENGINE is None: | ||
_DB_ENGINE = get_env("DB_ENGINE", "").upper() | ||
|
||
if _DB_ENGINE in {"MYSQL"}: | ||
return _DB_ENGINE | ||
|
||
return "SQLITE3" | ||
return _DB_ENGINE if _DB_ENGINE in {"MYSQL"} else "SQLITE3" | ||
Comment on lines
-140
to
+138
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
|
||
def set_env(name: str, value: Any, sys_env=False, dot_env=True) -> Tuple[str, str]: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -106,9 +106,7 @@ def staff_required(view, login_url=None, redirect_field_name=None): | |
def authenticated(view, auth_level: str = AuthLevel.user): | ||
if auth_level == AuthLevel.user: | ||
return login_required(view) | ||
if auth_level == AuthLevel.admin: | ||
return staff_required(view) | ||
return view | ||
return staff_required(view) if auth_level == AuthLevel.admin else view | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Function
|
||
|
||
|
||
def stub(request, *args, **kwargs): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function
lock_invite_code
refactored with the following changes:swap-if-expression
)reintroduce-else
)assign-if-exp
)