Skip to content

Commit da94527

Browse files
committed
Apply formattnig
1 parent e3ea006 commit da94527

File tree

6 files changed

+32
-45
lines changed

6 files changed

+32
-45
lines changed

plugwise_usb/messages/requests.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ class CircleClockSetRequest(PlugwiseRequest):
750750
_identifier = b"0016"
751751
_reply_identifier = b"0000"
752752

753-
def __init__( # pylint: disable=too-many-arguments
753+
def __init__( # pylint: disable=too-many-arguments
754754
self,
755755
send_fn: Callable[[PlugwiseRequest, bool], Awaitable[PlugwiseResponse | None]],
756756
mac: bytes,
@@ -1083,7 +1083,7 @@ class NodeAddToGroupRequest(PlugwiseRequest):
10831083
_identifier = b"0045"
10841084
_reply_identifier = b"0000"
10851085

1086-
def __init__( # pylint: disable=too-many-arguments
1086+
def __init__( # pylint: disable=too-many-arguments
10871087
self,
10881088
send_fn: Callable[[PlugwiseRequest, bool], Awaitable[PlugwiseResponse | None]],
10891089
mac: bytes,
@@ -1231,7 +1231,7 @@ class NodeSleepConfigRequest(PlugwiseRequest):
12311231
_identifier = b"0050"
12321232
_reply_identifier = b"0000"
12331233

1234-
def __init__( # pylint: disable=too-many-arguments
1234+
def __init__( # pylint: disable=too-many-arguments
12351235
self,
12361236
send_fn: Callable[[PlugwiseRequest, bool], Awaitable[PlugwiseResponse | None]],
12371237
mac: bytes,
@@ -1402,7 +1402,7 @@ class ScanConfigureRequest(PlugwiseRequest):
14021402
_identifier = b"0101"
14031403
_reply_identifier = b"0100"
14041404

1405-
def __init__( # pylint: disable=too-many-arguments
1405+
def __init__( # pylint: disable=too-many-arguments
14061406
self,
14071407
send_fn: Callable[[PlugwiseRequest, bool], Awaitable[PlugwiseResponse | None]],
14081408
mac: bytes,

plugwise_usb/nodes/circle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ async def _node_info_load_from_cache(self) -> bool:
911911
return result
912912
return False
913913

914-
async def update_node_details( # pylint: disable=too-many-arguments
914+
async def update_node_details( # pylint: disable=too-many-arguments
915915
self,
916916
firmware: datetime | None,
917917
hardware: str | None,

plugwise_usb/nodes/helpers/counter.py

Lines changed: 19 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Energy counter."""
2+
23
from __future__ import annotations
34

45
from datetime import datetime, timedelta
@@ -81,21 +82,17 @@ def add_empty_log(self, address: int, slot: int) -> None:
8182
"""Add empty energy log record to mark any start of beginning of energy log collection."""
8283
self._pulse_collection.add_empty_log(address, slot)
8384

84-
def add_pulse_log(
85+
def add_pulse_log( # pylint: disable=too-many-arguments
8586
self,
8687
address: int,
8788
slot: int,
8889
timestamp: datetime,
8990
pulses: int,
90-
import_only: bool = False
91-
) -> None: # pylint: disable=too-many-arguments
91+
import_only: bool = False,
92+
) -> None:
9293
"""Add pulse log."""
9394
if self._pulse_collection.add_log(
94-
address,
95-
slot,
96-
timestamp,
97-
pulses,
98-
import_only
95+
address, slot, timestamp, pulses, import_only
9996
):
10097
if not import_only:
10198
self.update()
@@ -160,45 +157,37 @@ def update(self) -> None:
160157
self._pulse_collection.recalculate_missing_log_addresses()
161158
if self._calibration is None:
162159
return
163-
self._energy_statistics.log_interval_consumption = self._pulse_collection.log_interval_consumption
164-
self._energy_statistics.log_interval_production = self._pulse_collection.log_interval_production
160+
self._energy_statistics.log_interval_consumption = (
161+
self._pulse_collection.log_interval_consumption
162+
)
163+
self._energy_statistics.log_interval_production = (
164+
self._pulse_collection.log_interval_production
165+
)
165166
(
166167
self._energy_statistics.hour_consumption,
167168
self._energy_statistics.hour_consumption_reset,
168-
) = self._counters[EnergyType.CONSUMPTION_HOUR].update(
169-
self._pulse_collection
170-
)
169+
) = self._counters[EnergyType.CONSUMPTION_HOUR].update(self._pulse_collection)
171170
(
172171
self._energy_statistics.day_consumption,
173172
self._energy_statistics.day_consumption_reset,
174-
) = self._counters[EnergyType.CONSUMPTION_DAY].update(
175-
self._pulse_collection
176-
)
173+
) = self._counters[EnergyType.CONSUMPTION_DAY].update(self._pulse_collection)
177174
(
178175
self._energy_statistics.week_consumption,
179176
self._energy_statistics.week_consumption_reset,
180-
) = self._counters[EnergyType.CONSUMPTION_WEEK].update(
181-
self._pulse_collection
182-
)
177+
) = self._counters[EnergyType.CONSUMPTION_WEEK].update(self._pulse_collection)
183178

184179
(
185180
self._energy_statistics.hour_production,
186181
self._energy_statistics.hour_production_reset,
187-
) = self._counters[EnergyType.PRODUCTION_HOUR].update(
188-
self._pulse_collection
189-
)
182+
) = self._counters[EnergyType.PRODUCTION_HOUR].update(self._pulse_collection)
190183
(
191184
self._energy_statistics.day_production,
192185
self._energy_statistics.day_production_reset,
193-
) = self._counters[EnergyType.PRODUCTION_DAY].update(
194-
self._pulse_collection
195-
)
186+
) = self._counters[EnergyType.PRODUCTION_DAY].update(self._pulse_collection)
196187
(
197188
self._energy_statistics.week_production,
198189
self._energy_statistics.week_production_reset,
199-
) = self._counters[EnergyType.PRODUCTION_WEEK].update(
200-
self._pulse_collection
201-
)
190+
) = self._counters[EnergyType.PRODUCTION_WEEK].update(self._pulse_collection)
202191

203192
@property
204193
def timestamp(self) -> datetime | None:
@@ -223,9 +212,7 @@ def __init__(
223212
"""Initialize energy counter based on energy id."""
224213
self._mac = mac
225214
if energy_id not in ENERGY_COUNTERS:
226-
raise EnergyError(
227-
f"Invalid energy id '{energy_id}' for Energy counter"
228-
)
215+
raise EnergyError(f"Invalid energy id '{energy_id}' for Energy counter")
229216
self._calibration: EnergyCalibration | None = None
230217
self._duration = "hour"
231218
if energy_id in ENERGY_DAY_COUNTERS:
@@ -311,9 +298,7 @@ def update(
311298
if self._energy_id in ENERGY_HOUR_COUNTERS:
312299
last_reset = last_reset.replace(minute=0, second=0, microsecond=0)
313300
elif self._energy_id in ENERGY_DAY_COUNTERS:
314-
last_reset = last_reset.replace(
315-
hour=0, minute=0, second=0, microsecond=0
316-
)
301+
last_reset = last_reset.replace(hour=0, minute=0, second=0, microsecond=0)
317302
elif self._energy_id in ENERGY_WEEK_COUNTERS:
318303
last_reset = last_reset - timedelta(days=last_reset.weekday())
319304
last_reset = last_reset.replace(

plugwise_usb/nodes/helpers/pulses.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,14 +363,14 @@ def add_empty_log(self, address: int, slot: int) -> None:
363363
if recalculate:
364364
self.recalculate_missing_log_addresses()
365365

366-
def add_log(
366+
def add_log( # pylint: disable=too-many-arguments
367367
self,
368368
address: int,
369369
slot: int,
370370
timestamp: datetime,
371371
pulses: int,
372372
import_only: bool = False,
373-
) -> bool: # pylint: disable=too-many-arguments
373+
) -> bool:
374374
"""Store pulse log."""
375375
log_record = PulseLogRecord(timestamp, pulses, CONSUMED)
376376
if not self._add_log_record(address, slot, log_record):

plugwise_usb/nodes/node.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,9 @@ async def _available_update_state(
433433
return
434434
_LOGGER.info("Device %s detected to be not available (off-line)", self.name)
435435
self._available = False
436-
await self.publish_feature_update_to_subscribers(NodeFeature.AVAILABLE, self.available_state)
436+
await self.publish_feature_update_to_subscribers(
437+
NodeFeature.AVAILABLE, self.available_state
438+
)
437439

438440
async def node_info_update(
439441
self, node_info: NodeInfoResponse | None = None
@@ -474,7 +476,7 @@ async def _node_info_load_from_cache(self) -> bool:
474476
logaddress_pointer=None,
475477
)
476478

477-
async def update_node_details(
479+
async def update_node_details( # pylint: disable=too-many-arguments
478480
self,
479481
firmware: datetime | None,
480482
hardware: str | None,

plugwise_usb/nodes/sed.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ async def schedule_task_when_awake(
657657
self._send_task_queue.append(task_fn)
658658
self._send_task_lock.release()
659659

660-
async def sed_configure( # pylint: disable=too-many-arguments
660+
async def sed_configure( # pylint: disable=too-many-arguments
661661
self,
662662
awake_duration: int,
663663
sleep_duration: int,
@@ -712,7 +712,7 @@ async def sed_configure( # pylint: disable=too-many-arguments
712712
)
713713
return False
714714

715-
async def _sed_configure_update( # pylint: disable=too-many-arguments
715+
async def _sed_configure_update( # pylint: disable=too-many-arguments
716716
self,
717717
awake_duration: int = SED_DEFAULT_AWAKE_DURATION,
718718
clock_interval: int = SED_DEFAULT_CLOCK_INTERVAL,

0 commit comments

Comments
 (0)