From 0677a384c0da144ae2d3d8e666b44013b9bdf3e4 Mon Sep 17 00:00:00 2001 From: Teemu Rytilahti Date: Wed, 6 Apr 2022 01:33:11 +0200 Subject: [PATCH] Export modules & make sphinx happy --- docs/source/design.rst | 1 + kasa/modules/__init__.py | 17 ++++++++++++++++- kasa/smartbulb.py | 6 +++--- kasa/smartdimmer.py | 4 ++-- kasa/smartplug.py | 4 ++-- kasa/smartstrip.py | 4 ++-- 6 files changed, 26 insertions(+), 10 deletions(-) diff --git a/docs/source/design.rst b/docs/source/design.rst index b3d6b3591..140c83d8f 100644 --- a/docs/source/design.rst +++ b/docs/source/design.rst @@ -45,6 +45,7 @@ API documentation for modules ***************************** .. automodule:: kasa.modules + :noindex: :members: :inherited-members: :undoc-members: diff --git a/kasa/modules/__init__.py b/kasa/modules/__init__.py index e5cb83d66..8ad5088d5 100644 --- a/kasa/modules/__init__.py +++ b/kasa/modules/__init__.py @@ -1,4 +1,4 @@ -# flake8: noqa +"""Module for individual feature modules.""" from .ambientlight import AmbientLight from .antitheft import Antitheft from .cloud import Cloud @@ -10,3 +10,18 @@ from .schedule import Schedule from .time import Time from .usage import Usage + +__all__ = [ + "AmbientLight", + "Antitheft", + "Cloud", + "Countdown", + "Emeter", + "Module", + "Motion", + "Rule", + "RuleModule", + "Schedule", + "Time", + "Usage", +] diff --git a/kasa/smartbulb.py b/kasa/smartbulb.py index f941dcf1f..f060d2563 100644 --- a/kasa/smartbulb.py +++ b/kasa/smartbulb.py @@ -42,7 +42,7 @@ class HSV(NamedTuple): class SmartBulb(SmartDevice): - """Representation of a TP-Link Smart Bulb. + r"""Representation of a TP-Link Smart Bulb. To initialize, you have to await :func:`update()` at least once. This will allow accessing the properties using the exposed properties. @@ -50,7 +50,7 @@ class SmartBulb(SmartDevice): All changes to the device are done using awaitable methods, which will not change the cached values, but you must await :func:`update()` separately. - Errors reported by the device are raised as :class:`SmartDeviceException`s, + Errors reported by the device are raised as :class:`SmartDeviceException`\s, and should be handled by the user of the library. Examples: @@ -68,7 +68,7 @@ class SmartBulb(SmartDevice): >>> print(bulb.is_on) True - You can use the is_-prefixed properties to check for supported features + You can use the ``is_``-prefixed properties to check for supported features >>> bulb.is_dimmable True >>> bulb.is_color diff --git a/kasa/smartdimmer.py b/kasa/smartdimmer.py index 5c06b8b94..cb830d233 100644 --- a/kasa/smartdimmer.py +++ b/kasa/smartdimmer.py @@ -7,7 +7,7 @@ class SmartDimmer(SmartPlug): - """Representation of a TP-Link Smart Dimmer. + r"""Representation of a TP-Link Smart Dimmer. Dimmers work similarly to plugs, but provide also support for adjusting the brightness. This class extends :class:`SmartPlug` interface. @@ -18,7 +18,7 @@ class SmartDimmer(SmartPlug): All changes to the device are done using awaitable methods, which will not change the cached values, but you must await :func:`update()` separately. - Errors reported by the device are raised as :class:`SmartDeviceException`s, + Errors reported by the device are raised as :class:`SmartDeviceException`\s, and should be handled by the user of the library. Examples: diff --git a/kasa/smartplug.py b/kasa/smartplug.py index b636c3e11..d49e40542 100644 --- a/kasa/smartplug.py +++ b/kasa/smartplug.py @@ -9,7 +9,7 @@ class SmartPlug(SmartDevice): - """Representation of a TP-Link Smart Switch. + r"""Representation of a TP-Link Smart Switch. To initialize, you have to await :func:`update()` at least once. This will allow accessing the properties using the exposed properties. @@ -17,7 +17,7 @@ class SmartPlug(SmartDevice): All changes to the device are done using awaitable methods, which will not change the cached values, but you must await :func:`update()` separately. - Errors reported by the device are raised as :class:`SmartDeviceException`s, + Errors reported by the device are raised as :class:`SmartDeviceException`\s, and should be handled by the user of the library. Examples: diff --git a/kasa/smartstrip.py b/kasa/smartstrip.py index ba863d059..47ada6723 100755 --- a/kasa/smartstrip.py +++ b/kasa/smartstrip.py @@ -29,7 +29,7 @@ def merge_sums(dicts): class SmartStrip(SmartDevice): - """Representation of a TP-Link Smart Power Strip. + r"""Representation of a TP-Link Smart Power Strip. A strip consists of the parent device and its children. All methods of the parent act on all children, while the child devices @@ -41,7 +41,7 @@ class SmartStrip(SmartDevice): All changes to the device are done using awaitable methods, which will not change the cached values, but you must await :func:`update()` separately. - Errors reported by the device are raised as :class:`SmartDeviceException`s, + Errors reported by the device are raised as :class:`SmartDeviceException`\s, and should be handled by the user of the library. Examples: