chore: mypy for strong_typing

Mostly just ignores because of the dynamic nature of the codebase. One
prominent change is expanding the allowed types for attributes tracking
property types to allow strings (which are valid and common typing hints
in python).

Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
This commit is contained in:
Ihar Hrachyshka 2025-03-20 17:12:58 -04:00
parent ba14552a32
commit d5b52923c1
7 changed files with 15 additions and 17 deletions

View file

@ -134,7 +134,10 @@ class IPv6Serializer(Serializer[ipaddress.IPv6Address]):
class EnumSerializer(Serializer[enum.Enum]):
def generate(self, obj: enum.Enum) -> Union[int, str]:
return obj.value
value = obj.value
if isinstance(value, int):
return value
return str(value)
class UntypedListSerializer(Serializer[list]):