Skip to content

Commit 0d55d91

Browse files
committed
Force accept UP031 using noqa
fix Ruff UP018: Remove unnecessary int call (rewrite as a literal) fix Ruff W293: blank line contains whitespace fix Ruff W291: Trailing whitespace fix Ruff I001: Import block is un-sorted or un-formatted fix Ruff D204: blank line required after class docstring fix Ruff D413: Missing blank line after last section ("Returns")
1 parent f14a0a9 commit 0d55d91

File tree

12 files changed

+19
-17
lines changed

12 files changed

+19
-17
lines changed

plugwise_usb/connection/queue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ async def stop(self) -> None:
7676

7777
async def submit(self, request: PlugwiseRequest) -> PlugwiseResponse | None:
7878
"""Add request to queue and return the received node-response when applicable.
79-
79+
8080
Raises an error when something fails.
8181
"""
8282
if request.waiting_for_response:

plugwise_usb/connection/sender.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def __init__(self, stick_receiver: StickReceiver, transport: Transport) -> None:
4848
def processed_messages(self) -> int:
4949
"""Return the number of processed messages."""
5050
return self._processed_msgs
51-
51+
5252
async def start(self) -> None:
5353
"""Start the sender."""
5454
# Subscribe to ACCEPT stick responses, which contain the seq_id we need.

plugwise_usb/helpers/cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ async def initialize_cache(self, create_root_folder: bool = False) -> None:
5959
cache_dir = self._get_writable_os_dir()
6060
await makedirs(cache_dir, exist_ok=True)
6161
self._cache_path = cache_dir
62-
62+
6363
self._cache_file = os_path_join(self._cache_path, self._file_name)
6464
self._cache_file_exists = await ospath.exists(self._cache_file)
6565
self._initialized = True

plugwise_usb/messages/properties.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def __init__(self, value: int, length: int = 2, negative: bool = True) -> None:
108108

109109
def serialize(self) -> bytes:
110110
"""Return current string formatted value into an iterable list of bytes."""
111-
fmt = "%%0%dX" % self.length
111+
fmt = "%%0%dX" % self.length # noqa: UP031
112112
return bytes(fmt % self._raw_value, UTF8)
113113

114114
def deserialize(self, val: bytes) -> None:
@@ -144,7 +144,7 @@ def negative(val: int, octals: int) -> int:
144144

145145
def serialize(self) -> bytes:
146146
"""Return current string formatted integer value into an iterable list of bytes."""
147-
fmt = "%%0%dX" % self.length
147+
fmt = "%%0%dX" % self.length # noqa: UP031
148148
return bytes(fmt % int_to_uint(self._raw_value, self.length), UTF8)
149149

150150
def deserialize(self, val: bytes) -> None:
@@ -172,7 +172,7 @@ def serialize(self) -> bytes:
172172
"""Return current string formatted value into an iterable list of bytes."""
173173
if not isinstance(self._raw_value, datetime):
174174
raise MessageError("Unable to serialize. Value is not a datetime object")
175-
fmt = "%%0%dX" % self.length
175+
fmt = "%%0%dX" % self.length # noqa: UP031
176176
date_in_float = self._raw_value.timestamp()
177177
return bytes(fmt % int(date_in_float), UTF8)
178178

@@ -287,7 +287,7 @@ def __init__(self, value: int, length: int = 2) -> None:
287287

288288
def serialize(self) -> bytes:
289289
"""Return current string formatted integer value into an iterable list of bytes."""
290-
fmt = "%%0%dd" % self.length
290+
fmt = "%%0%dd" % self.length # noqa: UP031
291291
return bytes(fmt % self._raw_value, UTF8)
292292

293293
def deserialize(self, val: bytes) -> None:
@@ -391,7 +391,7 @@ def serialize(self) -> bytes:
391391
def deserialize(self, val: bytes) -> None:
392392
"""Convert data into integer value based on log address formatted data."""
393393
if val == b"00000000":
394-
self._value = int(0)
394+
self._value = 0
395395
return
396396
Int.deserialize(self, val)
397397
self._value = (self.value - LOGADDR_OFFSET) // 32

plugwise_usb/messages/requests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,7 @@ class CircleMeasureIntervalRequest(PlugwiseRequest):
12631263
12641264
FIXME: Make sure production interval is a multiply of consumption !!
12651265
1266-
Response message: NodeResponse with ack-type POWER_LOG_INTERVAL_ACCEPTED
1266+
Response message: NodeResponse with ack-type POWER_LOG_INTERVAL_ACCEPTED
12671267
"""
12681268

12691269
_identifier = b"0057"

plugwise_usb/nodes/circle_plus.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,15 @@
88
from ..api import NodeEvent, NodeFeature
99
from ..constants import MAX_TIME_DRIFT
1010
from ..messages.requests import (
11+
CirclePlusAllowJoiningRequest,
1112
CirclePlusRealTimeClockGetRequest,
1213
CirclePlusRealTimeClockSetRequest,
13-
CirclePlusAllowJoiningRequest,
1414
)
1515
from ..messages.responses import NodeResponseType
1616
from .circle import PlugwiseCircle
17-
from .helpers.firmware import CIRCLE_PLUS_FIRMWARE_SUPPORT
1817
from .helpers import raise_not_loaded
18+
from .helpers.firmware import CIRCLE_PLUS_FIRMWARE_SUPPORT
19+
1920
_LOGGER = logging.getLogger(__name__)
2021

2122

@@ -131,6 +132,7 @@ async def enable_auto_join(self) -> bool:
131132
132133
Returns:
133134
bool: True if the request was acknowledged, False otherwise.
135+
134136
"""
135137
_LOGGER.info("Enabling auto-join for CirclePlus")
136138
request = CirclePlusAllowJoiningRequest(self._send, True)

plugwise_usb/nodes/helpers/pulses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import logging
88
from typing import Final
99

10-
from ...constants import LOGADDR_MAX, MINUTE_IN_SECONDS, DAY_IN_HOURS
10+
from ...constants import DAY_IN_HOURS, LOGADDR_MAX, MINUTE_IN_SECONDS
1111
from ...exceptions import EnergyError
1212

1313
_LOGGER = logging.getLogger(__name__)

plugwise_usb/nodes/helpers/subscription.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from dataclasses import dataclass
88
from typing import Any
99

10-
1110
from ...api import NodeFeature
1211

1312

@@ -21,6 +20,7 @@ class NodeFeatureSubscription:
2120

2221
class FeaturePublisher:
2322
"""Base Class to call awaitable of subscription when event happens."""
23+
2424
def __init__(self) -> None:
2525
"""Initialize FeaturePublisher Class."""
2626
self._feature_update_subscribers: dict[

plugwise_usb/nodes/node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ async def _node_info_load_from_cache(self) -> bool:
478478
node_type: NodeType | None = None
479479
if (node_type_str := self._get_cache(CACHE_NODE_TYPE)) is not None:
480480
node_type = NodeType(int(node_type_str))
481-
481+
482482
return await self.update_node_details(
483483
firmware=firmware,
484484
hardware=hardware,

plugwise_usb/nodes/scan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
# Sensitivity values for motion sensor configuration
5151
SENSITIVITY_HIGH_VALUE = 20 # 0x14
52-
SENSITIVITY_MEDIUM_VALUE = 30 # 0x1E
52+
SENSITIVITY_MEDIUM_VALUE = 30 # 0x1E
5353
SENSITIVITY_OFF_VALUE = 255 # 0xFF
5454

5555
# endregion

0 commit comments

Comments
 (0)