Skip to content

Commit 9c0f983

Browse files
⬆️ Update dependency ruff to v0.1.15 (#1228)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Franck Nijhof <[email protected]>
1 parent 0ecc819 commit 9c0f983

File tree

4 files changed

+55
-20
lines changed

4 files changed

+55
-20
lines changed

poetry.lock

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pylint = "3.0.3"
4848
pytest = "7.4.4"
4949
pytest-asyncio = "0.23.4"
5050
pytest-cov = "4.1.0"
51-
ruff = "0.1.14"
51+
ruff = "0.1.15"
5252
safety = "3.0.1"
5353
types-cachetools = "^5.3.0"
5454
yamllint = "1.33.0"

src/wled/models.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def from_dict(data: dict[str, Any]) -> Nightlight:
3131
Returns:
3232
-------
3333
A Nightlight object.
34+
3435
"""
3536
nightlight = data.get("nl", {})
3637

@@ -69,6 +70,7 @@ def from_dict(data: dict[str, Any]) -> Sync:
6970
Returns:
7071
-------
7172
A sync object.
73+
7274
"""
7375
sync = data.get("udpn", {})
7476
return Sync(send=sync.get("send", False), receive=sync.get("recv", False))
@@ -93,6 +95,7 @@ class Palette:
9395
Returns:
9496
-------
9597
A palette object.
98+
9699
"""
97100

98101
name: str
@@ -110,6 +113,7 @@ class Segment:
110113
Returns:
111114
-------
112115
A segment object.
116+
113117
"""
114118

115119
brightness: int
@@ -154,6 +158,7 @@ def from_dict( # noqa: PLR0913
154158
Returns:
155159
-------
156160
An Segment object.
161+
157162
"""
158163
start = data.get("start", 0)
159164
stop = data.get("stop", 0)
@@ -223,6 +228,7 @@ def from_dict(data: dict[str, Any]) -> Leds:
223228
Returns:
224229
-------
225230
A Leds object.
231+
226232
"""
227233
leds = data.get("leds", {})
228234

@@ -259,6 +265,7 @@ class Wifi:
259265
Returns:
260266
-------
261267
A Wi-Fi object.
268+
262269
"""
263270

264271
bssid: str
@@ -277,6 +284,7 @@ def from_dict(data: dict[str, Any]) -> Wifi | None:
277284
Returns:
278285
-------
279286
An Wifi object.
287+
280288
"""
281289
if "wifi" not in data:
282290
return None
@@ -300,6 +308,7 @@ class Filesystem:
300308
Returns:
301309
-------
302310
A Filesystem object.
311+
303312
"""
304313

305314
total: int
@@ -318,6 +327,7 @@ def from_dict(data: dict[str, Any]) -> Filesystem | None:
318327
Returns:
319328
-------
320329
An Filesystem object.
330+
321331
"""
322332
if "fs" not in data:
323333
return None
@@ -372,6 +382,7 @@ def from_dict(data: dict[str, Any]) -> Info:
372382
Returns:
373383
-------
374384
A info object.
385+
375386
"""
376387
if (websocket := data.get("ws")) == -1:
377388
websocket = None
@@ -447,6 +458,7 @@ def playlist_active(self) -> bool:
447458
Returns
448459
-------
449460
True if there is currently a playlist active, False otherwise.
461+
450462
"""
451463
return self.playlist == -1
452464

@@ -457,6 +469,7 @@ def preset_active(self) -> bool:
457469
Returns
458470
-------
459471
True is a preset is currently active, False otherwise.
472+
460473
"""
461474
return self.preset == -1
462475

@@ -481,6 +494,7 @@ def from_dict(
481494
Returns:
482495
-------
483496
A State object.
497+
484498
"""
485499
brightness = data.get("bri", 1)
486500
on = data.get("on", False)
@@ -556,6 +570,7 @@ def from_dict(
556570
Returns:
557571
-------
558572
A Preset object.
573+
559574
"""
560575
segment_data = data.get("seg", [])
561576
if not isinstance(segment_data, list):
@@ -629,6 +644,7 @@ def from_dict(
629644
Returns:
630645
-------
631646
A Playlist object.
647+
632648
"""
633649
playlist = data.get("playlist", {})
634650
entries_durations = playlist.get("dur", [])
@@ -684,6 +700,7 @@ def __init__(self, data: dict[str, Any]) -> None:
684700
------
685701
WLEDError: In case the given API response is incomplete in a way
686702
that a Device object cannot be constructed from it.
703+
687704
"""
688705
self.effects = []
689706
self.palettes = []
@@ -710,6 +727,7 @@ def update_from_dict(self, data: dict[str, Any]) -> Device:
710727
Returns:
711728
-------
712729
The updated Device object.
730+
713731
"""
714732
if _effects := data.get("effects"):
715733
effects = [

src/wled/wled.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ def connected(self) -> bool:
5353
-------
5454
True if we are connected to the WebSocket of a WLED device,
5555
False otherwise.
56+
5657
"""
5758
return self._client is not None and not self._client.closed
5859

@@ -65,6 +66,7 @@ async def connect(self) -> None:
6566
communications.
6667
WLEDConnectionError: Error occurred while communicating with
6768
the WLED device via the WebSocket.
69+
6870
"""
6971
if self.connected:
7072
return
@@ -106,6 +108,7 @@ async def listen(self, callback: Callable[[Device], None]) -> None:
106108
to the WLED device.
107109
WLEDConnectionClosedError: The WebSocket connection to the remote WLED
108110
has been closed.
111+
109112
"""
110113
if not self._client or not self.connected or not self._device:
111114
msg = "Not connected to a WLED WebSocket"
@@ -167,6 +170,7 @@ async def request(
167170
WLEDConnectionTimeoutError: A timeout occurred while communicating
168171
with the WLED device.
169172
WLEDError: Received an unexpected response from the WLED device.
173+
170174
"""
171175
url = URL.build(scheme="http", host=self.host, port=80, path=uri)
172176

@@ -250,6 +254,7 @@ async def update(self, *, full_update: bool = False) -> Device: # noqa: PLR0912
250254
Raises:
251255
------
252256
WLEDEmptyResponseError: The WLED device returned an empty response.
257+
253258
"""
254259
if self._device is None or full_update:
255260
if not (data := await self.request("/json")):
@@ -352,6 +357,7 @@ async def master(
352357
transition: Duration of the crossfade between different
353358
colors/brightness levels. One unit is 100ms, so a value of 4
354359
results in a transition of 400ms.
360+
355361
"""
356362
state: dict[str, bool | int] = {}
357363

@@ -423,6 +429,7 @@ async def segment( # noqa: PLR0912, PLR0913
423429
Raises:
424430
------
425431
WLEDError: Something went wrong setting the segment state.
432+
426433
"""
427434
if self._device is None:
428435
await self.update()
@@ -521,6 +528,7 @@ async def transition(self, transition: int) -> None:
521528
transition: Duration of the default crossfade between different
522529
colors/brightness levels. One unit is 100ms, so a value of 4
523530
results in a transition of 400ms.
531+
524532
"""
525533
await self.request(
526534
"/json/state",
@@ -534,6 +542,7 @@ async def preset(self, preset: int | str | Preset) -> None:
534542
Args:
535543
----
536544
preset: The preset to activate on this WLED device.
545+
537546
"""
538547
# Find preset if it was based on a name
539548
if self._device and self._device.presets and isinstance(preset, str):
@@ -557,6 +566,7 @@ async def playlist(self, playlist: int | str | Playlist) -> None:
557566
Args:
558567
----
559568
playlist: The playlist to activate on this WLED device.
569+
560570
"""
561571
# Find playlist if it was based on a name
562572
if self._device and self._device.playlists and isinstance(playlist, str):
@@ -580,6 +590,7 @@ async def live(self, live: Live) -> None:
580590
Args:
581591
----
582592
live: The live override mode to set on this WLED device.
593+
583594
"""
584595
await self.request("/json/state", method="POST", data={"lor": live.value})
585596

@@ -595,6 +606,7 @@ async def sync(
595606
----
596607
send: Send WLED broadcast (UDP sync) packet on state change.
597608
receive: Receive broadcast packets.
609+
598610
"""
599611
sync = {"send": send, "recv": receive}
600612
sync = {k: v for k, v in sync.items() if v is not None}
@@ -618,6 +630,7 @@ async def nightlight(
618630
target brightness once the duration has elapsed.
619631
on: A boolean, true to turn the nightlight on, false otherwise.
620632
target_brightness: Target brightness of nightlight, between 0 and 255.
633+
621634
"""
622635
nightlight = {
623636
"dur": duration,
@@ -642,6 +655,7 @@ async def upgrade(self, *, version: str | AwesomeVersion) -> None:
642655
WLEDUpgradeError: If the upgrade has failed.
643656
WLEDConnectionTimeoutError: When a connection timeout occurs.
644657
WLEDConnectionError: When a connection error occurs.
658+
645659
"""
646660
if self._device is None:
647661
await self.update()
@@ -732,6 +746,7 @@ async def get_wled_versions_from_github(self) -> dict[str, str | None]:
732746
GitHub for WLED version information.
733747
WLEDError: Didn't get a JSON response from GitHub while retrieving
734748
version information.
749+
735750
"""
736751
with suppress(KeyError):
737752
return {
@@ -810,6 +825,7 @@ async def __aenter__(self) -> Self:
810825
Returns
811826
-------
812827
The WLED object.
828+
813829
"""
814830
return self
815831

@@ -819,5 +835,6 @@ async def __aexit__(self, *_exc_info: object) -> None:
819835
Args:
820836
----
821837
_exc_info: Exec type.
838+
822839
"""
823840
await self.close()

0 commit comments

Comments
 (0)