Skip to content

Commit

Permalink
Upgrage install and pre-commit dependencies (#1192)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
rytilahti authored Nov 29, 2021
1 parent a577fe9 commit 9ba55a9
Show file tree
Hide file tree
Showing 11 changed files with 161 additions and 172 deletions.
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.4.0
rev: v4.0.1
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -12,19 +12,19 @@ repos:
- id: check-ast

- repo: https://github.com/psf/black
rev: 20.8b1
rev: 21.11b1
hooks:
- id: black
language_version: python3

- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.7.0
rev: v5.9.3
hooks:
- id: isort
additional_dependencies: [toml]

- repo: https://github.com/PyCQA/doc8
rev: 0.8.1
rev: 0.10.1
hooks:
- id: doc8

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

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

- repo: https://github.com/PyCQA/bandit
rev: 1.7.0
rev: 1.7.1
hooks:
- id: bandit
args: [-x, 'tests']


- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.812
rev: v0.910-1
hooks:
- id: mypy
# args: [--no-strict-optional, --ignore-missing-imports]
additional_dependencies: [types-attrs, types-PyYAML, types-requests, types-pytz, types-croniter]
2 changes: 1 addition & 1 deletion docs/device_docs/vacuum.rst
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ for original firmwares.

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

::

Expand Down
2 changes: 1 addition & 1 deletion miio/cooker.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ def status(self) -> CookerStatus:
Some cookers doesn't support a list of properties here. Therefore "all" properties
are requested. If the property count or order changes the property list above must
be updated.
"""
""" # noqa: B018
values = self.send("get_prop", ["all"])

properties_count = len(properties)
Expand Down
2 changes: 1 addition & 1 deletion miio/fan_miot.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ class FanStatus1C(DeviceStatus):
"""Container for status reports for Xiaomi Mi Smart Pedestal Fan DMaker 1C."""

def __init__(self, data: Dict[str, Any]) -> None:
self.data = data
"""Response of a Fan1C (dmaker.fan.1c):
{
Expand All @@ -204,6 +203,7 @@ def __init__(self, data: Dict[str, Any]) -> None:
'exe_time': 280
}
"""
self.data = data

@property
def power(self) -> str:
Expand Down
13 changes: 7 additions & 6 deletions miio/integrations/vacuum/mijia/g1vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ class G1MopState(Enum):
class G1Status(DeviceStatus):
"""Container for status reports from Mijia Vacuum G1."""

"""Response (MIoT format) of a Mijia Vacuum G1 (mijia.vacuum.v2)
def __init__(self, data):
"""Response (MIoT format) of a Mijia Vacuum G1 (mijia.vacuum.v2)
[
{'did': 'battery', 'siid': 3, 'piid': 1, 'code': 0, 'value': 100},
{'did': 'charge_state', 'siid': 3, 'piid': 2, 'code': 0, 'value': 2},
Expand All @@ -151,8 +153,6 @@ class G1Status(DeviceStatus):
{'did': 'clean_area', 'siid': 9, 'piid': 1, 'code': 0, 'value': 0},
{'did': 'clean_time', 'siid': 9, 'piid': 2, 'code': 0, 'value': 0}
]"""

def __init__(self, data):
self.data = data

@property
Expand Down Expand Up @@ -245,14 +245,15 @@ def clean_time(self) -> timedelta:


class G1CleaningSummary(DeviceStatus):
"""Container for cleaning summary from Mijia Vacuum G1."""
"""Container for cleaning summary from Mijia Vacuum G1.
"""Response (MIoT format) of a Mijia Vacuum G1 (mijia.vacuum.v2)
Response (MIoT format) of a Mijia Vacuum G1 (mijia.vacuum.v2)
[
{'did': 'total_clean_area', 'siid': 9, 'piid': 3, 'code': 0, 'value': 0},
{'did': 'total_clean_time', 'siid': 9, 'piid': 4, 'code': 0, 'value': 0},
{'did': 'total_clean_count', 'siid': 9, 'piid': 5, 'code': 0, 'value': 0}
]"""
]
"""

def __init__(self, data) -> None:
self.data = data
Expand Down
4 changes: 2 additions & 2 deletions miio/integrations/yeelight/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ def status(self) -> YeelightStatus:
default_output=format_output("Powering on"),
)
def on(self, transition=0, mode=0):
"""Power on."""
"""
"""Power on.
set_power ["on|off", "sudden|smooth", time_in_ms, mode]
where mode:
0: last mode
Expand Down
2 changes: 1 addition & 1 deletion miio/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def rgb_to_int(x: Tuple[int, int, int]) -> int:


def int_to_brightness(x: int) -> int:
""""Return brightness (0-100) from integer."""
"""Return brightness (0-100) from integer."""
return x >> 24


Expand Down
2 changes: 1 addition & 1 deletion miio/waterpurifier_yunmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def status(self) -> WaterPurifierYunmiStatus:
time.
Key "mode" (always 'purifying') and key "tds_out_avg" (always 0) are not
included in return values.
"""
""" # noqa: B018
values = self.send("get_prop", ["all"])

prop_count = len(properties)
Expand Down
2 changes: 1 addition & 1 deletion miio/yeelight_dual_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def status(self) -> DualControlModuleStatus:
"flex_mode",
"rc_list",
]
"""Filter only readable properties for status"""
# Filter only readable properties for status
properties = [
{"did": k, **v}
for k, v in filter(lambda item: item[0] in p, _MAPPING.items())
Expand Down
Loading

0 comments on commit 9ba55a9

Please sign in to comment.