diff --git a/construct_typed/tarray.py b/construct_typed/tarray.py index f0929c8..a413bdf 100644 --- a/construct_typed/tarray.py +++ b/construct_typed/tarray.py @@ -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 diff --git a/construct_typed/tenum.py b/construct_typed/tenum.py index 315bcfe..fd4e33e 100644 --- a/construct_typed/tenum.py +++ b/construct_typed/tenum.py @@ -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: