Skip to content

Commit 1054315

Browse files
committed
Implement pylint suggestions
1 parent 723abe9 commit 1054315

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

plugwise_usb/nodes/helpers/pulses.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -623,29 +623,33 @@ def _reset_log_references(self) -> None:
623623
if log_record.is_consumption:
624624
if self._last_log_consumption_timestamp is None:
625625
self._last_log_consumption_timestamp = log_record.timestamp
626-
if self._last_log_consumption_timestamp <= log_record.timestamp:
627-
self._last_log_consumption_timestamp = log_record.timestamp
626+
self._last_log_consumption_timestamp = max(
627+
self._last_log_consumption_timestamp, log_record.timestamp
628+
)
628629
self._last_log_consumption_address = address
629630
self._last_log_consumption_slot = slot
630631

631632
if self._first_log_consumption_timestamp is None:
632633
self._first_log_consumption_timestamp = log_record.timestamp
633-
if self._first_log_consumption_timestamp >= log_record.timestamp:
634-
self._first_log_consumption_timestamp = log_record.timestamp
634+
self._first_log_consumption_timestamp = min(
635+
self._first_log_consumption_timestamp, log_record.timestamp
636+
)
635637
self._first_log_consumption_address = address
636638
self._first_log_consumption_slot = slot
637639
else:
638640
if self._last_log_production_timestamp is None:
639641
self._last_log_production_timestamp = log_record.timestamp
640-
if self._last_log_production_timestamp <= log_record.timestamp:
641-
self._last_log_production_timestamp = log_record.timestamp
642+
self._last_log_production_timestamp = max(
643+
self._last_log_production_timestamp, log_record.timestamp
644+
)
642645
self._last_log_production_address = address
643646
self._last_log_production_slot = slot
644647

645648
if self._first_log_production_timestamp is None:
646649
self._first_log_production_timestamp = log_record.timestamp
647-
if self._first_log_production_timestamp > log_record.timestamp:
648-
self._first_log_production_timestamp = log_record.timestamp
650+
self._first_log_production_timestamp = min(
651+
self._first_log_production_timestamp, log_record.timestamp
652+
)
649653
self._first_log_production_address = address
650654
self._first_log_production_slot = slot
651655

0 commit comments

Comments
 (0)