Skip to content

Commit

Permalink
Running black over the altered file
Browse files Browse the repository at this point in the history
  • Loading branch information
emrainey committed Dec 29, 2023
1 parent 2ffcb8f commit 81aa655
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pycyphal/transport/can/media/candump/_candump.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ def list_available_interface_names(*, recurse: bool = False) -> Iterable[str]:
_RE_REC_REMOTE = re.compile(r"(?a)^\s*\((\d+\.\d+)\)\s+([\w-]+)\s+([\da-fA-F]+)#R")
_RE_REC_DATA = re.compile(r"(?a)^\s*\((\d+\.\d+)\)\s+([\w-]+)\s+([\da-fA-F]+)#(#\d)?([\da-fA-F]*)")


@dataclasses.dataclass(frozen=True)
class Record:
@staticmethod
Expand All @@ -258,7 +259,7 @@ def parse(line: str) -> None | Record:
if s_data is None:
s_data = ""
if len(s_data) % 2 != 0:
return UnsupportedRecord() # Must be an even number of nibbles
return UnsupportedRecord() # Must be an even number of nibbles
# _logger.info(f"Received {s_ts} from {iface_name} with ID {s_canid} and flags {s_flags} data {s_data}")
return DataFrameRecord(
ts=Timestamp(
Expand All @@ -269,7 +270,7 @@ def parse(line: str) -> None | Record:
fmt=FrameFormat.EXTENDED if len(s_canid) > 3 else FrameFormat.BASE,
can_id=int(s_canid, 16),
can_payload=bytes.fromhex(s_data),
can_flags=int(s_flags[1:], 16) # skip over #
can_flags=int(s_flags[1:], 16), # skip over #
)
except ValueError as ex:
_logger.debug("Cannot convert values from line %r: %r", line, ex)
Expand Down Expand Up @@ -338,10 +339,10 @@ def _unittest_record_parse() -> None:
assert rec.can_flags == 3
assert rec.can_payload == bytes()
print(rec)

rec = Record.parse("(1703173569.357659) can0 0C7D5522##3210\n")
assert isinstance(rec, UnsupportedRecord)

rec = Record.parse("(1657805304.099792) slcan0 123#R\n")
assert isinstance(rec, UnsupportedRecord)

Expand Down

0 comments on commit 81aa655

Please sign in to comment.