From 066891b20925e45a879b3677bc1cec8166cf252d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 29 Jan 2024 08:23:16 +0000 Subject: [PATCH 1/3] Bump black from 23.12.1 to 24.1.1 Bumps [black](https://github.com/psf/black) from 23.12.1 to 24.1.1. - [Release notes](https://github.com/psf/black/releases) - [Changelog](https://github.com/psf/black/blob/main/CHANGES.md) - [Commits](https://github.com/psf/black/compare/23.12.1...24.1.1) --- updated-dependencies: - dependency-name: black dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- requirements_test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_test.txt b/requirements_test.txt index c6fdd327..9797b10c 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,4 +1,4 @@ -black==23.12.1 +black==24.1.1 coverage==7.4.1 mypy==1.8.0 pre-commit==3.6.0 From a9cb9fe412f071e4cd7993a418842c9cb08f3e48 Mon Sep 17 00:00:00 2001 From: Martin Hjelmare Date: Thu, 1 Feb 2024 10:32:41 +0100 Subject: [PATCH 2/3] Bump pre-commit black hook to 24.1.1 --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6e2ada90..5787e6bc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,7 +6,7 @@ repos: args: - --fix - repo: https://github.com/psf/black - rev: 23.12.1 + rev: 24.1.1 hooks: - id: black name: black From c520ddedbdd83e63fe443ef1d424d2e40f6d3ab2 Mon Sep 17 00:00:00 2001 From: Martin Hjelmare Date: Thu, 1 Feb 2024 10:32:53 +0100 Subject: [PATCH 3/3] Run black --- pytradfri/__init__.py | 1 + pytradfri/__main__.py | 1 + pytradfri/api/aiocoap_api.py | 13 +++++-------- pytradfri/api/libcoap_api.py | 13 +++++-------- pytradfri/color.py | 1 + pytradfri/command.py | 1 + pytradfri/const.py | 1 + pytradfri/device/__init__.py | 1 + pytradfri/device/air_purifier.py | 1 + pytradfri/device/air_purifier_control.py | 1 + pytradfri/device/base_controller.py | 1 + pytradfri/device/blind.py | 1 + pytradfri/device/blind_control.py | 1 + pytradfri/device/light.py | 1 + pytradfri/device/light_control.py | 1 + pytradfri/device/signal_repeater.py | 1 + pytradfri/device/signal_repeater_control.py | 1 + pytradfri/device/socket.py | 1 + pytradfri/device/socket_control.py | 1 + pytradfri/gateway.py | 1 + pytradfri/group.py | 1 + pytradfri/mood.py | 1 + pytradfri/resource.py | 1 + pytradfri/smart_task.py | 1 + pytradfri/util.py | 1 + tests/api/test_aiocoap_api.py | 1 + tests/api/test_libcoap_api.py | 1 + tests/devices.py | 1 + tests/moods.py | 1 + tests/test_air_purifiers.py | 1 + tests/test_blinds.py | 1 + tests/test_color.py | 1 + tests/test_command.py | 1 + tests/test_device.py | 1 + tests/test_gateway.py | 1 + tests/test_group.py | 1 + tests/test_light.py | 1 + tests/test_mood.py | 1 + tests/test_signal_repeater.py | 1 - tests/test_smart_task.py | 1 + tests/test_socket.py | 1 + tests/test_util.py | 1 + 42 files changed, 49 insertions(+), 17 deletions(-) diff --git a/pytradfri/__init__.py b/pytradfri/__init__.py index 1a093c5a..5f3bc166 100644 --- a/pytradfri/__init__.py +++ b/pytradfri/__init__.py @@ -1,4 +1,5 @@ """Implement an API wrapper around Ikea Tradfri.""" + from pathlib import Path from .error import ( diff --git a/pytradfri/__main__.py b/pytradfri/__main__.py index a1e050c2..139d2b85 100644 --- a/pytradfri/__main__.py +++ b/pytradfri/__main__.py @@ -1,4 +1,5 @@ """Provide a CLI for Tradfri.""" + from __future__ import annotations import argparse diff --git a/pytradfri/api/aiocoap_api.py b/pytradfri/api/aiocoap_api.py index 6d9e10e2..2f9aea52 100644 --- a/pytradfri/api/aiocoap_api.py +++ b/pytradfri/api/aiocoap_api.py @@ -1,4 +1,5 @@ """COAP implementation using aiocoap.""" + from __future__ import annotations import asyncio @@ -41,14 +42,12 @@ class APIRequestProtocol(Protocol): @overload async def __call__( self, api_commands: Command[T], timeout: float | None = None - ) -> T: - ... + ) -> T: ... @overload async def __call__( self, api_commands: list[Command[T]], timeout: float | None = None - ) -> list[T]: - ... + ) -> list[T]: ... async def __call__( self, api_commands: Command[T] | list[Command[T]], timeout: float | None = None @@ -214,14 +213,12 @@ async def _execute(self, api_command: Command[T], timeout: float | None) -> T: @overload async def request( self, api_commands: Command[T], timeout: float | None = None - ) -> T: - ... + ) -> T: ... @overload async def request( self, api_commands: list[Command[T]], timeout: float | None = None - ) -> list[T]: - ... + ) -> list[T]: ... async def request( self, api_commands: Command[T] | list[Command[T]], timeout: float | None = None diff --git a/pytradfri/api/libcoap_api.py b/pytradfri/api/libcoap_api.py index 4ef1955e..464945f8 100644 --- a/pytradfri/api/libcoap_api.py +++ b/pytradfri/api/libcoap_api.py @@ -1,4 +1,5 @@ """COAP implementation.""" + from __future__ import annotations import json @@ -21,14 +22,12 @@ class APIRequestProtocol(Protocol): """Represent the protocol for the APIFactory request method.""" @overload - def __call__(self, api_commands: Command[T], timeout: int | None = None) -> T: - ... + def __call__(self, api_commands: Command[T], timeout: int | None = None) -> T: ... @overload def __call__( self, api_commands: list[Command[T]], timeout: int | None = None - ) -> list[T]: - ... + ) -> list[T]: ... def __call__( self, api_commands: Command[T] | list[Command[T]], timeout: int | None = None @@ -125,14 +124,12 @@ def _execute(self, api_command: Command[T], *, timeout: int | None = None) -> T: return api_command.result @overload - def request(self, api_commands: Command[T], timeout: int | None = None) -> T: - ... + def request(self, api_commands: Command[T], timeout: int | None = None) -> T: ... @overload def request( self, api_commands: list[Command[T]], timeout: int | None = None - ) -> list[T]: - ... + ) -> list[T]: ... def request( self, api_commands: Command[T] | list[Command[T]], timeout: int | None = None diff --git a/pytradfri/color.py b/pytradfri/color.py index a65254d6..c0a9fadb 100644 --- a/pytradfri/color.py +++ b/pytradfri/color.py @@ -1,4 +1,5 @@ """Test Color.""" + from __future__ import annotations from typing import TYPE_CHECKING diff --git a/pytradfri/command.py b/pytradfri/command.py index 62f5e5dd..dccbe483 100644 --- a/pytradfri/command.py +++ b/pytradfri/command.py @@ -1,4 +1,5 @@ """Command implementation.""" + from __future__ import annotations from collections.abc import Callable diff --git a/pytradfri/const.py b/pytradfri/const.py index 09f14441..7f2e19e8 100644 --- a/pytradfri/const.py +++ b/pytradfri/const.py @@ -1,4 +1,5 @@ """Constants.""" + from typing import Final ROOT_DEVICES: Final = "15001" diff --git a/pytradfri/device/__init__.py b/pytradfri/device/__init__.py index 182d5fb1..0d9e0c29 100644 --- a/pytradfri/device/__init__.py +++ b/pytradfri/device/__init__.py @@ -1,4 +1,5 @@ """Classes to interact with devices.""" + from __future__ import annotations from datetime import datetime diff --git a/pytradfri/device/air_purifier.py b/pytradfri/device/air_purifier.py index ce5be831..cb97631b 100644 --- a/pytradfri/device/air_purifier.py +++ b/pytradfri/device/air_purifier.py @@ -1,4 +1,5 @@ """Represent an air purifier.""" + from __future__ import annotations from typing import TYPE_CHECKING diff --git a/pytradfri/device/air_purifier_control.py b/pytradfri/device/air_purifier_control.py index bea881fb..0be21262 100644 --- a/pytradfri/device/air_purifier_control.py +++ b/pytradfri/device/air_purifier_control.py @@ -1,4 +1,5 @@ """Class to control the air purifiers.""" + from __future__ import annotations from ..command import Command diff --git a/pytradfri/device/base_controller.py b/pytradfri/device/base_controller.py index 25a3dbb6..19189474 100644 --- a/pytradfri/device/base_controller.py +++ b/pytradfri/device/base_controller.py @@ -1,4 +1,5 @@ """Base class for a controller.""" + from __future__ import annotations from abc import abstractmethod diff --git a/pytradfri/device/blind.py b/pytradfri/device/blind.py index d2a84268..ac7ebfdc 100644 --- a/pytradfri/device/blind.py +++ b/pytradfri/device/blind.py @@ -1,4 +1,5 @@ """Represent a blind.""" + from __future__ import annotations from typing import TYPE_CHECKING diff --git a/pytradfri/device/blind_control.py b/pytradfri/device/blind_control.py index 26284626..325c5e46 100644 --- a/pytradfri/device/blind_control.py +++ b/pytradfri/device/blind_control.py @@ -1,4 +1,5 @@ """Class to control the blinds.""" + from __future__ import annotations from ..command import Command diff --git a/pytradfri/device/light.py b/pytradfri/device/light.py index e741bb24..2d6e6dd4 100644 --- a/pytradfri/device/light.py +++ b/pytradfri/device/light.py @@ -1,4 +1,5 @@ """Represent a light.""" + from __future__ import annotations from typing import TYPE_CHECKING diff --git a/pytradfri/device/light_control.py b/pytradfri/device/light_control.py index 2d33aa66..43c90493 100644 --- a/pytradfri/device/light_control.py +++ b/pytradfri/device/light_control.py @@ -1,4 +1,5 @@ """Class to control the lights.""" + from __future__ import annotations from collections.abc import Mapping, Sequence diff --git a/pytradfri/device/signal_repeater.py b/pytradfri/device/signal_repeater.py index 02c70212..1b023d73 100644 --- a/pytradfri/device/signal_repeater.py +++ b/pytradfri/device/signal_repeater.py @@ -1,4 +1,5 @@ """Represent a signal repeater.""" + from __future__ import annotations from typing import TYPE_CHECKING diff --git a/pytradfri/device/signal_repeater_control.py b/pytradfri/device/signal_repeater_control.py index 6ab1886c..61710eec 100644 --- a/pytradfri/device/signal_repeater_control.py +++ b/pytradfri/device/signal_repeater_control.py @@ -1,4 +1,5 @@ """Class to control the signal repeater.""" + from __future__ import annotations from .base_controller import BaseController diff --git a/pytradfri/device/socket.py b/pytradfri/device/socket.py index 12d70e05..8e528050 100644 --- a/pytradfri/device/socket.py +++ b/pytradfri/device/socket.py @@ -1,4 +1,5 @@ """Represent a socket.""" + from __future__ import annotations from typing import TYPE_CHECKING diff --git a/pytradfri/device/socket_control.py b/pytradfri/device/socket_control.py index c5bedc7e..76c0c345 100644 --- a/pytradfri/device/socket_control.py +++ b/pytradfri/device/socket_control.py @@ -1,4 +1,5 @@ """Class to control the sockets.""" + from __future__ import annotations from ..command import Command diff --git a/pytradfri/gateway.py b/pytradfri/gateway.py index 5e9753cd..5a1b9950 100644 --- a/pytradfri/gateway.py +++ b/pytradfri/gateway.py @@ -1,4 +1,5 @@ """Represent the gateway.""" + from __future__ import annotations from datetime import datetime diff --git a/pytradfri/group.py b/pytradfri/group.py index 63f00331..2254aadc 100644 --- a/pytradfri/group.py +++ b/pytradfri/group.py @@ -1,4 +1,5 @@ """Group handling.""" + from __future__ import annotations from typing import TYPE_CHECKING diff --git a/pytradfri/mood.py b/pytradfri/mood.py index 1bc282f1..c1139a63 100644 --- a/pytradfri/mood.py +++ b/pytradfri/mood.py @@ -1,4 +1,5 @@ """Represent a mood on the gateway.""" + from __future__ import annotations from .const import ROOT_MOODS diff --git a/pytradfri/resource.py b/pytradfri/resource.py index a4334d5e..117a78c2 100644 --- a/pytradfri/resource.py +++ b/pytradfri/resource.py @@ -1,4 +1,5 @@ """Resources for devices.""" + from __future__ import annotations from abc import abstractmethod diff --git a/pytradfri/smart_task.py b/pytradfri/smart_task.py index aae79817..0484c736 100644 --- a/pytradfri/smart_task.py +++ b/pytradfri/smart_task.py @@ -8,6 +8,7 @@ StartActionItem # Get info on specific device in task StartActionItemController # change values for task """ + from __future__ import annotations from datetime import datetime as dt, time, timedelta diff --git a/pytradfri/util.py b/pytradfri/util.py index 712e495e..c3a6c58b 100644 --- a/pytradfri/util.py +++ b/pytradfri/util.py @@ -1,4 +1,5 @@ """JSON utility functions.""" + from __future__ import annotations from collections.abc import Iterator diff --git a/tests/api/test_aiocoap_api.py b/tests/api/test_aiocoap_api.py index f9f6723c..0904dabd 100644 --- a/tests/api/test_aiocoap_api.py +++ b/tests/api/test_aiocoap_api.py @@ -1,4 +1,5 @@ """Test aiocoap API.""" + from typing import Any from aiocoap import Message diff --git a/tests/api/test_libcoap_api.py b/tests/api/test_libcoap_api.py index d3c3d276..27dfd6c0 100644 --- a/tests/api/test_libcoap_api.py +++ b/tests/api/test_libcoap_api.py @@ -1,4 +1,5 @@ """Test API utilities.""" + import json from pytradfri.api.libcoap_api import APIFactory diff --git a/tests/devices.py b/tests/devices.py index 09bb8596..85ad925d 100644 --- a/tests/devices.py +++ b/tests/devices.py @@ -1,4 +1,5 @@ """Devices: Retrieved from Gateway running on 1.2.42.""" + LIGHT_W = { "3": { "0": "IKEA of Sweden", diff --git a/tests/moods.py b/tests/moods.py index 22e0be43..e5ea2cb8 100644 --- a/tests/moods.py +++ b/tests/moods.py @@ -1,4 +1,5 @@ """Mood definitions: retrieved from Gateway running on 1.9.27.""" + MOOD = { "9001": "FOCUS", "9002": 1577189497, diff --git a/tests/test_air_purifiers.py b/tests/test_air_purifiers.py index 937f8369..62889173 100644 --- a/tests/test_air_purifiers.py +++ b/tests/test_air_purifiers.py @@ -1,4 +1,5 @@ """Test Air Purifiers.""" + import pytest from pytradfri.device import Device diff --git a/tests/test_blinds.py b/tests/test_blinds.py index 74554827..951be528 100644 --- a/tests/test_blinds.py +++ b/tests/test_blinds.py @@ -1,4 +1,5 @@ """Test Blinds.""" + import pytest from pytradfri.device import Device diff --git a/tests/test_color.py b/tests/test_color.py index 6b15ba9f..d30301a7 100644 --- a/tests/test_color.py +++ b/tests/test_color.py @@ -1,4 +1,5 @@ """Test Color.""" + from pytradfri.color import supported_features from pytradfri.const import ( ATTR_LIGHT_CONTROL, diff --git a/tests/test_command.py b/tests/test_command.py index 49dd70f7..de3b84c2 100644 --- a/tests/test_command.py +++ b/tests/test_command.py @@ -1,4 +1,5 @@ """Test Command.""" + from pytradfri.command import Command diff --git a/tests/test_device.py b/tests/test_device.py index cab03532..bb03223e 100644 --- a/tests/test_device.py +++ b/tests/test_device.py @@ -1,4 +1,5 @@ """Test Device.""" + from copy import deepcopy from datetime import datetime diff --git a/tests/test_gateway.py b/tests/test_gateway.py index dc98fe30..5c7c39e0 100644 --- a/tests/test_gateway.py +++ b/tests/test_gateway.py @@ -1,4 +1,5 @@ """Test Gateway.""" + from copy import deepcopy from datetime import datetime diff --git a/tests/test_group.py b/tests/test_group.py index 25de743b..4f758d2a 100644 --- a/tests/test_group.py +++ b/tests/test_group.py @@ -1,4 +1,5 @@ """Test Group.""" + import pytest from pytradfri import error diff --git a/tests/test_light.py b/tests/test_light.py index 523cfe2f..8b4a075e 100644 --- a/tests/test_light.py +++ b/tests/test_light.py @@ -1,4 +1,5 @@ """Test Light.""" + import pytest from pytradfri import error diff --git a/tests/test_mood.py b/tests/test_mood.py index a28f01c1..32793efd 100644 --- a/tests/test_mood.py +++ b/tests/test_mood.py @@ -1,4 +1,5 @@ """Test mood.""" + import pytest from pytradfri.const import ROOT_MOODS diff --git a/tests/test_signal_repeater.py b/tests/test_signal_repeater.py index 3a7c5eb6..ef30f63c 100644 --- a/tests/test_signal_repeater.py +++ b/tests/test_signal_repeater.py @@ -1,6 +1,5 @@ """Test for the signal repeater device.""" - from pytradfri.device import Device from tests.devices import SIGNAL_REPEATER diff --git a/tests/test_smart_task.py b/tests/test_smart_task.py index 5f9e9c84..4d3d2103 100644 --- a/tests/test_smart_task.py +++ b/tests/test_smart_task.py @@ -1,4 +1,5 @@ """Test smart_task.""" + import datetime from pytradfri.gateway import Gateway diff --git a/tests/test_socket.py b/tests/test_socket.py index 79930b34..e20b3e96 100644 --- a/tests/test_socket.py +++ b/tests/test_socket.py @@ -1,4 +1,5 @@ """Test Socket.""" + from pytradfri.device import Device from .devices import OUTLET diff --git a/tests/test_util.py b/tests/test_util.py index 150f0fa6..f5da7d71 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -1,4 +1,5 @@ """Test Util.""" + import json from os import path import shutil