python-kasa/kasa
Steven B 416d3118bf
Configure mypy to run in virtual environment and fix resulting issues (#989)
For some time I've noticed that my IDE is reporting mypy errors that the
pre-commit hook is not picking up. This is because [mypy
mirror](https://github.com/pre-commit/mirrors-mypy) runs in an isolated
pre-commit environment which does not have dependencies installed and it
enables `--ignore-missing-imports` to avoid errors.

This is [advised against by
mypy](https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-library-stubs-or-py-typed-marker)
for obvious reasons:

> We recommend avoiding --ignore-missing-imports if possible: it’s
equivalent to adding a # type: ignore to all unresolved imports in your
codebase.

This PR configures the mypy pre-commit hook to run in the virtual
environment and addresses the additional errors identified as a result.
It also introduces a minimal mypy config into the `pyproject.toml`

[mypy errors identified without the fixes in this
PR](https://github.com/user-attachments/files/15896693/mypyerrors.txt)
2024-06-19 15:07:59 +02:00
..
interfaces Update docs with more howto examples (#968) 2024-06-19 09:53:40 +01:00
iot Add common energy module and deprecate device emeter attributes (#976) 2024-06-17 11:22:05 +01:00
smart Update docs with more howto examples (#968) 2024-06-19 09:53:40 +01:00
tests Configure mypy to run in virtual environment and fix resulting issues (#989) 2024-06-19 15:07:59 +02:00
__init__.py Make device initialisation easier by reducing required imports (#936) 2024-06-03 19:06:54 +01:00
aestransport.py Configure mypy to run in virtual environment and fix resulting issues (#989) 2024-06-19 15:07:59 +02:00
cli.py Configure mypy to run in virtual environment and fix resulting issues (#989) 2024-06-19 15:07:59 +02:00
credentials.py Cleanup credentials handling (#605) 2024-01-03 19:26:52 +01:00
device_factory.py Move SmartBulb into SmartDevice (#874) 2024-04-29 18:19:44 +01:00
device_type.py Add temperature control module for smart (#848) 2024-04-22 12:39:07 +01:00
device.py Update docs with more howto examples (#968) 2024-06-19 09:53:40 +01:00
deviceconfig.py Make device initialisation easier by reducing required imports (#936) 2024-06-03 19:06:54 +01:00
discover.py Make device initialisation easier by reducing required imports (#936) 2024-06-03 19:06:54 +01:00
emeterstatus.py Enable and convert to future annotations (#838) 2024-04-17 15:39:24 +02:00
exceptions.py Enable and convert to future annotations (#838) 2024-04-17 15:39:24 +02:00
feature.py Update docs with more howto examples (#968) 2024-06-19 09:53:40 +01:00
httpclient.py Configure mypy to run in virtual environment and fix resulting issues (#989) 2024-06-19 15:07:59 +02:00
iotprotocol.py Enable and convert to future annotations (#838) 2024-04-17 15:39:24 +02:00
json.py Generate AES KeyPair lazily (#687) 2024-01-23 15:29:27 +00:00
klaptransport.py Enable and convert to future annotations (#838) 2024-04-17 15:39:24 +02:00
module.py Update docs with more howto examples (#968) 2024-06-19 09:53:40 +01:00
modulemapping.py Create common interfaces for remaining device types (#895) 2024-05-10 19:29:28 +01:00
modulemapping.pyi Create common interfaces for remaining device types (#895) 2024-05-10 19:29:28 +01:00
protocol.py Enable and convert to future annotations (#838) 2024-04-17 15:39:24 +02:00
py.typed Add py.typed to flag that the package is typed (#251) 2021-11-15 18:21:24 +01:00
smartprotocol.py Do not raise on multi-request errors on child devices (#949) 2024-06-03 20:41:55 +02:00
xortransport.py Configure mypy to run in virtual environment and fix resulting issues (#989) 2024-06-19 15:07:59 +02:00