1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-09-19 18:31:16 +00:00

pyupgrade

This commit is contained in:
Mo 2022-07-02 16:46:02 +02:00
parent 8b2e3da73e
commit d39c334ddf
4 changed files with 8 additions and 8 deletions

View file

@ -264,7 +264,7 @@ class UserView(SecureAdminModelView):
def after_model_change(self, form, model, is_created):
if is_created:
flash(
f"{model.email} registered with role(s): {', '.join([role.name for role in model.roles])}.",
f"{model.email} registered with role(s): {', '.join(role.name for role in model.roles)}.",
category="success",
)
@ -453,7 +453,7 @@ class StudentView(SecureAdminModelView):
if part_students is None:
return ""
return ", ".join([str(part_student.part) for part_student in part_students])
return ", ".join(str(part_student.part) for part_student in part_students)
column_formatters_export = {
"part_students": part_students_export_formatter,
@ -981,7 +981,7 @@ class GroupExperimentView(SecureAdminModelView):
if appointments is None:
return ""
return ", ".join([str(appointment.date) for appointment in appointments])
return ", ".join(str(appointment.date) for appointment in appointments)
column_formatters_export = {
"semester_experiment": str_without_semester_formatter,

View file

@ -43,7 +43,7 @@ def str_without_semester_formatter(view, context, model, name):
if hasattr(attr, "__iter__") and not isinstance(attr, str):
# List of attributes
return ", ".join([a.str_without_semester() for a in attr])
return ", ".join(a.str_without_semester() for a in attr)
return attr.str_without_semester()
@ -56,7 +56,7 @@ def str_formatter(view, context, model, name):
if hasattr(attr, "__iter__") and not isinstance(attr, str):
# List of attributes
return ", ".join([a.str() for a in attr])
return ", ".join(a.str() for a in attr)
return attr.str()

View file

@ -69,14 +69,14 @@ class AssistantGroupExperimentView(SecureAssistantModelView):
def part_students_formatter(view, context, model, name):
part_students = deep_getattr(model, name)
if part_students is not None:
return ", ".join([str(part_student.student) for part_student in part_students])
return ", ".join(str(part_student.student) for part_student in part_students)
return ""
def appointments_formatter(view, context, model, name):
appointments = deep_getattr(model, name)
if appointments is not None:
return ", ".join([str(appointment.date) for appointment in appointments])
return ", ".join(str(appointment.date) for appointment in appointments)
return ""

View file

@ -73,7 +73,7 @@ def importFromFile(filePath):
groupExperiments = {}
appointments = {}
with open(filePath, "r") as f:
with open(filePath) as f:
show("Reading file...")
expectingTable = True