Skip to content

Commit 7f9255d

Browse files
committed
CRAI nitpick
1 parent c4e0e74 commit 7f9255d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

plugwise_usb/nodes/circle.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,10 @@ def _collect_records(data: str) -> dict[int, dict[int, tuple[datetime, int]]]:
108108
second=int(parts[5]),
109109
tzinfo=UTC,
110110
)
111-
if logs.get(address) is None:
112-
logs[address] = {}
113-
logs[address][slot] = (timestamp, pulses)
111+
bucket = logs.setdefault(address, {})
112+
# Keep the first occurrence (cache is newest-first), skip older duplicates
113+
if slot not in bucket:
114+
bucket[slot] = (timestamp, pulses)
114115

115116
return logs
116117

0 commit comments

Comments
 (0)