Skip to content

Commit

Permalink
Address typ issues in build
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicoretti committed Jun 25, 2023
1 parent cf97b06 commit 001482c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions crc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import sys
from dataclasses import dataclass
from typing import (
Any,
BinaryIO,
ByteString,
Iterable,
Expand Down Expand Up @@ -403,13 +404,13 @@ def verify(


def _bytes_generator(
data: Union[int, ByteString, BinaryIO, Iterable[ByteString]]
data: Union[int, ByteString, BinaryIO, Iterable[ByteString]] # type: ignore
) -> Iterable[bytes]:
if isinstance(data, int):
yield data.to_bytes(1, "big")
elif isinstance(data, ByteString):
yield bytes(data)
elif isinstance(data, (Iterable, BinaryIO)):
elif isinstance(data, ByteString): # type: ignore
yield bytes(data) # type: ignore
elif isinstance(data, (Iterable, BinaryIO)): # type: ignore
yield from (bytes(e) for e in data)
else:
raise TypeError(f"Unsupported parameter type: {type(data)}")
Expand Down
2 changes: 1 addition & 1 deletion test/unit/test_crc.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
create_lookup_table,
)

Fixture = namedtuple("TestData", "data checksum")
Fixture = namedtuple("Fixture", "data checksum")


class TemplateTest(unittest.TestCase):
Expand Down

0 comments on commit 001482c

Please sign in to comment.