diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 48d77cfdc6f..3773a3213aa 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,9 +13,17 @@ repos: additional_dependencies: - flake8-docstrings==1.3.1 - pydocstyle==4.0.0 -- repo: https://github.com/pre-commit/mirrors-mypy.git - rev: v0.730 +# Using a local "system" mypy instead of the mypy hook, because its +# results depend on what is installed. And the mypy hook runs in a +# virtualenv of its own, meaning we'd need to install and maintain +# another set of our dependencies there... no. Use the "system" one +# and reuse the environment that is set up anyway already instead. +- repo: local hooks: - id: mypy - args: [] + name: mypy + entry: mypy + language: system + types: [python] + require_serial: true exclude: ^script/scaffold/templates/ diff --git a/azure-pipelines-ci.yml b/azure-pipelines-ci.yml index a566baf6561..257eac57c2d 100644 --- a/azure-pipelines-ci.yml +++ b/azure-pipelines-ci.yml @@ -174,12 +174,12 @@ stages: steps: - template: templates/azp-step-cache.yaml@azure parameters: - keyfile: 'requirements_test.txt | homeassistant/package_constraints.txt' + keyfile: 'requirements_test.txt | setup.py | homeassistant/package_constraints.txt' build: | python -m venv venv . venv/bin/activate - pip install -r requirements_test.txt -c homeassistant/package_constraints.txt + pip install -e . -r requirements_test.txt -c homeassistant/package_constraints.txt - script: | . venv/bin/activate mypy homeassistant diff --git a/homeassistant/util/ruamel_yaml.py b/homeassistant/util/ruamel_yaml.py index 6793784abae..b7e8927888c 100644 --- a/homeassistant/util/ruamel_yaml.py +++ b/homeassistant/util/ruamel_yaml.py @@ -90,7 +90,7 @@ def load_yaml(fname: str, round_trip: bool = False) -> JSON_TYPE: if round_trip: yaml = YAML(typ="rt") # type ignore: https://bitbucket.org/ruamel/yaml/pull-requests/42 - yaml.preserve_quotes = True + yaml.preserve_quotes = True # type: ignore else: if ExtSafeConstructor.name is None: ExtSafeConstructor.name = fname