python-kasa/kasa/tests/smart/features
Steven B c5d65b624b
Make get_module return typed module (#892)
Passing in a string still works and returns either `IotModule` or
`SmartModule` type when called on `IotDevice` or `SmartDevice`
respectively. When calling on `Device` will return `Module` type.

Passing in a module type is then typed to that module, i.e.:
```py
smartdev.get_module(FanModule)  # type is FanModule
smartdev.get_module("FanModule")  # type is SmartModule
```
Only thing this doesn't do is check that you can't pass an `IotModule`
to a `SmartDevice.get_module()`. However there is a runtime check which
will return null if the passed `ModuleType` is not a subclass of
`SmartModule`.

Many thanks to @cdce8p for helping with this.
2024-05-03 17:01:21 +02:00
..
__init__.py Add colortemp module (#814) 2024-03-15 17:36:07 +01:00
test_brightness.py Make get_module return typed module (#892) 2024-05-03 17:01:21 +02:00
test_colortemp.py Fix incorrect state updates in FakeTestProtocols (#861) 2024-04-24 12:25:16 +01:00