aboutsummaryrefslogtreecommitdiff
path: root/codegen/lib
diff options
context:
space:
mode:
Diffstat (limited to 'codegen/lib')
-rw-r--r--codegen/lib/utils.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/codegen/lib/utils.py b/codegen/lib/utils.py
index ff1a5d36..c185c0e5 100644
--- a/codegen/lib/utils.py
+++ b/codegen/lib/utils.py
@@ -18,7 +18,7 @@ def padded_hex(n: int):
class PacketIdentifier:
- def __init__(self, packet_id, direction, state):
+ def __init__(self, packet_id: int, direction: str, state: str):
self.packet_id = packet_id
self.direction = direction
self.state = state
@@ -29,6 +29,12 @@ class PacketIdentifier:
def __hash__(self):
return hash((self.packet_id, self.direction, self.state))
+ def __str__(self):
+ return f'{self.packet_id} {self.direction} {self.state}'
+
+ def __repr__(self):
+ return f'PacketIdentifier({self.packet_id}, {self.direction}, {self.state})'
+
def group_packets(packets: list[PacketIdentifier]):
packet_groups: dict[tuple[str, str], list[int]] = {}