Skip to content

Commit 9ba55a9

Browse files
authored
Upgrage install and pre-commit dependencies (#1192)
Relaxes the requirements on request from downstream, now requiring: * click >=7 * cryptography >=35 (versioning format was changed in between) * croniter >=1 Also updated the pre-commit requirements and fixed reported issues
1 parent a577fe9 commit 9ba55a9

11 files changed

Lines changed: 161 additions & 172 deletions

File tree

.pre-commit-config.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: v2.4.0
3+
rev: v4.0.1
44
hooks:
55
- id: trailing-whitespace
66
- id: end-of-file-fixer
@@ -12,19 +12,19 @@ repos:
1212
- id: check-ast
1313

1414
- repo: https://github.com/psf/black
15-
rev: 20.8b1
15+
rev: 21.11b1
1616
hooks:
1717
- id: black
1818
language_version: python3
1919

2020
- repo: https://github.com/pre-commit/mirrors-isort
21-
rev: v5.7.0
21+
rev: v5.9.3
2222
hooks:
2323
- id: isort
2424
additional_dependencies: [toml]
2525

2626
- repo: https://github.com/PyCQA/doc8
27-
rev: 0.8.1
27+
rev: 0.10.1
2828
hooks:
2929
- id: doc8
3030

@@ -35,20 +35,20 @@ repos:
3535
args: [--in-place, --wrap-summaries, '88', --wrap-descriptions, '88']
3636

3737
- repo: https://gitlab.com/pycqa/flake8
38-
rev: 3.8.4
38+
rev: 3.9.2
3939
hooks:
4040
- id: flake8
4141
additional_dependencies: [flake8-docstrings, flake8-bugbear, flake8-builtins, flake8-print, flake8-pytest-style, flake8-return, flake8-simplify, flake8-annotations]
4242

4343
- repo: https://github.com/PyCQA/bandit
44-
rev: 1.7.0
44+
rev: 1.7.1
4545
hooks:
4646
- id: bandit
4747
args: [-x, 'tests']
4848

4949

5050
- repo: https://github.com/pre-commit/mirrors-mypy
51-
rev: v0.812
51+
rev: v0.910-1
5252
hooks:
5353
- id: mypy
54-
# args: [--no-strict-optional, --ignore-missing-imports]
54+
additional_dependencies: [types-attrs, types-PyYAML, types-requests, types-pytz, types-croniter]

docs/device_docs/vacuum.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ for original firmwares.
184184

185185
This feature works similarly to the sound updates,
186186
so passing a local file will create a self-hosting server
187-
and updating from an URL requires you to pass the md5 hash of the file.
187+
and updating from an URL requires you to pass the md5 hash of the file.
188188

189189
::
190190

miio/cooker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ def status(self) -> CookerStatus:
620620
Some cookers doesn't support a list of properties here. Therefore "all" properties
621621
are requested. If the property count or order changes the property list above must
622622
be updated.
623-
"""
623+
""" # noqa: B018
624624
values = self.send("get_prop", ["all"])
625625

626626
properties_count = len(properties)

miio/fan_miot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ class FanStatus1C(DeviceStatus):
186186
"""Container for status reports for Xiaomi Mi Smart Pedestal Fan DMaker 1C."""
187187

188188
def __init__(self, data: Dict[str, Any]) -> None:
189-
self.data = data
190189
"""Response of a Fan1C (dmaker.fan.1c):
191190
192191
{
@@ -204,6 +203,7 @@ def __init__(self, data: Dict[str, Any]) -> None:
204203
'exe_time': 280
205204
}
206205
"""
206+
self.data = data
207207

208208
@property
209209
def power(self) -> str:

miio/integrations/vacuum/mijia/g1vacuum.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,9 @@ class G1MopState(Enum):
132132
class G1Status(DeviceStatus):
133133
"""Container for status reports from Mijia Vacuum G1."""
134134

135-
"""Response (MIoT format) of a Mijia Vacuum G1 (mijia.vacuum.v2)
135+
def __init__(self, data):
136+
"""Response (MIoT format) of a Mijia Vacuum G1 (mijia.vacuum.v2)
137+
136138
[
137139
{'did': 'battery', 'siid': 3, 'piid': 1, 'code': 0, 'value': 100},
138140
{'did': 'charge_state', 'siid': 3, 'piid': 2, 'code': 0, 'value': 2},
@@ -151,8 +153,6 @@ class G1Status(DeviceStatus):
151153
{'did': 'clean_area', 'siid': 9, 'piid': 1, 'code': 0, 'value': 0},
152154
{'did': 'clean_time', 'siid': 9, 'piid': 2, 'code': 0, 'value': 0}
153155
]"""
154-
155-
def __init__(self, data):
156156
self.data = data
157157

158158
@property
@@ -245,14 +245,15 @@ def clean_time(self) -> timedelta:
245245

246246

247247
class G1CleaningSummary(DeviceStatus):
248-
"""Container for cleaning summary from Mijia Vacuum G1."""
248+
"""Container for cleaning summary from Mijia Vacuum G1.
249249
250-
"""Response (MIoT format) of a Mijia Vacuum G1 (mijia.vacuum.v2)
250+
Response (MIoT format) of a Mijia Vacuum G1 (mijia.vacuum.v2)
251251
[
252252
{'did': 'total_clean_area', 'siid': 9, 'piid': 3, 'code': 0, 'value': 0},
253253
{'did': 'total_clean_time', 'siid': 9, 'piid': 4, 'code': 0, 'value': 0},
254254
{'did': 'total_clean_count', 'siid': 9, 'piid': 5, 'code': 0, 'value': 0}
255-
]"""
255+
]
256+
"""
256257

257258
def __init__(self, data) -> None:
258259
self.data = data

miio/integrations/yeelight/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ def status(self) -> YeelightStatus:
318318
default_output=format_output("Powering on"),
319319
)
320320
def on(self, transition=0, mode=0):
321-
"""Power on."""
322-
"""
321+
"""Power on.
322+
323323
set_power ["on|off", "sudden|smooth", time_in_ms, mode]
324324
where mode:
325325
0: last mode

miio/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def rgb_to_int(x: Tuple[int, int, int]) -> int:
103103

104104

105105
def int_to_brightness(x: int) -> int:
106-
""""Return brightness (0-100) from integer."""
106+
"""Return brightness (0-100) from integer."""
107107
return x >> 24
108108

109109

miio/waterpurifier_yunmi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ def status(self) -> WaterPurifierYunmiStatus:
299299
time.
300300
Key "mode" (always 'purifying') and key "tds_out_avg" (always 0) are not
301301
included in return values.
302-
"""
302+
""" # noqa: B018
303303
values = self.send("get_prop", ["all"])
304304

305305
prop_count = len(properties)

miio/yeelight_dual_switch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def status(self) -> DualControlModuleStatus:
136136
"flex_mode",
137137
"rc_list",
138138
]
139-
"""Filter only readable properties for status"""
139+
# Filter only readable properties for status
140140
properties = [
141141
{"did": k, **v}
142142
for k, v in filter(lambda item: item[0] in p, _MAPPING.items())

0 commit comments

Comments
 (0)