From 260f00623f3a7998ff58d4269561a61c40833781 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2024 10:30:17 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- contest/contest/tasks.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/contest/contest/tasks.py b/contest/contest/tasks.py index 38035ed..c753582 100644 --- a/contest/contest/tasks.py +++ b/contest/contest/tasks.py @@ -40,13 +40,15 @@ def auto_save_redis_to_database() -> None: # # 从 Redis 获取现有的答案缓存 cached_answers = cache.get(cache_key, {}) - if cached_answers is not None: # 防止未提交的是白卷 + if cached_answers is not None: # 防止未提交的是白卷 for question_id, choice_id in cached_answers.items(): # Filter out tokens if not question_id.startswith("question-"): continue - if not isinstance(choice_id, str) or not choice_id.startswith("choice-"): + if not isinstance(choice_id, str) or not choice_id.startswith( + "choice-" + ): return answer: DraftAnswer = get_object_or_404( @@ -75,4 +77,4 @@ def auto_save_redis_to_database() -> None: print(e) r.delete(key) - r.delete(':1:' + ddl_key[:-4] + '_json') + r.delete(":1:" + ddl_key[:-4] + "_json")