Skip to content

Commit

Permalink
fix: 型が間違っている
Browse files Browse the repository at this point in the history
  • Loading branch information
yupix committed Dec 5, 2023
1 parent 7307b8a commit 966601e
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions mipac/models/lite/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,26 +70,26 @@ def id(self) -> str:
return self.__raw_avatar_decoration["id"]

@property
def angle(self) -> int:
def angle(self) -> int | None:
"""Returns the angle of the avatar decoration.
Returns
-------
int
int | None
The angle of the avatar decoration.
"""
return self.__raw_avatar_decoration["angle"]
return self.__raw_avatar_decoration.get("angle")

@property
def flip_h(self) -> bool:
def flip_h(self) -> bool | None:
"""Returns whether the avatar decoration is flipped horizontally.
Returns
-------
bool
bool | None
Whether the avatar decoration is flipped horizontally.
"""
return self.__raw_avatar_decoration["flip_h"]
return self.__raw_avatar_decoration.get("flip_h")

@property
def url(self) -> str:
Expand Down Expand Up @@ -262,11 +262,11 @@ def badge_roles(self) -> list[BadgeRole] | None:
list[BadgeRole] | None
The badge roles of the user.
"""
return (
[BadgeRole(data, client=self._client) for data in self._raw_user["badge_roles"]]
if self._raw_user.get("badge_roles")
else None
)
badge_roles = self._raw_user.get("badge_roles")
if badge_roles is None:
return None
return [BadgeRole(data, client=self._client) for data in badge_roles]


@property
def api(self) -> UserManager:
Expand Down

0 comments on commit 966601e

Please sign in to comment.