Skip to content

Commit

Permalink
Update dependencies and pre-commit hooks (#1848)
Browse files Browse the repository at this point in the history
* Disables doc8 due to myst_parser issues
* Disables docformatter due too large diffs that make json payload
examples unreadable
  • Loading branch information
rytilahti committed Oct 21, 2023
1 parent 59f6b15 commit fb8128f
Show file tree
Hide file tree
Showing 6 changed files with 561 additions and 556 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Expand Up @@ -38,9 +38,9 @@ jobs:
- name: "Order of imports (isort)"
run: |
poetry run pre-commit run isort --all-files
- name: "Docstring formating (docformatter)"
run: |
poetry run pre-commit run docformatter --all-files
# - name: "Docstring formating (docformatter)"
# run: |
# poetry run pre-commit run docformatter --all-files
- name: "Potential security issues (bandit)"
run: |
poetry run pre-commit run bandit --all-files
Expand Down
32 changes: 16 additions & 16 deletions .pre-commit-config.yaml
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -12,7 +12,7 @@ repos:
- id: check-ast

- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.10.0
hooks:
- id: black
language_version: python3
Expand All @@ -23,39 +23,39 @@ repos:
- id: isort
additional_dependencies: [toml]

- repo: https://github.com/PyCQA/doc8
rev: v1.1.1
hooks:
- id: doc8
additional_dependencies: [myst-parser]
#- repo: https://github.com/PyCQA/doc8
# rev: v1.1.1
# hooks:
# - id: doc8
# additional_dependencies: [myst-parser]

- repo: https://github.com/myint/docformatter
rev: v1.5.1
hooks:
- id: docformatter
args: [--in-place, --wrap-summaries, '88', --wrap-descriptions, '88']
# - repo: https://github.com/myint/docformatter
# rev: v1.7.5
# hooks:
# - id: docformatter
# args: [--in-place, --wrap-summaries, '88', --wrap-descriptions, '88', --black

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 6.1.0
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.4
rev: 1.7.5
hooks:
- id: bandit
args: [-x, 'tests', -x, '**/test_*.py']


- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.0.1
rev: v1.6.1
hooks:
- id: mypy
additional_dependencies: [types-attrs, types-PyYAML, types-requests, types-pytz, types-croniter, types-freezegun]

- repo: https://github.com/asottile/pyupgrade
rev: v3.3.1
rev: v3.15.0
hooks:
- id: pyupgrade
args: ['--py38-plus']
4 changes: 2 additions & 2 deletions devtools/miottemplate.py
Expand Up @@ -98,7 +98,7 @@ def download_mapping():
"Downloading and saving model<->urn mapping to %s" % MIOTSPEC_MAPPING.name
)
url = "http://miot-spec.org/miot-spec-v2/instances?status=all"
res = requests.get(url)
res = requests.get(url, timeout=5)

with MIOTSPEC_MAPPING.open("w") as f:
f.write(res.text)
Expand Down Expand Up @@ -142,7 +142,7 @@ def download(ctx, urn, model):

url = f"https://miot-spec.org/miot-spec-v2/instance?type={model.type}"
click.echo("Going to download %s" % url)
content = requests.get(url)
content = requests.get(url, timeout=5)
save_to = model.filename
click.echo(f"Saving data to {save_to}")
with open(save_to, "w") as f:
Expand Down
4 changes: 2 additions & 2 deletions miio/extract_tokens.py
Expand Up @@ -80,8 +80,8 @@ def decrypt_ztoken(ztoken):

keystring = "00000000000000000000000000000000"
key = bytes.fromhex(keystring)
cipher = Cipher( # nosec
algorithms.AES(key), modes.ECB(), backend=default_backend()
cipher = Cipher(
algorithms.AES(key), modes.ECB(), backend=default_backend() # nosec
)
decryptor = cipher.decryptor()
token = decryptor.update(bytes.fromhex(ztoken[:64])) + decryptor.finalize()
Expand Down
2 changes: 1 addition & 1 deletion miio/integrations/lumi/gateway/gateway.py
Expand Up @@ -185,7 +185,7 @@ def discover_devices(self):
# self.send("get_device_list") does work for the GATEWAY_MODEL_ZIG3 but gives slightly diffrent return values
devices_raw = self.send("get_device_list")

if type(devices_raw) != list:
if not isinstance(devices_raw, list):
_LOGGER.debug(
"Gateway response to 'get_device_list' not a list type, no zigbee devices connected."
)
Expand Down

0 comments on commit fb8128f

Please sign in to comment.