python-kasa/kasa/iot
Teemu R. 5da41fcc11
Use stacklevel=2 for warnings to report on callsites (#1219)
Use stacklevel=2 for warnings, as this will correctly show the callsite
instead of the line where the warning is reported.

Currently:
```
kasa/__init__.py:110
  /home/tpr/code/python-kasa/kasa/__init__.py:110: DeprecationWarning: SmartDevice is deprecated, use IotDevice from package kasa.iot instead or use Discover.discover_single() and Device.connect() to support new protocols
    warn(
```

After:
```
kasa/tests/smart/modules/test_contact.py:3
  /home/tpr/code/python-kasa/kasa/tests/smart/modules/test_contact.py:3: DeprecationWarning: SmartDevice is deprecated, use IotDevice from package kasa.iot instead or use Discover.discover_single() and Device.connect() to support new protocols
    from kasa import Module, SmartDevice

``` 

Currently:
```
kasa/tests/test_lightstrip.py: 56 warnings
  /home/tpr/code/python-kasa/kasa/device.py:559: DeprecationWarning: effect is deprecated, use: Module.LightEffect in device.modules instead
    warn(msg, DeprecationWarning, stacklevel=1)
```

After:
```
kasa/tests/test_lightstrip.py::test_effects_lightstrip_set_effect_transition[500-KL430(US)_2.0_1.0.9.json]
  /home/tpr/code/python-kasa/kasa/tests/test_lightstrip.py:62: DeprecationWarning: set_effect is deprecated, use: Module.LightEffect in device.modules instead
    await dev.set_effect("Candy Cane")
```
2024-10-31 14:12:17 +01:00
..
modules Expose ambient light setting for iot dimmers (#1210) 2024-10-31 12:17:18 +01:00
__init__.py Update poetry locks and pre-commit hooks (#837) 2024-04-16 20:21:20 +02:00
effects.py Create common interfaces for remaining device types (#895) 2024-05-10 19:29:28 +01:00
iotbulb.py Make HSV NamedTuple creation more efficient (#1211) 2024-10-29 17:14:52 +00:00
iotdevice.py Use stacklevel=2 for warnings to report on callsites (#1219) 2024-10-31 14:12:17 +01:00
iotdimmer.py Add flake8-pytest-style (PT) for ruff (#1105) 2024-08-30 17:30:07 +02:00
iotlightstrip.py Add some device fixtures (#948) 2024-06-04 19:24:53 +02:00
iotmodule.py Improve performance of dict merge code (#1097) 2024-08-14 16:33:54 -05:00
iotplug.py Create common Time module and add time set cli command (#1157) 2024-10-15 08:59:25 +01:00
iotstrip.py Create common Time module and add time set cli command (#1157) 2024-10-15 08:59:25 +01:00
iottimezone.py Create common Time module and add time set cli command (#1157) 2024-10-15 08:59:25 +01:00