From 9deedec15a7363738eecebf7b912b3c2f17c7939 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Sun, 21 Sep 2025 00:10:10 -0400 Subject: [PATCH] fix(scraper): comments --- lua/cp/init.lua | 2 ++ scrapers/atcoder.py | 1 - scrapers/codeforces.py | 3 --- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lua/cp/init.lua b/lua/cp/init.lua index df56538..74da04b 100644 --- a/lua/cp/init.lua +++ b/lua/cp/init.lua @@ -80,6 +80,8 @@ local function setup_problem(contest_id, problem_id, language) end end + -- NOTE: CSES uses different cache key structure: (platform, category, problem_id) + -- vs other platforms: (platform, contest_id, problem_letter) local cache_contest_id = state.platform == 'cses' and state.contest_id or contest_id local cache_problem_id = state.platform == 'cses' and contest_id or problem_id local cached_test_cases = cache.get_test_cases(state.platform, cache_contest_id, cache_problem_id) diff --git a/scrapers/atcoder.py b/scrapers/atcoder.py index 1088979..1451bc2 100644 --- a/scrapers/atcoder.py +++ b/scrapers/atcoder.py @@ -366,7 +366,6 @@ def scrape_contests() -> list[ContestSummary]: page_contests = future.result() page_results[page] = page_contests - # Sort by page number to maintain order all_contests = [] for page in sorted(page_results.keys()): all_contests.extend(page_results[page]) diff --git a/scrapers/codeforces.py b/scrapers/codeforces.py index a85d26e..efaf0e1 100644 --- a/scrapers/codeforces.py +++ b/scrapers/codeforces.py @@ -249,14 +249,12 @@ def scrape_contests() -> list[ContestSummary]: if match: display_name = f"Global Round {match.group(1)}" elif "Codeforces Round" in name: - # Handle various Div patterns div_match = re.search(r"Codeforces Round (\d+) \(Div\. (\d+)\)", name) if div_match: display_name = ( f"Round {div_match.group(1)} (Div. {div_match.group(2)})" ) else: - # Handle combined divs like "Div. 1 + Div. 2" combined_match = re.search( r"Codeforces Round (\d+) \(Div\. 1 \+ Div\. 2\)", name ) @@ -265,7 +263,6 @@ def scrape_contests() -> list[ContestSummary]: f"Round {combined_match.group(1)} (Div. 1 + Div. 2)" ) else: - # Handle single div like "Div. 1" single_div_match = re.search( r"Codeforces Round (\d+) \(Div\. 1\)", name )