def process_init_contest(contest_id, **session_options):
contest = ProblemSession(config.polygon_url, None, **session_options)
problems = contest.get_contest_problems(contest_id)
print(problems)
result = PrettyTable(['Problem name', 'Problem id', 'Status'])
for problem in problems.keys():
if os.path.exists(problem):
result.add_row([problem, problems[problem], colors.error('Directory exists')])
else:
try:
os.mkdir(problem)
old_path = os.getcwd()
os.chdir(problem)
process_init(str(problems[problem]))
os.chdir(old_path)
result.add_row([problem, problems[problem], colors.success('Done')])
except Exception as e:
print(e)
result.add_row([problem, problems[problem], colors.error('Exception during init')])
print(result)
评论列表
文章目录