From 1dedf25c14fd8516b6f76317536cf201a4c96df5 Mon Sep 17 00:00:00 2001 From: ashlen Date: Thu, 19 Sep 2024 17:17:38 +0200 Subject: [PATCH] Presumably fix CI --- genshin/models/genshin/character.py | 2 ++ genshin/models/genshin/chronicle/stats.py | 7 ++++--- genshin/models/honkai/chronicle/stats.py | 2 +- genshin/models/model.py | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/genshin/models/genshin/character.py b/genshin/models/genshin/character.py index b0919273..1b5e5b1d 100644 --- a/genshin/models/genshin/character.py +++ b/genshin/models/genshin/character.py @@ -71,6 +71,8 @@ def _get_db_char( ) -> constants.DBChar: """Get the appropriate DBChar object from specific fields.""" if lang not in constants.CHARACTER_NAMES: + if id and name and icon and element and rarity: + return constants.DBChar(id or 0, _parse_icon(icon), name, element, rarity, guessed=True) raise Exception( f"Character names not loaded for {lang!r}. Please run `await genshin.utility.update_characters_any()`." ) diff --git a/genshin/models/genshin/chronicle/stats.py b/genshin/models/genshin/chronicle/stats.py index c69de5cb..a4402978 100644 --- a/genshin/models/genshin/chronicle/stats.py +++ b/genshin/models/genshin/chronicle/stats.py @@ -8,7 +8,8 @@ from genshin.models import hoyolab from genshin.models.model import Aliased, APIModel -from . import abyss, activities, characters +from . import abyss, activities +from . import characters as characters_module __all__ = [ "AreaExploration", @@ -159,7 +160,7 @@ class PartialGenshinUserStats(APIModel): info: hoyolab.UserInfo = Aliased("role") stats: Stats - characters: typing.Sequence["characters.PartialCharacter"] = Aliased("avatars") + characters: typing.Sequence[characters_module.PartialCharacter] = Aliased("avatars") explorations: typing.Sequence[Exploration] = Aliased("world_explorations") teapot: typing.Optional[Teapot] = Aliased("homes") @@ -175,7 +176,7 @@ def __format_teapot(cls, v: typing.Any) -> typing.Optional[typing.Dict[str, typi class GenshinUserStats(PartialGenshinUserStats): """User stats with characters with equipment""" - characters: typing.Sequence["characters.Character"] = Aliased("avatars") + characters: typing.Sequence[characters_module.Character] = Aliased("avatars") class FullGenshinUserStats(GenshinUserStats): diff --git a/genshin/models/honkai/chronicle/stats.py b/genshin/models/honkai/chronicle/stats.py index aef82d0a..a30c18f9 100644 --- a/genshin/models/honkai/chronicle/stats.py +++ b/genshin/models/honkai/chronicle/stats.py @@ -67,7 +67,7 @@ def __normalize_rank(cls, rank: typing.Optional[str]) -> typing.Optional[int]: return 69 - ord(rank) - model_config = pydantic.ConfigDict(frozen=False) + model_config: pydantic.ConfigDict = pydantic.ConfigDict(frozen=False) # type: ignore # flake8: noqa: E222 diff --git a/genshin/models/model.py b/genshin/models/model.py index 2f5b93c5..a3888f33 100644 --- a/genshin/models/model.py +++ b/genshin/models/model.py @@ -17,7 +17,7 @@ class APIModel(pydantic.BaseModel): """Modified pydantic model.""" - model_config = pydantic.ConfigDict(arbitrary_types_allowed=True) + model_config: pydantic.ConfigDict = pydantic.ConfigDict(arbitrary_types_allowed=True) # type: ignore class Unique(abc.ABC):