diff --git a/examples/brick_master.py b/examples/brick_master.py index 283ef8e..5840a68 100755 --- a/examples/brick_master.py +++ b/examples/brick_master.py @@ -90,10 +90,10 @@ async def run_master_extension_wifi(brick: BrickMaster) -> None: # The mac and bssid are stored as tuples of int. We will replace them with the more common hex notation for # better readability, then we will recreate the named tuple. new_status["mac_address"] = [] - new_status[ - "mac_address" - ] = "{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}".format( # pylint: disable=consider-using-f-string - *new_status["mac_address"] + new_status["mac_address"] = ( + "{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}".format( # pylint: disable=consider-using-f-string + *new_status["mac_address"] + ) ) new_status["bssid"] = "{:02x}:{:02x}:{:02x}:{:02x}:{:02x}:{:02x}".format( # pylint: disable=consider-using-f-string *new_status["bssid"] diff --git a/tinkerforge_async/__init__.py b/tinkerforge_async/__init__.py index 7c188dc..53f6a7c 100644 --- a/tinkerforge_async/__init__.py +++ b/tinkerforge_async/__init__.py @@ -3,6 +3,7 @@ ([original Python bindings](https://www.tinkerforge.com/en/doc/Software/API_Bindings_Python.html)) using Python 3 asyncio. """ + from ._version import __version__ from .device_factory import device_factory from .ip_connection import IPConnectionAsync diff --git a/tinkerforge_async/_version.py b/tinkerforge_async/_version.py index f95db68..2da337b 100644 --- a/tinkerforge_async/_version.py +++ b/tinkerforge_async/_version.py @@ -1,2 +1,2 @@ # pylint: disable=missing-module-docstring -__version__ = "1.5.2" +__version__ = "1.5.3" diff --git a/tinkerforge_async/async_event_bus.py b/tinkerforge_async/async_event_bus.py index 62b4a61..63e71da 100644 --- a/tinkerforge_async/async_event_bus.py +++ b/tinkerforge_async/async_event_bus.py @@ -2,6 +2,7 @@ A lightweight event bus for the asyncio framework, that relies on asynchronous generators to deliver messages. """ + import asyncio from typing import Any, AsyncGenerator diff --git a/tinkerforge_async/brick_master.py b/tinkerforge_async/brick_master.py index 4bf5357..7bb3660 100644 --- a/tinkerforge_async/brick_master.py +++ b/tinkerforge_async/brick_master.py @@ -3,6 +3,7 @@ implemented using Python AsyncIO. It does the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units. """ + # pylint: disable=too-many-lines from __future__ import annotations diff --git a/tinkerforge_async/bricklet_ambient_light_v2.py b/tinkerforge_async/bricklet_ambient_light_v2.py index d36d3df..0e92748 100644 --- a/tinkerforge_async/bricklet_ambient_light_v2.py +++ b/tinkerforge_async/bricklet_ambient_light_v2.py @@ -3,6 +3,7 @@ (https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Ambient_Light_V2.html) implemented using Python asyncio. It does the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units. """ + # pylint: disable=duplicate-code # Many sensors of different generations have a similar API from __future__ import annotations diff --git a/tinkerforge_async/bricklet_ambient_light_v3.py b/tinkerforge_async/bricklet_ambient_light_v3.py index 669f676..7cd4ec7 100644 --- a/tinkerforge_async/bricklet_ambient_light_v3.py +++ b/tinkerforge_async/bricklet_ambient_light_v3.py @@ -3,6 +3,7 @@ (https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Ambient_Light_V3.html) implemented using Python asyncio. It does the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units. """ + # pylint: disable=duplicate-code # Many sensors of different generations have a similar API from __future__ import annotations diff --git a/tinkerforge_async/bricklet_analog_in.py b/tinkerforge_async/bricklet_analog_in.py index 9989f9f..b0b25bd 100644 --- a/tinkerforge_async/bricklet_analog_in.py +++ b/tinkerforge_async/bricklet_analog_in.py @@ -3,6 +3,7 @@ implemented using Python asyncio. It does the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units. """ + # pylint: disable=duplicate-code # Many sensors of different generations have a similar API from __future__ import annotations diff --git a/tinkerforge_async/bricklet_barometer.py b/tinkerforge_async/bricklet_barometer.py index 6f35ce2..fdec29d 100644 --- a/tinkerforge_async/bricklet_barometer.py +++ b/tinkerforge_async/bricklet_barometer.py @@ -3,6 +3,7 @@ implemented using Python AsyncIO. It does the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units. """ + # pylint: disable=duplicate-code # Many sensors of different generations have a similar API from __future__ import annotations diff --git a/tinkerforge_async/bricklet_barometer_v2.py b/tinkerforge_async/bricklet_barometer_v2.py index 24f5612..3333beb 100644 --- a/tinkerforge_async/bricklet_barometer_v2.py +++ b/tinkerforge_async/bricklet_barometer_v2.py @@ -3,6 +3,7 @@ (https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Barometer_V2.html) implemented using Python asyncio. It does the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units. """ + # pylint: disable=duplicate-code # Many sensors of different generations have a similar API from __future__ import annotations diff --git a/tinkerforge_async/bricklet_humidity.py b/tinkerforge_async/bricklet_humidity.py index 65c84d9..2afbc54 100644 --- a/tinkerforge_async/bricklet_humidity.py +++ b/tinkerforge_async/bricklet_humidity.py @@ -3,6 +3,7 @@ implemented using Python AsyncIO. It does the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units. """ + # pylint: disable=duplicate-code # Many sensors of different generations have a similar API from __future__ import annotations diff --git a/tinkerforge_async/bricklet_humidity_v2.py b/tinkerforge_async/bricklet_humidity_v2.py index e3c6292..462743c 100644 --- a/tinkerforge_async/bricklet_humidity_v2.py +++ b/tinkerforge_async/bricklet_humidity_v2.py @@ -3,6 +3,7 @@ (https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Humidity_V2.html) implemented using Python asyncIO. It does the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units. """ + # pylint: disable=duplicate-code # Many sensors of different generations have a similar API from __future__ import annotations diff --git a/tinkerforge_async/bricklet_industrial_dual_analog_in_v2.py b/tinkerforge_async/bricklet_industrial_dual_analog_in_v2.py index b715dde..4cdd94e 100644 --- a/tinkerforge_async/bricklet_industrial_dual_analog_in_v2.py +++ b/tinkerforge_async/bricklet_industrial_dual_analog_in_v2.py @@ -4,6 +4,7 @@ asyncio. It does the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units. """ + # pylint: disable=duplicate-code # Many sensors of different generations have a similar API from __future__ import annotations diff --git a/tinkerforge_async/bricklet_industrial_ptc.py b/tinkerforge_async/bricklet_industrial_ptc.py index eeac3d7..c97b203 100644 --- a/tinkerforge_async/bricklet_industrial_ptc.py +++ b/tinkerforge_async/bricklet_industrial_ptc.py @@ -4,6 +4,7 @@ implemented using Python asyncIO. It does the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units. """ + from .bricklet_ptc_v2 import BrickletPtcV2 from .devices import DeviceIdentifier diff --git a/tinkerforge_async/bricklet_io16.py b/tinkerforge_async/bricklet_io16.py index 98ed264..81db48c 100644 --- a/tinkerforge_async/bricklet_io16.py +++ b/tinkerforge_async/bricklet_io16.py @@ -3,6 +3,7 @@ implemented using Python asyncio. It does the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units. """ + # pylint: disable=duplicate-code # Many sensors of different generations have a similar API from __future__ import annotations diff --git a/tinkerforge_async/bricklet_io4_v2.py b/tinkerforge_async/bricklet_io4_v2.py index 3ef8aed..61b3920 100644 --- a/tinkerforge_async/bricklet_io4_v2.py +++ b/tinkerforge_async/bricklet_io4_v2.py @@ -3,6 +3,7 @@ implemented using Python asyncio. It does the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units. """ + # pylint: disable=duplicate-code # Many sensors of different generations have a similar API from __future__ import annotations diff --git a/tinkerforge_async/bricklet_isolator.py b/tinkerforge_async/bricklet_isolator.py index ca61788..c397e9c 100644 --- a/tinkerforge_async/bricklet_isolator.py +++ b/tinkerforge_async/bricklet_isolator.py @@ -3,6 +3,7 @@ (https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Isolator.html) implemented using Python asyncio. It does the low-level communication with the Tinkerforge ip connection. """ + # pylint: disable=duplicate-code # Many sensors of different generations have a similar API from __future__ import annotations diff --git a/tinkerforge_async/bricklet_moisture.py b/tinkerforge_async/bricklet_moisture.py index dd15cc9..3b0d679 100644 --- a/tinkerforge_async/bricklet_moisture.py +++ b/tinkerforge_async/bricklet_moisture.py @@ -3,6 +3,7 @@ implemented using Python asyncio. It does the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units. """ + # pylint: disable=duplicate-code # Many sensors of different generations have a similar API from __future__ import annotations diff --git a/tinkerforge_async/bricklet_motion_detector_v2.py b/tinkerforge_async/bricklet_motion_detector_v2.py index d76dc97..7c4b628 100644 --- a/tinkerforge_async/bricklet_motion_detector_v2.py +++ b/tinkerforge_async/bricklet_motion_detector_v2.py @@ -3,6 +3,7 @@ (https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Barometer_V2.html) implemented using Python asyncio. It does the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units. """ + # pylint: disable=duplicate-code # Many sensors of different generations have a similar API from __future__ import annotations diff --git a/tinkerforge_async/bricklet_ptc.py b/tinkerforge_async/bricklet_ptc.py index 306ab3a..18bbc8d 100644 --- a/tinkerforge_async/bricklet_ptc.py +++ b/tinkerforge_async/bricklet_ptc.py @@ -3,6 +3,7 @@ using Python asyncIO. It does the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units. """ + # pylint: disable=duplicate-code # Many sensors of different generations have a similar API from __future__ import annotations diff --git a/tinkerforge_async/bricklet_ptc_v2.py b/tinkerforge_async/bricklet_ptc_v2.py index 5f94b57..f76e687 100644 --- a/tinkerforge_async/bricklet_ptc_v2.py +++ b/tinkerforge_async/bricklet_ptc_v2.py @@ -3,6 +3,7 @@ implemented using Python asyncio. It does the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units. """ + # pylint: disable=duplicate-code # Many sensors of different generations have a similar API from __future__ import annotations diff --git a/tinkerforge_async/bricklet_rs232_v2.py b/tinkerforge_async/bricklet_rs232_v2.py index 3be2606..c3735b7 100644 --- a/tinkerforge_async/bricklet_rs232_v2.py +++ b/tinkerforge_async/bricklet_rs232_v2.py @@ -3,6 +3,7 @@ using Python asyncIO. It does the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units. """ + # pylint: disable=duplicate-code # Many sensors of different generations have a similar API from __future__ import annotations diff --git a/tinkerforge_async/bricklet_segment_display_4x7.py b/tinkerforge_async/bricklet_segment_display_4x7.py index 6d5f682..f7d4a24 100644 --- a/tinkerforge_async/bricklet_segment_display_4x7.py +++ b/tinkerforge_async/bricklet_segment_display_4x7.py @@ -4,6 +4,7 @@ does the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units. """ + from __future__ import annotations from enum import Enum, unique diff --git a/tinkerforge_async/bricklet_segment_display_4x7_v2.py b/tinkerforge_async/bricklet_segment_display_4x7_v2.py index ccde45a..b93ad8d 100644 --- a/tinkerforge_async/bricklet_segment_display_4x7_v2.py +++ b/tinkerforge_async/bricklet_segment_display_4x7_v2.py @@ -4,6 +4,7 @@ does the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units. """ + # pylint: disable=duplicate-code # Many sensors of different generations have a similar API from __future__ import annotations diff --git a/tinkerforge_async/bricklet_temperature.py b/tinkerforge_async/bricklet_temperature.py index a423402..86be98b 100644 --- a/tinkerforge_async/bricklet_temperature.py +++ b/tinkerforge_async/bricklet_temperature.py @@ -3,6 +3,7 @@ implemented using Python asyncIO. It does the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units. """ + # pylint: disable=duplicate-code # Many sensors of different generations have a similar API from __future__ import annotations diff --git a/tinkerforge_async/bricklet_temperature_v2.py b/tinkerforge_async/bricklet_temperature_v2.py index 703559e..5ad97a7 100644 --- a/tinkerforge_async/bricklet_temperature_v2.py +++ b/tinkerforge_async/bricklet_temperature_v2.py @@ -3,6 +3,7 @@ (https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Temperature_V2.html) implemented using Python asyncio. It does the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units. """ + # pylint: disable=duplicate-code # Many sensors of different generations have a similar API from __future__ import annotations diff --git a/tinkerforge_async/bricklet_thermocouple_v2.py b/tinkerforge_async/bricklet_thermocouple_v2.py index 464eebf..68394d5 100644 --- a/tinkerforge_async/bricklet_thermocouple_v2.py +++ b/tinkerforge_async/bricklet_thermocouple_v2.py @@ -3,6 +3,7 @@ (https://www.tinkerforge.com/en/doc/Hardware/Bricklets/Thermocouple_V2.html) implemented using Python asyncio. It does the low-level communication with the Tinkerforge ip connection and also handles conversion of raw units to SI units. """ + # pylint: disable=duplicate-code # Many sensors of different generations have a similar API from __future__ import annotations diff --git a/tinkerforge_async/device_factory.py b/tinkerforge_async/device_factory.py index ef6085d..6f30bb6 100644 --- a/tinkerforge_async/device_factory.py +++ b/tinkerforge_async/device_factory.py @@ -2,6 +2,7 @@ The device factory which allows to create instances of Bricks and Bricklets from their device id """ + from __future__ import annotations from typing import TYPE_CHECKING diff --git a/tinkerforge_async/devices.py b/tinkerforge_async/devices.py index 28a17f6..6619edd 100644 --- a/tinkerforge_async/devices.py +++ b/tinkerforge_async/devices.py @@ -1,6 +1,7 @@ """ This file contains all base classes used by Bricks and bricklets """ + from __future__ import annotations import time diff --git a/tinkerforge_async/ip_connection.py b/tinkerforge_async/ip_connection.py index 16c9cc5..2030548 100644 --- a/tinkerforge_async/ip_connection.py +++ b/tinkerforge_async/ip_connection.py @@ -2,6 +2,7 @@ This module implements the underlying ip connection to the Bricks and Bricklets. See https://www.tinkerforge.com/de/doc/Low_Level_Protocols/TCPIP.html for details. """ + from __future__ import annotations import asyncio @@ -296,9 +297,11 @@ def __parse_enumerate_payload(payload) -> EnumerationPayload: # We will return None for all 'invalid' fields instead of garbage like the Tinkerforge API return EnumerationPayload( base58decode(uid), - None - if (enumeration_type is EnumerationType.DISCONNECTED or connected_uid == "0") - else base58decode(connected_uid), + ( + None + if (enumeration_type is EnumerationType.DISCONNECTED or connected_uid == "0") + else base58decode(connected_uid) + ), None if enumeration_type is EnumerationType.DISCONNECTED else position, None if enumeration_type is EnumerationType.DISCONNECTED else hardware_version, None if enumeration_type is EnumerationType.DISCONNECTED else firmware_version, @@ -340,8 +343,7 @@ async def send_request( data: bytes = b"", *, response_expected: Literal[True], - ) -> tuple[HeaderPayload, bytes]: - ... + ) -> tuple[HeaderPayload, bytes]: ... @overload async def send_request( @@ -351,8 +353,7 @@ async def send_request( data: bytes = b"", *, response_expected: Literal[False] = ..., - ) -> None: - ... + ) -> None: ... @overload async def send_request( @@ -362,8 +363,7 @@ async def send_request( data: bytes = b"", *, response_expected: bool = ..., - ) -> tuple[HeaderPayload, bytes] | None: - ... + ) -> tuple[HeaderPayload, bytes] | None: ... async def send_request( self, diff --git a/tinkerforge_async/ip_connection_helper.py b/tinkerforge_async/ip_connection_helper.py index 5d14246..8d052c0 100644 --- a/tinkerforge_async/ip_connection_helper.py +++ b/tinkerforge_async/ip_connection_helper.py @@ -1,6 +1,7 @@ """ Some helper functions to encode and decode Tinkerforge protocol payloads. """ + from __future__ import annotations import math