From 50403381e0f2a772aa9e2b64afcda40a867e6be0 Mon Sep 17 00:00:00 2001 From: Lili Date: Sun, 6 Oct 2024 11:18:43 +0200 Subject: [PATCH] fix is_redeem_from_config_active type hints --- tlapbot/redeems.py | 2 +- tlapbot/tlapbot_types.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/tlapbot/redeems.py b/tlapbot/redeems.py index 32a13dc..6d8be35 100644 --- a/tlapbot/redeems.py +++ b/tlapbot/redeems.py @@ -214,7 +214,7 @@ def is_redeem_active(redeem_name: str) -> bool | None: -def is_redeem_from_config_active(redeem: Redeem, active_categories: list[str]) -> bool: +def is_redeem_from_config_active(redeem: tuple[str, Redeem], active_categories: list[str]) -> bool: """Checks if redeem is active. `redeem` is a whole key:value pair from redeems config.""" if isinstance(redeem[1].get("category"), list): for category in redeem[1]["category"]: diff --git a/tlapbot/tlapbot_types.py b/tlapbot/tlapbot_types.py index f79db4b..a972e9e 100644 --- a/tlapbot/tlapbot_types.py +++ b/tlapbot/tlapbot_types.py @@ -1,4 +1,5 @@ -from typing import Tuple, Any, TypeAlias +from typing import Any, TypeAlias -Redeem: TypeAlias = Tuple[str, dict[str, Any]] -Redeems: TypeAlias = Tuple[str, Redeem] \ No newline at end of file +Redeem: TypeAlias = dict[str, dict[str, Any]] +# at the moment the Any could be specialized to str | int | list[str] +Redeems: TypeAlias = dict[str, Redeem] \ No newline at end of file