fix(ci): type scrapers

This commit is contained in:
Barrett Ruth 2025-09-18 22:14:13 -04:00
parent 8a6b5dc373
commit ffaec3b947
4 changed files with 92 additions and 85 deletions

41
scrapers/models.py Normal file
View file

@ -0,0 +1,41 @@
from dataclasses import dataclass
@dataclass
class TestCase:
input: str
expected: str
@dataclass
class Problem:
id: str
name: str
@dataclass
class ScrapingResult:
success: bool
error: str | None = None
@dataclass
class MetadataResult(ScrapingResult):
contest_id: str | None = None
problems: list[Problem] | None = None
categories: dict[str, list[Problem]] | None = None
def __post_init__(self):
if self.problems is None:
self.problems = []
@dataclass
class TestsResult(ScrapingResult):
problem_id: str = ""
url: str = ""
tests: list[TestCase] | None = None
def __post_init__(self):
if self.tests is None:
self.tests = []