Skip to content

Commit 78df264

Browse files
UPDATE. disable mypy str-bytes-safe check to allow bytes to be formatted automatically within a f-string
1 parent e165e52 commit 78df264

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

pycardano/nativescript.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def from_primitive(
4343
),
4444
):
4545
raise DeserializeException(
46-
f"A list or a tuple is required for deserialization: {str(value)}"
46+
f"A list or a tuple is required for deserialization: {value}"
4747
)
4848

4949
script_type: int = value[0]

pycardano/network.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ def to_primitive(self) -> int:
2626
def from_primitive(cls: Type[Network], value: Primitive) -> Network:
2727
if not isinstance(value, int):
2828
raise DeserializeException(
29-
f"An integer value is required for deserialization: {str(value)}"
29+
f"An integer value is required for deserialization: {value}"
3030
)
3131
return cls(value)

pycardano/serialization.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ def _restore_dataclass_field(
407407
elif t in PRIMITIVE_TYPES and isinstance(v, t):
408408
return v
409409
raise DeserializeException(
410-
f"Cannot deserialize object: \n{str(v)}\n in any valid type from {t_args}."
410+
f"Cannot deserialize object: \n{v}\n in any valid type from {t_args}."
411411
)
412412
return v
413413

@@ -739,10 +739,10 @@ def from_primitive(cls: Type[DictBase], value: Primitive) -> DictBase:
739739
DeserializeException: When the object could not be restored from primitives.
740740
"""
741741
if not value:
742-
raise DeserializeException(f"Cannot accept empty value {str(value)}.")
742+
raise DeserializeException(f"Cannot accept empty value {value}.")
743743
if not isinstance(value, dict):
744744
raise DeserializeException(
745-
f"A dictionary value is required for deserialization: {str(value)}"
745+
f"A dictionary value is required for deserialization: {value}"
746746
)
747747

748748
restored = cls()

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ profile = "black"
6363

6464
[tool.mypy]
6565
ignore_missing_imports = true
66+
disable_error_code = ["str-bytes-safe"]
6667
python_version = 3.7
6768
exclude = [
6869
'^pycardano/cip/cip8.py$',

0 commit comments

Comments
 (0)