Finally bump pydantic version

This commit is contained in:
thematdev 2024-04-03 22:25:22 +03:00
parent d3b3e7abbc
commit d0ae823e26
3 changed files with 36 additions and 36 deletions

View File

@ -71,8 +71,8 @@ class APIModel(BaseModel):
class JudgeProtocol(APIModel): class JudgeProtocol(APIModel):
manual: bool manual: bool
protocol: Optional[str] protocol: Optional[str] = None
verdict: Optional[str] verdict: Optional[str] = None
class BlogEntry(APIModel): class BlogEntry(APIModel):
@ -81,7 +81,7 @@ class BlogEntry(APIModel):
creation_time_seconds: int creation_time_seconds: int
author_handle: str author_handle: str
title: str title: str
content: Optional[str] content: Optional[str] = None
locale: str locale: str
modification_time_seconds: int modification_time_seconds: int
allow_view_history: bool allow_view_history: bool
@ -95,7 +95,7 @@ class Comment(APIModel):
commentator_handle: str commentator_handle: str
locale: str locale: str
text: str text: str
parent_comment_id: Optional[int] parent_comment_id: Optional[int] = None
rating: int rating: int
@ -126,26 +126,26 @@ class Member(APIModel):
class Problem(APIModel): class Problem(APIModel):
contest_id: Optional[int] contest_id: Optional[int] = None
problem_set_name: Optional[str] problem_set_name: Optional[str] = None
index: str index: str
name: str name: str
type: str type: str
points: Optional[float] points: Optional[float] = None
rating: Optional[int] rating: Optional[int] = None
tags: List[str] tags: List[str]
class User(APIModel): class User(APIModel):
handle: str handle: str
email: Optional[str] email: Optional[str] = None
vk_id: Optional[str] vk_id: Optional[str] = None
open_id: Optional[str] open_id: Optional[str] = None
first_name: Optional[str] first_name: Optional[str] = None
last_name: Optional[str] last_name: Optional[str] = None
country: Optional[str] country: Optional[str] = None
city: Optional[str] city: Optional[str] = None
organization: Optional[str] organization: Optional[str] = None
contribution: int contribution: int
rank: str rank: str
rating: int rating: int
@ -162,11 +162,11 @@ class Party(APIModel):
contest_id: int contest_id: int
members: List[Member] members: List[Member]
participant_type: str participant_type: str
team_id: Optional[int] team_id: Optional[int] = None
team_name: Optional[str] team_name: Optional[str] = None
ghost: bool ghost: bool
room: Optional[int] room: Optional[int] = None
start_time_seconds: Optional[int] start_time_seconds: Optional[int] = None
class Submission(APIModel): class Submission(APIModel):
@ -177,12 +177,12 @@ class Submission(APIModel):
problem: Problem problem: Problem
author: Party author: Party
programming_language: str programming_language: str
verdict: Optional[Verdict] verdict: Optional[Verdict] = None
testset: str testset: str
passed_test_count: int passed_test_count: int
time_consumed_millis: int time_consumed_millis: int
memory_consumed_bytes: int memory_consumed_bytes: int
points: Optional[float] points: Optional[float] = None
class Contest(APIModel): class Contest(APIModel):
@ -192,17 +192,17 @@ class Contest(APIModel):
phase: ContestPhase phase: ContestPhase
frozen: bool frozen: bool
duration_seconds: bool duration_seconds: bool
start_time_seconds: Optional[int] start_time_seconds: Optional[int] = None
relative_time_seconds: Optional[int] relative_time_seconds: Optional[int] = None
prepared_by: Optional[str] prepared_by: Optional[str] = None
website_url: Optional[str] website_url: Optional[str] = None
description: Optional[str] description: Optional[str] = None
difficulty: Optional[int] difficulty: Optional[int] = None
kind: Optional[str] kind: Optional[str] = None
icpc_region: Optional[str] icpc_region: Optional[str] = None
country: Optional[str] country: Optional[str] = None
city: Optional[str] city: Optional[str] = None
season: Optional[str] season: Optional[str] = None
class Hack(APIModel): class Hack(APIModel):
@ -211,7 +211,7 @@ class Hack(APIModel):
hacker: Party hacker: Party
defender: Party defender: Party
problem: Problem problem: Problem
test: Optional[str] test: Optional[str] = None
judge_protocol: JudgeProtocol judge_protocol: JudgeProtocol

View File

@ -169,7 +169,7 @@ class Scraper:
} }
else: else:
params = {'contestId': contest_id} 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]: def get_contest_tasks(self, contest_id: int) -> List[Problem]:
"""Get all tasks in contest with id ``contest_id``""" """Get all tasks in contest with id ``contest_id``"""

View File

@ -2,7 +2,7 @@ import setuptools
setuptools.setup( setuptools.setup(
name='codeforces-scraper', name='codeforces-scraper',
version='0.3.2', version='0.4.0',
author='thematdev', author='thematdev',
author_email='thematdev@thematdev.org', author_email='thematdev@thematdev.org',
description='Utility to do actions on codeforces', description='Utility to do actions on codeforces',