mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-12-04 22:40:30 +00:00
Apply C4
This commit is contained in:
parent
45258fa4c6
commit
d408e8fc08
3 changed files with 9 additions and 9 deletions
|
@ -112,7 +112,7 @@ def semesterExperimentQueryFactory():
|
|||
class SemesterRowFilter(FilterEqual):
|
||||
def get_options(self, view):
|
||||
if not has_request_context():
|
||||
return tuple()
|
||||
return ()
|
||||
|
||||
semesters = Semester.sortedSemestersStartingWithNewest()
|
||||
return tuple((semester.id, str(semester)) for semester in semesters)
|
||||
|
@ -542,7 +542,7 @@ def groupQueryFactory():
|
|||
class PartRowFilter(FilterEqual):
|
||||
def get_options(self, view):
|
||||
if not has_request_context():
|
||||
return tuple()
|
||||
return ()
|
||||
|
||||
parts = db.session.scalars(select(Part).where(Part.semester == current_user.active_semester))
|
||||
return tuple((part.id, part.str_without_semester()) for part in parts)
|
||||
|
@ -620,7 +620,7 @@ def partStudentQueryFactory():
|
|||
class ProgramRowFilter(FilterEqual):
|
||||
def get_options(self, view):
|
||||
if not has_request_context():
|
||||
return tuple()
|
||||
return ()
|
||||
|
||||
programs = db.session.scalars(select(Program))
|
||||
return tuple((program.id, str(program)) for program in programs)
|
||||
|
@ -934,7 +934,7 @@ class AdminView(SecureAdminModelView):
|
|||
class ExperimentRowFilter(FilterEqual):
|
||||
def get_options(self, view):
|
||||
if not has_request_context():
|
||||
return tuple()
|
||||
return ()
|
||||
|
||||
activeExperiments = db.session.scalars(select(Experiment).where(Experiment.active is True))
|
||||
return tuple(
|
||||
|
@ -1098,7 +1098,7 @@ def groupExperimentQueryFactory():
|
|||
class AssistantRowFilter(FilterEqual):
|
||||
def get_options(self, view):
|
||||
if not has_request_context():
|
||||
return tuple()
|
||||
return ()
|
||||
|
||||
activeAssistants = assistantQueryFactory()
|
||||
return tuple((assistant.id, str(assistant)) for assistant in activeAssistants)
|
||||
|
@ -1191,7 +1191,7 @@ class ExperimentMarkView(SecureAdminModelView):
|
|||
class AdminFilter(FilterEqual):
|
||||
def get_options(self, view):
|
||||
if not has_request_context():
|
||||
return tuple()
|
||||
return ()
|
||||
|
||||
admins = db.session.scalars(select(Admin).join(User).where(User.active is True))
|
||||
return tuple((admin.id, str(admin)) for admin in admins)
|
||||
|
|
|
@ -14,12 +14,12 @@ def util_processor():
|
|||
|
||||
footer = f"AdvLabDB - <a href={repo_url} target='_blank' rel='noopener noreferrer'>Source code</a>"
|
||||
|
||||
return dict(active_semester_str=active_semester_str, current_user=current_user, footer=footer)
|
||||
return {"active_semester_str": active_semester_str, "current_user": current_user, "footer": footer}
|
||||
|
||||
|
||||
@security.login_context_processor
|
||||
def login_context_processor():
|
||||
return dict(message=settings.get("login_view_message"))
|
||||
return {"message": settings.get("login_view_message")}
|
||||
|
||||
|
||||
@bp.route("/")
|
||||
|
|
|
@ -27,7 +27,7 @@ requires = ["poetry-core>=1.0.0"]
|
|||
build-backend = "poetry.core.masonry.api"
|
||||
|
||||
[tool.ruff]
|
||||
select = ["E1", "E4", "E7", "E9", "W", "F", "I", "UP", "YTT", "S1", "S5", "S7", "B"]
|
||||
select = ["E1", "E4", "E7", "E9", "W", "F", "I", "UP", "YTT", "S1", "S5", "S7", "B", "C4"]
|
||||
line-length = 120
|
||||
|
||||
[tool.ruff.per-file-ignores]
|
||||
|
|
Loading…
Reference in a new issue