fixed some mypy issues
This commit is contained in:
parent
cd9188dc66
commit
f3a2fd94d0
3 changed files with 7 additions and 6 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -2,4 +2,5 @@ construct==2.10.*
|
|||
pytest>=6.2.0
|
||||
numpy==1.19.3
|
||||
arrow
|
||||
ruamel.yaml
|
||||
ruamel.yaml
|
||||
mypy
|
||||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue