Skip to content

Commit de7cd2e

Browse files
TheJulianJESDaniel Potts
authored andcommitted
Enable ruff format (zigpy#3273)
* Enable ruff format * Ran ruff format
1 parent 69bee64 commit de7cd2e

File tree

169 files changed

+221
-50
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+221
-50
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,6 @@ repos:
1515
rev: v0.3.2
1616
hooks:
1717
- id: ruff
18-
args: ["--fix", "--exit-non-zero-on-fix", "--config", "pyproject.toml"]
18+
args: ["--fix", "--exit-non-zero-on-fix", "--config", "pyproject.toml"]
19+
- id: ruff-format
20+
args: ["--config", "pyproject.toml"]

tests/common.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Quirks common helpers."""
2+
23
import asyncio
34
import datetime
45

tests/test_ctrl_neutral1.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for xiaomi."""
2+
23
from unittest import mock
34

45
import zhaquirks

tests/test_danfoss.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests the Danfoss quirk (all tests were written for the Popp eT093WRO)."""
2+
23
from unittest import mock
34

45
from zigpy.quirks import CustomCluster
@@ -54,8 +55,7 @@ async def test_danfoss_time_bind(zigpy_device_from_quirk):
5455

5556
def mock_write(attributes, manufacturer=None):
5657
records = [
57-
WriteAttributesStatusRecord(foundation.Status.SUCCESS)
58-
for _ in attributes
58+
WriteAttributesStatusRecord(foundation.Status.SUCCESS) for _ in attributes
5959
]
6060
return [records, []]
6161

@@ -81,8 +81,7 @@ async def test_danfoss_thermostat_write_attributes(zigpy_device_from_quirk):
8181

8282
def mock_write(attributes, manufacturer=None):
8383
records = [
84-
WriteAttributesStatusRecord(foundation.Status.SUCCESS)
85-
for _ in attributes
84+
WriteAttributesStatusRecord(foundation.Status.SUCCESS) for _ in attributes
8685
]
8786
return [records, []]
8887

@@ -126,9 +125,9 @@ def mock_setpoint(oper, sett, manufacturer=None):
126125
assert operation == 0x01
127126
assert setting == 6
128127

129-
danfoss_thermostat_cluster._attr_cache[
130-
0x0015
131-
] = 5 # min_limit is present normally
128+
danfoss_thermostat_cluster._attr_cache[0x0015] = (
129+
5 # min_limit is present normally
130+
)
132131

133132
success, fail = await danfoss_thermostat_cluster.write_attributes(
134133
{"system_mode": 0x00}

tests/test_develco.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for Develco/Frient A/S quirks."""
2+
23
import pytest
34
from zigpy.zcl.clusters.general import DeviceTemperature
45

tests/test_ikea.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,19 @@ def test_ikea_starkvind_v2(assert_signature_matches_quirk):
8787

8888

8989
@pytest.mark.parametrize("attribute", ["fan_speed", "fan_mode"])
90-
@pytest.mark.parametrize("value,expected", [
90+
@pytest.mark.parametrize(
91+
"value,expected",
92+
[
9193
(0, 0), # off
9294
(1, 1), # auto
9395
(10, 2),
9496
(20, 4),
9597
(50, 10),
96-
]
97-
)
98-
async def test_fan_speed_mode_update(zigpy_device_from_quirk, attribute, value, expected):
98+
],
99+
)
100+
async def test_fan_speed_mode_update(
101+
zigpy_device_from_quirk, attribute, value, expected
102+
):
99103
"""Test reading the fan speed and mode."""
100104

101105
starkvind_device = zigpy_device_from_quirk(zhaquirks.ikea.starkvind.IkeaSTARKVIND)

tests/test_inovelli_blue.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for inovelli blue series manufacturer cluster."""
2+
23
from unittest import mock
34
from unittest.mock import MagicMock
45

tests/test_kof.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for KOF."""
2+
23
from unittest import mock
34

45
import zigpy.device

tests/test_smartwings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Tests for Smartwings."""
2+
23
from unittest import mock
34

45
import pytest

tests/test_thirdreality.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
"""Tests for Third Reality quirks."""
22

3-
43
import pytest
54
from zigpy.zcl.clusters.security import IasZone
65

0 commit comments

Comments
 (0)