Skip to content

Commit 7a642b0

Browse files
committed
Resolve new mypy errors found in python3.8
1 parent d666124 commit 7a642b0

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

pycardano/cip/cip8.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def sign(
117117
OKPKpX: verification_key.payload, # public key
118118
}
119119

120-
signed_message = {
120+
signed_message = { # type: ignore
121121
"signature": signed_message,
122122
"key": CoseKey.from_dict(key_to_return).encode().hex(),
123123
}

pycardano/plutus.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class CostModels(DictCBORSerializable):
6262
VALUE_TYPE = dict
6363

6464
def to_shallow_primitive(self) -> dict:
65-
result = {}
65+
result: dict[bytes, Union[typing.List[Any], bytes]] = {}
6666
for language in sorted(self.keys()):
6767
cost_model = self[language]
6868
if language == 0:
@@ -788,7 +788,7 @@ def __deepcopy__(self, memo):
788788
class RawPlutusData(CBORSerializable):
789789
data: RawDatum
790790

791-
def to_primitive(self) -> RawDatum:
791+
def to_primitive(self) -> Primitive:
792792
def _dfs(obj):
793793
if isinstance(obj, list) and obj:
794794
return IndefiniteList([_dfs(item) for item in obj])

pycardano/serialization.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ class RawCBOR:
9898
dict,
9999
defaultdict,
100100
OrderedDict,
101-
undefined.__class__,
102101
datetime,
103102
re.Pattern,
104103
CBORSimpleValue,
@@ -108,6 +107,7 @@ class RawCBOR:
108107
frozendict,
109108
FrozenList,
110109
IndefiniteFrozenList,
110+
ByteString,
111111
]
112112

113113
PRIMITIVE_TYPES = (
@@ -481,7 +481,7 @@ def from_cbor(cls, payload: Union[str, bytes]) -> CBORSerializable:
481481
"""
482482
if type(payload) == str:
483483
payload = bytes.fromhex(payload)
484-
value = loads(payload)
484+
value = loads(payload) # type: ignore
485485
return cls.from_primitive(value)
486486

487487
def __repr__(self):
@@ -639,7 +639,7 @@ class ArrayCBORSerializable(CBORSerializable):
639639
Test2(c='c', test1=Test1(a='a', b=None))
640640
"""
641641

642-
def to_shallow_primitive(self) -> List[Primitive]:
642+
def to_shallow_primitive(self) -> Primitive:
643643
"""
644644
Returns:
645645
:const:`Primitive`: A CBOR primitive.

pycardano/transaction.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ def __post_init__(self):
289289
else:
290290
self._TYPE = 1
291291

292-
def to_shallow_primitive(self) -> List[Primitive]:
292+
def to_shallow_primitive(self) -> Primitive:
293+
data: Union[CBORTag, DatumHash]
293294
if self._TYPE == 1:
294295
data = CBORTag(24, cbor2.dumps(self.datum, default=default_encoder))
295296
else:

0 commit comments

Comments
 (0)