From 8568e7d336e2d6a23df148b7666cd515bd8ad1d6 Mon Sep 17 00:00:00 2001 From: Dinculescu Date: Fri, 29 Mar 2024 20:00:44 +0000 Subject: [PATCH] tapo-py: Add black formatter config --- tapo-py/pyproject.toml | 3 +++ tapo-py/tapo-py/tapo/color_light_handler.pyi | 26 ++++++++++++++----- .../tapo-py/tapo/generic_device_handler.pyi | 5 ++++ tapo-py/tapo-py/tapo/light_handler.pyi | 8 ++++++ .../tapo/plug_energy_monitoring_handler.pyi | 10 +++++++ tapo-py/tapo-py/tapo/plug_handler.pyi | 7 +++++ 6 files changed, 53 insertions(+), 6 deletions(-) diff --git a/tapo-py/pyproject.toml b/tapo-py/pyproject.toml index d15122a..49f4f15 100644 --- a/tapo-py/pyproject.toml +++ b/tapo-py/pyproject.toml @@ -54,3 +54,6 @@ python-source = "tapo-py" bindings = 'pyo3' features = ["pyo3/extension-module"] include = ["README.md", "CHANGELOG.md", "LICENSE", "tapo-py/tapo-py/tapo/*"] + +[tool.black] +line-length = 100 diff --git a/tapo-py/tapo-py/tapo/color_light_handler.pyi b/tapo-py/tapo-py/tapo/color_light_handler.pyi index 2f69fdc..807924f 100644 --- a/tapo-py/tapo-py/tapo/color_light_handler.pyi +++ b/tapo-py/tapo-py/tapo/color_light_handler.pyi @@ -9,12 +9,16 @@ class ColorLightHandler: """Private constructor. It should not be called from outside the tapo library. """ + async def refresh_session(self) -> None: """Refreshes the authentication session.""" + async def on(self) -> None: """Turns *on* the device.""" + async def off(self) -> None: """Turns *off* the device.""" + async def device_reset(self) -> None: """*Hardware resets* the device. @@ -26,6 +30,7 @@ class ColorLightHandler: This feature is especially useful when the device is difficult to access and requires reconfiguration. """ + async def get_device_info(self) -> DeviceInfoColorLightResult: """Returns *device info* as `DeviceInfoColorLightResult`. It is not guaranteed to contain all the properties returned from the Tapo API. @@ -36,6 +41,7 @@ class ColorLightHandler: DeviceInfoColorLightResult: Device info of Tapo L530, L630 and L900. Superset of `GenericDeviceInfoResult`. """ + async def get_device_info_json(self) -> dict: """Returns *device info* as json. It contains all the properties returned from the Tapo API. @@ -43,12 +49,14 @@ class ColorLightHandler: Returns: dict: Device info as a dictionary. """ + async def get_device_usage(self) -> DeviceUsageResult: """Returns *device usage* as `DeviceUsageResult`. Returns: DeviceUsageResult: Contains the time usage. """ + def set(self) -> ColorLightSetDeviceInfoParams: """Returns a `ColorLightSetDeviceInfoParams` builder that allows multiple properties to be set in a single request. @@ -58,18 +66,21 @@ class ColorLightHandler: ColorLightSetDeviceInfoParams: Builder that is used by the `ColorLightHandler.set` API to set multiple properties in a single request. """ + async def set_brightness(self, brightness: int) -> None: """Sets the *brightness* and turns *on* the device. Args: brightness (int): between 1 and 100 """ + async def set_color(self, color: Color) -> None: """Sets the *color* and turns *on* the device. Args: color (Color): one of `tapo.Color` as defined in the Google Home app. """ + async def set_hue_saturation(self, hue: int, saturation: int) -> None: """Sets the *hue*, *saturation* and turns *on* the device. @@ -77,6 +88,7 @@ class ColorLightHandler: hue (int): between 1 and 360 saturation (int): between 1 and 100 """ + async def set_color_temperature(self, color_temperature: int) -> None: """Sets the *color temperature* and turns *on* the device. @@ -154,10 +166,12 @@ class ColorLightSetDeviceInfoParams: """Turns *on* the device. `ColorLightSetDeviceInfoParams.send` must be called at the end to apply the changes. """ + def off(self) -> ColorLightSetDeviceInfoParams: """Turns *off* the device. `ColorLightSetDeviceInfoParams.send` must be called at the end to apply the changes. """ + def brightness(self, brightness: int) -> ColorLightSetDeviceInfoParams: """Sets the *brightness*. `ColorLightSetDeviceInfoParams.send` must be called at the end to apply the changes. @@ -166,6 +180,7 @@ class ColorLightSetDeviceInfoParams: Args: brightness (int): between 1 and 100 """ + def color(self, color: Color) -> ColorLightSetDeviceInfoParams: """Sets the *color*. `ColorLightSetDeviceInfoParams.send` must be called at the end to apply the changes. @@ -174,9 +189,8 @@ class ColorLightSetDeviceInfoParams: Args: color (Color): one of `tapo.Color` as defined in the Google Home app. """ - def hue_saturation( - self, hue: int, saturation: int - ) -> ColorLightSetDeviceInfoParams: + + def hue_saturation(self, hue: int, saturation: int) -> ColorLightSetDeviceInfoParams: """Sets the *hue* and *saturation*. `ColorLightSetDeviceInfoParams.send` must be called at the end to apply the changes. The device will also be turned *on*, unless `ColorLightSetDeviceInfoParams.off` is called. @@ -185,9 +199,8 @@ class ColorLightSetDeviceInfoParams: hue (int): between 1 and 360 saturation (int): between 1 and 100 """ - def color_temperature( - self, color_temperature: int - ) -> ColorLightSetDeviceInfoParams: + + def color_temperature(self, color_temperature: int) -> ColorLightSetDeviceInfoParams: """ Sets the *color temperature*. `ColorLightSetDeviceInfoParams.send` must be called at the end to apply the changes. @@ -196,5 +209,6 @@ class ColorLightSetDeviceInfoParams: Args: color_temperature (int): between 2500 and 6500 """ + async def send(self) -> None: """Performs a request to apply the changes to the device.""" diff --git a/tapo-py/tapo-py/tapo/generic_device_handler.pyi b/tapo-py/tapo-py/tapo/generic_device_handler.pyi index fc6b646..b8f24b6 100644 --- a/tapo-py/tapo-py/tapo/generic_device_handler.pyi +++ b/tapo-py/tapo-py/tapo/generic_device_handler.pyi @@ -9,12 +9,16 @@ class GenericDeviceHandler: """Private constructor. It should not be called from outside the tapo library. """ + async def refresh_session(self) -> None: """Refreshes the authentication session.""" + async def on(self) -> None: """Turns *on* the device.""" + async def off(self) -> None: """Turns *off* the device.""" + async def get_device_info(self) -> DeviceInfoGenericResult: """Returns *device info* as `DeviceInfoGenericResult`. It is not guaranteed to contain all the properties returned from the Tapo API. @@ -24,6 +28,7 @@ class GenericDeviceHandler: Returns: DeviceInfoGenericResult: Device info of a Generic Tapo device. """ + async def get_device_info_json(self) -> dict: """Returns *device info* as json. It contains all the properties returned from the Tapo API. diff --git a/tapo-py/tapo-py/tapo/light_handler.pyi b/tapo-py/tapo-py/tapo/light_handler.pyi index 4624abc..2ed692a 100644 --- a/tapo-py/tapo-py/tapo/light_handler.pyi +++ b/tapo-py/tapo-py/tapo/light_handler.pyi @@ -14,12 +14,16 @@ class LightHandler: """Private constructor. It should not be called from outside the tapo library. """ + async def refresh_session(self) -> None: """Refreshes the authentication session.""" + async def on(self) -> None: """Turns *on* the device.""" + async def off(self) -> None: """Turns *off* the device.""" + async def device_reset(self) -> None: """*Hardware resets* the device. @@ -31,6 +35,7 @@ class LightHandler: This feature is especially useful when the device is difficult to access and requires reconfiguration. """ + async def get_device_info(self) -> DeviceInfoLightResult: """Returns *device info* as `DeviceInfoLightResult`. It is not guaranteed to contain all the properties returned from the Tapo API. @@ -41,6 +46,7 @@ class LightHandler: DeviceInfoLightResult: Device info of Tapo L510, L520 and L610. Superset of `GenericDeviceInfoResult`. """ + async def get_device_info_json(self) -> dict: """Returns *device info* as json. It contains all the properties returned from the Tapo API. @@ -48,12 +54,14 @@ class LightHandler: Returns: dict: Device info as a dictionary. """ + async def get_device_usage(self) -> DeviceUsageResult: """Returns *device usage* as `DeviceUsageResult`. Returns: DeviceUsageResult: Contains the time usage. """ + async def set_brightness(self, brightness: int) -> None: """Sets the *brightness* and turns *on* the device. diff --git a/tapo-py/tapo-py/tapo/plug_energy_monitoring_handler.pyi b/tapo-py/tapo-py/tapo/plug_energy_monitoring_handler.pyi index 196b048..03ca2ac 100644 --- a/tapo-py/tapo-py/tapo/plug_energy_monitoring_handler.pyi +++ b/tapo-py/tapo-py/tapo/plug_energy_monitoring_handler.pyi @@ -12,12 +12,16 @@ class PlugEnergyMonitoringHandler: """Private constructor. It should not be called from outside the tapo library. """ + async def refresh_session(self) -> None: """Refreshes the authentication session.""" + async def on(self) -> None: """Turns *on* the device.""" + async def off(self) -> None: """Turns *off* the device.""" + async def device_reset(self) -> None: """*Hardware resets* the device. @@ -29,6 +33,7 @@ class PlugEnergyMonitoringHandler: This feature is especially useful when the device is difficult to access and requires reconfiguration. """ + async def get_device_info(self) -> DeviceInfoPlugResult: """Returns *device info* as `DeviceInfoPlugResult`. It is not guaranteed to contain all the properties returned from the Tapo API. @@ -39,6 +44,7 @@ class PlugEnergyMonitoringHandler: DeviceInfoPlugResult: Device info of Tapo P100, P105, P110 and P115. Superset of `GenericDeviceInfoResult`. """ + async def get_device_info_json(self) -> dict: """Returns *device info* as json. It contains all the properties returned from the Tapo API. @@ -46,6 +52,7 @@ class PlugEnergyMonitoringHandler: Returns: dict: Device info as a dictionary. """ + async def get_device_usage(self) -> DeviceUsageEnergyMonitoringResult: """Returns *device usage* as `DeviceUsageResult`. @@ -53,12 +60,14 @@ class PlugEnergyMonitoringHandler: DeviceUsageEnergyMonitoringResult: Contains the time usage, the power consumption, and the energy savings of the device. """ + async def get_current_power(self) -> CurrentPowerResult: """Returns *current power* as `CurrentPowerResult`. Returns: CurrentPowerResult: Contains the current power reading of the device. """ + async def get_energy_usage(self) -> EnergyUsageResult: """Returns *energy usage* as `EnergyUsageResult`. @@ -66,6 +75,7 @@ class PlugEnergyMonitoringHandler: EnergyUsageResult: Contains local time, current power and the energy usage and runtime for today and for the current month. """ + async def get_energy_data( self, interval: EnergyDataInterval, diff --git a/tapo-py/tapo-py/tapo/plug_handler.pyi b/tapo-py/tapo-py/tapo/plug_handler.pyi index d3d6d53..87440a4 100644 --- a/tapo-py/tapo-py/tapo/plug_handler.pyi +++ b/tapo-py/tapo-py/tapo/plug_handler.pyi @@ -8,12 +8,16 @@ class PlugHandler: """Private constructor. It should not be called from outside the tapo library. """ + async def refresh_session(self) -> None: """Refreshes the authentication session.""" + async def on(self) -> None: """Turns *on* the device.""" + async def off(self) -> None: """Turns *off* the device.""" + async def device_reset(self) -> None: """*Hardware resets* the device. @@ -25,6 +29,7 @@ class PlugHandler: This feature is especially useful when the device is difficult to access and requires reconfiguration. """ + async def get_device_info(self) -> DeviceInfoPlugResult: """Returns *device info* as `DeviceInfoPlugResult`. It is not guaranteed to contain all the properties returned from the Tapo API. @@ -35,6 +40,7 @@ class PlugHandler: DeviceInfoPlugResult: Device info of Tapo P100, P105, P110 and P115. Superset of `GenericDeviceInfoResult`. """ + async def get_device_info_json(self) -> dict: """Returns *device info* as json. It contains all the properties returned from the Tapo API. @@ -42,6 +48,7 @@ class PlugHandler: Returns: dict: Device info as a dictionary. """ + async def get_device_usage(self) -> DeviceUsageResult: """Returns *device usage* as `DeviceUsageResult`.