Skip to content

Commit

Permalink
fix: temporarily add back @property to shut up mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
NiceAesth committed Aug 23, 2023
1 parent d1cf468 commit 77d57fb
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
21 changes: 12 additions & 9 deletions aiosu/models/beatmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,24 +280,25 @@ def _set_url(cls, values: dict[str, Any]) -> dict[str, Any]:
] = f"https://osu.ppy.sh/beatmapsets/{beatmapset_id}#{mode}/{id}"
return values

@computed_field
@computed_field # type: ignore
@property
def discussion_url(self) -> str:
return f"https://osu.ppy.sh/beatmapsets/{self.beatmapset_id}/discussion/{self.id}/general"

@computed_field
def count_objects(self) -> int:
@computed_field # type: ignore
@property
def count_objects(self) -> Optional[int]:
"""Total count of the objects.
:raises ValueError: Raised if object counts are none
:return: Sum of counts of all objects
:rtype: int
:return: Sum of counts of all objects. None if no object count information.
:rtype: Optional[int]
"""
if (
self.count_circles is None
or self.count_spinners is None
or self.count_sliders is None
):
raise ValueError("Beatmap contains no object count information.")
return None
return self.count_spinners + self.count_circles + self.count_sliders

@classmethod
Expand Down Expand Up @@ -373,11 +374,13 @@ class Beatmapset(BaseModel):
beatmaps: Optional[list[Beatmap]] = None
converts: Optional[list[Beatmap]] = None

@computed_field
@computed_field # type: ignore
@property
def url(self) -> str:
return f"https://osu.ppy.sh/beatmapsets/{self.id}"

@computed_field
@computed_field # type: ignore
@property
def discussion_url(self) -> str:
return f"https://osu.ppy.sh/beatmapsets/{self.id}/discussion"

Expand Down
3 changes: 2 additions & 1 deletion aiosu/models/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ class Country(BaseModel):
code: str
name: str

@computed_field
@computed_field # type: ignore
@property
def flag_emoji(self) -> str:
r"""Emoji for the flag.
Expand Down
15 changes: 10 additions & 5 deletions aiosu/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,13 @@ class UserQueryType(Enum):
ID = "id"
USERNAME = "username"

@computed_field
@computed_field # type: ignore
@property
def old_api_name(self) -> str:
return OLD_QUERY_TYPES[self.name]

@computed_field
@computed_field # type: ignore
@property
def new_api_name(self) -> str:
return self.value

Expand Down Expand Up @@ -108,7 +110,8 @@ class UserRankHistoryElement(BaseModel):
mode: str
data: list[int]

@computed_field
@computed_field # type: ignore
@property
def average_gain(self) -> float:
r"""Average rank gain.
Expand Down Expand Up @@ -224,7 +227,8 @@ class UserStats(BaseModel):
count_miss: Optional[int] = None
variants: Optional[list[UserStatsVariant]] = None

@computed_field
@computed_field # type: ignore
@property
def pp_per_playtime(self) -> float:
r"""PP per playtime.
Expand Down Expand Up @@ -323,7 +327,8 @@ class User(BaseModel):
rank_history: Optional[UserRankHistoryElement] = None
rank_highest: Optional[UserRankHighest] = None

@computed_field
@computed_field # type: ignore
@property
def url(self) -> str:
return f"https://osu.ppy.sh/users/{self.id}"

Expand Down

0 comments on commit 77d57fb

Please sign in to comment.