Skip to content

Commit

Permalink
Bug fixed: Vector is not hashable. (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
ATATC committed Sep 30, 2024
1 parent 45d3d8f commit d54abbf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions leads/data_persistence/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ def __init__(self, *coordinates: E) -> None:
self._d: int = len(coordinates)
self._coordinates: tuple[E, ...] = coordinates

@_override
def __hash__(self) -> int:
return hash(self._coordinates)

@_override
def __len__(self) -> int:
return self._d
Expand Down
3 changes: 2 additions & 1 deletion leads_vec_rc/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ def on_receive(self, service: Service, msg: bytes) -> None:
self.super(service=service, msg=msg)
try:
self.current_data = d = loads(msg.decode())
acceleration_record.append(Vector(d["forward_acceleration"], d["lateral_acceleration"]))
acceleration_record.append(Vector(d["forward_acceleration"], d["lateral_acceleration"],
d["vertical_acceleration"]))
gps_record.append(Vector(d["latitude"], d["longitude"]))
if config.save_data:
try_create_csv(d)
Expand Down

0 comments on commit d54abbf

Please sign in to comment.