refactor: simplify group str generation
All checks were successful
build / build (push) Successful in 1m51s
build / trigger-build-image (push) Successful in 8s

This commit is contained in:
张泊明518370910136 2025-06-16 10:09:29 -04:00
parent 367a79850c
commit ed43414b86
GPG Key ID: D47306D7062CDA9D

View File

@ -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