fixed some mypy issues

This commit is contained in:
Tim Rid 2021-01-02 21:31:26 +01:00
parent cd9188dc66
commit f3a2fd94d0
3 changed files with 7 additions and 6 deletions

View file

@ -48,13 +48,13 @@ class TEnum(Adapter[int, int, EnumType, EnumType]):
)
# save enum type
self.enum_type = enum_type
self.enum_type = t.cast(t.Type[EnumType], enum_type) # type: ignore
# init adatper
super(TEnum, self).__init__(subcon)
def _decode(self, obj: int, context: Context, path: PathType) -> EnumType:
return self.enum_type(obj) # type: ignore
return self.enum_type(obj)
def _encode(
self,
@ -86,13 +86,13 @@ class TFlagsEnum(Adapter[int, int, FlagsEnumType, FlagsEnumType]):
)
# save enum type
self.enum_type = enum_type
self.enum_type = t.cast(t.Type[FlagsEnumType], enum_type) # type: ignore
# init adatper
super(TFlagsEnum, self).__init__(subcon)
def _decode(self, obj: int, context: Context, path: PathType) -> FlagsEnumType:
return self.enum_type(obj) # type: ignore
return self.enum_type(obj)
def _encode(
self,

View file

@ -2,4 +2,5 @@ construct==2.10.*
pytest>=6.2.0
numpy==1.19.3
arrow
ruamel.yaml
ruamel.yaml
mypy

View file

@ -11,7 +11,7 @@ import pytest
from .declarativeunittest import common, raises, setattrs
def test_tcontainer_compare_with_dataclass():
def test_tcontainer_compare_with_dataclass() -> None:
@dataclasses.dataclass
class TestContainer:
a: t.Optional[int] = cst.TStructField(cs.Const(1, cs.Byte))