satisfy mypy

This commit is contained in:
Tim Rid 2021-01-01 15:41:36 +01:00
parent 11a2e02210
commit 8c8154aaa0
2 changed files with 5 additions and 4 deletions

View file

@ -25,14 +25,14 @@ class TArray(
super(TArray, self).__init__(cs.Array(count, subcon, discard)) # type: ignore
def _decode(
self, obj: ListContainer[ParsedType], context: Context, path: PathType
self, obj: SubconParsedType, context: Context, path: PathType
) -> ParsedType:
return list(obj) # type: ignore
def _encode(
self,
obj: t.Any,
obj: t.List[SubconParsedType],
context: Context,
path: PathType,
) -> t.List[t.Any]:
) -> SubconBuildTypes:
return obj # type: ignore

View file

@ -48,7 +48,7 @@ class TEnum(Adapter[int, int, EnumType, t.Union[int, str, EnumType]]):
self.enum_type = enum_type
# init adatper
super(TEnum, self).__init__(subcon) # type: ignore
super(TEnum, self).__init__(subcon)
def _decode(self, obj: int, context: "cs.Context", path: "cs.PathType") -> EnumType:
return self.enum_type(obj)
@ -60,6 +60,7 @@ class TEnum(Adapter[int, int, EnumType, t.Union[int, str, EnumType]]):
path: "cs.PathType",
) -> int:
try:
# TODO: remove this. only strongly typed enums are allowed...
if isinstance(obj, str):
return int(self.enum_type[obj])
else: