refactor: simplify group str generation
This commit is contained in:
parent
367a79850c
commit
ed43414b86
|
@ -83,26 +83,18 @@ def get_teapot_check_args(repo_conf: repo.Config, task_conf: task.Config) -> Lis
|
||||||
repo_conf.grading_repo_name,
|
repo_conf.grading_repo_name,
|
||||||
]
|
]
|
||||||
if repo_conf.groups.name:
|
if repo_conf.groups.name:
|
||||||
group_config_str = ",".join(
|
group_str = lambda groups: ",".join(
|
||||||
f"{name}={max_count}:{time_period}"
|
f"{name}={max_count}:{time_period}"
|
||||||
for name, max_count, time_period in zip(
|
for name, max_count, time_period in zip(
|
||||||
repo_conf.groups.name,
|
groups.name,
|
||||||
repo_conf.groups.max_count,
|
groups.max_count,
|
||||||
repo_conf.groups.time_period_hour,
|
groups.time_period_hour,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
if task_conf.groups.name:
|
group_config = group_str(
|
||||||
overwrite_group_config_str = ",".join(
|
task_conf.groups if task_conf.groups.name else repo_conf.groups
|
||||||
f"{name}={max_count}:{time_period}"
|
|
||||||
for name, max_count, time_period in zip(
|
|
||||||
task_conf.groups.name,
|
|
||||||
task_conf.groups.max_count,
|
|
||||||
task_conf.groups.time_period_hour,
|
|
||||||
)
|
)
|
||||||
)
|
res.extend(["--group-config", group_config])
|
||||||
res.extend(["--group-config", overwrite_group_config_str])
|
|
||||||
else:
|
|
||||||
res.extend(["--group-config", group_config_str])
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user