Skip to content

Commit

Permalink
fix: Filter out invalid characters in abyss ranks
Browse files Browse the repository at this point in the history
  • Loading branch information
seriaati committed Jan 6, 2025
1 parent 703db61 commit 111e3b6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions genshin/models/genshin/chronicle/abyss.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ class CharacterRanks(APIModel):
most_bursts_used: typing.Sequence[AbyssRankCharacter] = Aliased("energy_skill_rank", default=[]) # noqa: E501
most_skills_used: typing.Sequence[AbyssRankCharacter] = Aliased("normal_skill_rank", default=[]) # noqa: E501

@pydantic.field_validator(
"most_played",
"most_kills",
"strongest_strike",
"most_damage_taken",
"most_bursts_used",
"most_skills_used",
mode="before",
)
def __filter_invalid_chars(
cls, v: typing.List[typing.Dict[str, typing.Any]]
) -> typing.List[typing.Dict[str, typing.Any]]:
return [char for char in v if char["avatar_id"] != 0]


class Battle(APIModel):
"""Battle in the spiral abyss."""
Expand Down

0 comments on commit 111e3b6

Please sign in to comment.