Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run black
Browse files Browse the repository at this point in the history
MartinHjelmare committed Feb 1, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent a9cb9fe commit c520dde
Showing 42 changed files with 49 additions and 17 deletions.
1 change: 1 addition & 0 deletions pytradfri/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implement an API wrapper around Ikea Tradfri."""

from pathlib import Path

from .error import (
1 change: 1 addition & 0 deletions pytradfri/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Provide a CLI for Tradfri."""

from __future__ import annotations

import argparse
13 changes: 5 additions & 8 deletions pytradfri/api/aiocoap_api.py
Original file line number Diff line number Diff line change
@@ -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
13 changes: 5 additions & 8 deletions pytradfri/api/libcoap_api.py
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions pytradfri/color.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test Color."""

from __future__ import annotations

from typing import TYPE_CHECKING
1 change: 1 addition & 0 deletions pytradfri/command.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Command implementation."""

from __future__ import annotations

from collections.abc import Callable
1 change: 1 addition & 0 deletions pytradfri/const.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Constants."""

from typing import Final

ROOT_DEVICES: Final = "15001"
1 change: 1 addition & 0 deletions pytradfri/device/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Classes to interact with devices."""

from __future__ import annotations

from datetime import datetime
1 change: 1 addition & 0 deletions pytradfri/device/air_purifier.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Represent an air purifier."""

from __future__ import annotations

from typing import TYPE_CHECKING
1 change: 1 addition & 0 deletions pytradfri/device/air_purifier_control.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Class to control the air purifiers."""

from __future__ import annotations

from ..command import Command
1 change: 1 addition & 0 deletions pytradfri/device/base_controller.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base class for a controller."""

from __future__ import annotations

from abc import abstractmethod
1 change: 1 addition & 0 deletions pytradfri/device/blind.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Represent a blind."""

from __future__ import annotations

from typing import TYPE_CHECKING
1 change: 1 addition & 0 deletions pytradfri/device/blind_control.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Class to control the blinds."""

from __future__ import annotations

from ..command import Command
1 change: 1 addition & 0 deletions pytradfri/device/light.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Represent a light."""

from __future__ import annotations

from typing import TYPE_CHECKING
1 change: 1 addition & 0 deletions pytradfri/device/light_control.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Class to control the lights."""

from __future__ import annotations

from collections.abc import Mapping, Sequence
1 change: 1 addition & 0 deletions pytradfri/device/signal_repeater.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Represent a signal repeater."""

from __future__ import annotations

from typing import TYPE_CHECKING
1 change: 1 addition & 0 deletions pytradfri/device/signal_repeater_control.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Class to control the signal repeater."""

from __future__ import annotations

from .base_controller import BaseController
1 change: 1 addition & 0 deletions pytradfri/device/socket.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Represent a socket."""

from __future__ import annotations

from typing import TYPE_CHECKING
1 change: 1 addition & 0 deletions pytradfri/device/socket_control.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Class to control the sockets."""

from __future__ import annotations

from ..command import Command
1 change: 1 addition & 0 deletions pytradfri/gateway.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Represent the gateway."""

from __future__ import annotations

from datetime import datetime
1 change: 1 addition & 0 deletions pytradfri/group.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Group handling."""

from __future__ import annotations

from typing import TYPE_CHECKING
1 change: 1 addition & 0 deletions pytradfri/mood.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Represent a mood on the gateway."""

from __future__ import annotations

from .const import ROOT_MOODS
1 change: 1 addition & 0 deletions pytradfri/resource.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Resources for devices."""

from __future__ import annotations

from abc import abstractmethod
1 change: 1 addition & 0 deletions pytradfri/smart_task.py
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions pytradfri/util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""JSON utility functions."""

from __future__ import annotations

from collections.abc import Iterator
1 change: 1 addition & 0 deletions tests/api/test_aiocoap_api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test aiocoap API."""

from typing import Any

from aiocoap import Message
1 change: 1 addition & 0 deletions tests/api/test_libcoap_api.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test API utilities."""

import json

from pytradfri.api.libcoap_api import APIFactory
1 change: 1 addition & 0 deletions tests/devices.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Devices: Retrieved from Gateway running on 1.2.42."""

LIGHT_W = {
"3": {
"0": "IKEA of Sweden",
1 change: 1 addition & 0 deletions tests/moods.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Mood definitions: retrieved from Gateway running on 1.9.27."""

MOOD = {
"9001": "FOCUS",
"9002": 1577189497,
1 change: 1 addition & 0 deletions tests/test_air_purifiers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test Air Purifiers."""

import pytest

from pytradfri.device import Device
1 change: 1 addition & 0 deletions tests/test_blinds.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test Blinds."""

import pytest

from pytradfri.device import Device
1 change: 1 addition & 0 deletions tests/test_color.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test Color."""

from pytradfri.color import supported_features
from pytradfri.const import (
ATTR_LIGHT_CONTROL,
1 change: 1 addition & 0 deletions tests/test_command.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test Command."""

from pytradfri.command import Command


1 change: 1 addition & 0 deletions tests/test_device.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test Device."""

from copy import deepcopy
from datetime import datetime

1 change: 1 addition & 0 deletions tests/test_gateway.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test Gateway."""

from copy import deepcopy
from datetime import datetime

1 change: 1 addition & 0 deletions tests/test_group.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test Group."""

import pytest

from pytradfri import error
1 change: 1 addition & 0 deletions tests/test_light.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test Light."""

import pytest

from pytradfri import error
1 change: 1 addition & 0 deletions tests/test_mood.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test mood."""

import pytest

from pytradfri.const import ROOT_MOODS
1 change: 0 additions & 1 deletion tests/test_signal_repeater.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Test for the signal repeater device."""


from pytradfri.device import Device

from tests.devices import SIGNAL_REPEATER
1 change: 1 addition & 0 deletions tests/test_smart_task.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test smart_task."""

import datetime

from pytradfri.gateway import Gateway
1 change: 1 addition & 0 deletions tests/test_socket.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test Socket."""

from pytradfri.device import Device

from .devices import OUTLET
1 change: 1 addition & 0 deletions tests/test_util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test Util."""

import json
from os import path
import shutil

0 comments on commit c520dde

Please sign in to comment.