From d0ae823e2602478b31787315480162a87db03306 Mon Sep 17 00:00:00 2001 From: thematdev Date: Wed, 3 Apr 2024 22:25:22 +0300 Subject: [PATCH] Finally bump pydantic version --- codeforces_scraper/models.py | 68 +++++++++++++++++------------------ codeforces_scraper/scraper.py | 2 +- setup.py | 2 +- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/codeforces_scraper/models.py b/codeforces_scraper/models.py index 94ccac9..fc41128 100644 --- a/codeforces_scraper/models.py +++ b/codeforces_scraper/models.py @@ -71,8 +71,8 @@ class APIModel(BaseModel): class JudgeProtocol(APIModel): manual: bool - protocol: Optional[str] - verdict: Optional[str] + protocol: Optional[str] = None + verdict: Optional[str] = None class BlogEntry(APIModel): @@ -81,7 +81,7 @@ class BlogEntry(APIModel): creation_time_seconds: int author_handle: str title: str - content: Optional[str] + content: Optional[str] = None locale: str modification_time_seconds: int allow_view_history: bool @@ -95,7 +95,7 @@ class Comment(APIModel): commentator_handle: str locale: str text: str - parent_comment_id: Optional[int] + parent_comment_id: Optional[int] = None rating: int @@ -126,26 +126,26 @@ class Member(APIModel): class Problem(APIModel): - contest_id: Optional[int] - problem_set_name: Optional[str] + contest_id: Optional[int] = None + problem_set_name: Optional[str] = None index: str name: str type: str - points: Optional[float] - rating: Optional[int] + points: Optional[float] = None + rating: Optional[int] = None tags: List[str] class User(APIModel): handle: str - email: Optional[str] - vk_id: Optional[str] - open_id: Optional[str] - first_name: Optional[str] - last_name: Optional[str] - country: Optional[str] - city: Optional[str] - organization: Optional[str] + email: Optional[str] = None + vk_id: Optional[str] = None + open_id: Optional[str] = None + first_name: Optional[str] = None + last_name: Optional[str] = None + country: Optional[str] = None + city: Optional[str] = None + organization: Optional[str] = None contribution: int rank: str rating: int @@ -162,11 +162,11 @@ class Party(APIModel): contest_id: int members: List[Member] participant_type: str - team_id: Optional[int] - team_name: Optional[str] + team_id: Optional[int] = None + team_name: Optional[str] = None ghost: bool - room: Optional[int] - start_time_seconds: Optional[int] + room: Optional[int] = None + start_time_seconds: Optional[int] = None class Submission(APIModel): @@ -177,12 +177,12 @@ class Submission(APIModel): problem: Problem author: Party programming_language: str - verdict: Optional[Verdict] + verdict: Optional[Verdict] = None testset: str passed_test_count: int time_consumed_millis: int memory_consumed_bytes: int - points: Optional[float] + points: Optional[float] = None class Contest(APIModel): @@ -192,17 +192,17 @@ class Contest(APIModel): phase: ContestPhase frozen: bool duration_seconds: bool - start_time_seconds: Optional[int] - relative_time_seconds: Optional[int] - prepared_by: Optional[str] - website_url: Optional[str] - description: Optional[str] - difficulty: Optional[int] - kind: Optional[str] - icpc_region: Optional[str] - country: Optional[str] - city: Optional[str] - season: Optional[str] + start_time_seconds: Optional[int] = None + relative_time_seconds: Optional[int] = None + prepared_by: Optional[str] = None + website_url: Optional[str] = None + description: Optional[str] = None + difficulty: Optional[int] = None + kind: Optional[str] = None + icpc_region: Optional[str] = None + country: Optional[str] = None + city: Optional[str] = None + season: Optional[str] = None class Hack(APIModel): @@ -211,7 +211,7 @@ class Hack(APIModel): hacker: Party defender: Party problem: Problem - test: Optional[str] + test: Optional[str] = None judge_protocol: JudgeProtocol diff --git a/codeforces_scraper/scraper.py b/codeforces_scraper/scraper.py index 9c37621..66b3084 100644 --- a/codeforces_scraper/scraper.py +++ b/codeforces_scraper/scraper.py @@ -169,7 +169,7 @@ class Scraper: } else: params = {'contestId': contest_id} - return [Submission.parse_obj(x) for x in self.api_request('contest.status', params)] + return [Submission.model_validate(x) for x in self.api_request('contest.status', params)] def get_contest_tasks(self, contest_id: int) -> List[Problem]: """Get all tasks in contest with id ``contest_id``""" diff --git a/setup.py b/setup.py index 36fec6e..0d7d04e 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ import setuptools setuptools.setup( name='codeforces-scraper', - version='0.3.2', + version='0.4.0', author='thematdev', author_email='thematdev@thematdev.org', description='Utility to do actions on codeforces',