Skip to content

Commit

Permalink
Reformat for black 2024 style
Browse files Browse the repository at this point in the history
  • Loading branch information
dext0r committed May 5, 2024
1 parent 8c3e3e3 commit b357a84
Show file tree
Hide file tree
Showing 40 changed files with 43 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ repos:
- id: ruff

- repo: https://github.com/psf/black
rev: 23.7.0
rev: 24.4.2
hooks:
- id: black

Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/capability.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implement the Yandex Smart Home base device capability."""

from __future__ import annotations

from abc import abstractmethod
Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/capability_color.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implement the Yandex Smart Home color_setting capability."""

from __future__ import annotations

from abc import abstractmethod
Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/capability_custom.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implement the Yandex Smart Home user specific capabilities."""

from __future__ import annotations

import itertools
Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/capability_mode.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implement the Yandex Smart Home mode capabilities."""

from abc import ABC, abstractmethod
import logging
import math
Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/capability_onoff.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implement the Yandex Smart Home on_off capability."""

from abc import ABC, abstractmethod
from typing import Protocol

Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/capability_toggle.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implement the Yandex Smart Home toggle capabilities."""

from typing import Protocol

from homeassistant.components import cover, fan, media_player, vacuum
Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/capability_video.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implement the Yandex Smart Home video_stream capabilities."""

from __future__ import annotations

from typing import TYPE_CHECKING
Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/cloud.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implement the Yandex Smart Home cloud connection manager."""

from __future__ import annotations

from asyncio import TimeoutError
Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/color.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Color manipulation helpers."""

from enum import StrEnum
from math import sqrt
from typing import Self
Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/config_validation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Helpers for config validation using voluptuous."""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/const.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Constants for Yandex Smart Home."""

from enum import StrEnum

DOMAIN = "yandex_smart_home"
Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/device.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Yandex Smart Home user device."""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/diagnostics.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Diagnostics support for Yandex Smart Home."""

from typing import Any

from homeassistant.components.diagnostics import async_redact_data
Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/handlers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The Yandex Smart Home request handlers."""

import logging
from typing import Any, Callable, Coroutine

Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Helper classes for Yandex Smart Home integration."""

from __future__ import annotations

from dataclasses import dataclass
Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/http.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The Yandex Smart Home HTTP interface."""

from __future__ import annotations

import logging
Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/property.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implement the Yandex Smart Home base device property."""

from __future__ import annotations

from abc import abstractmethod
Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/property_custom.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implement the Yandex Smart Home custom properties."""

from __future__ import annotations

from typing import TYPE_CHECKING, Any, Protocol, Self, cast
Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/property_event.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implement the Yandex Smart Home event properties."""

from abc import ABC, abstractmethod
from functools import cached_property
from itertools import chain
Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/property_float.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implement the Yandex Smart Home float properties."""

from abc import ABC, abstractmethod
from contextlib import suppress
from typing import Protocol, Self
Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/schema/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Yandex Smart Home API schemas."""

from .callback import * # noqa: F403
from .capability import * # noqa: F403
from .capability_color import * # noqa: F403
Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/schema/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base class for API response schemas."""

from typing import Any

from pydantic import BaseModel
Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/schema/callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
https://yandex.ru/dev/dialogs/smart-home/doc/reference-alerts/resources-alerts.html
"""

from enum import StrEnum
import time

Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/schema/capability.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Schema for device capabilities."""

from enum import StrEnum
from typing import Annotated, Any, Literal, TypeVar, Union

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
https://yandex.ru/dev/dialogs/smart-home/doc/concepts/mode.html
"""

from enum import StrEnum
from typing import Literal, Self

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
https://yandex.ru/dev/dialogs/smart-home/doc/concepts/on_off.html
"""

from enum import StrEnum

from .base import APIModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
https://yandex.ru/dev/dialogs/smart-home/doc/concepts/range.html
"""

from enum import StrEnum
from typing import Any

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
https://yandex.ru/dev/dialogs/smart-home/doc/concepts/toggle.html
"""

from enum import StrEnum

from .base import APIModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
https://yandex.ru/dev/dialogs/smart-home/doc/concepts/video_stream.html
"""

from enum import StrEnum
from typing import Literal

Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/schema/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
https://yandex.ru/dev/dialogs/smart-home/doc/reference/post-devices-query.html
https://yandex.ru/dev/dialogs/smart-home/doc/reference/post-action.html
"""

from enum import StrEnum
from typing import Any, Literal

Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/schema/property.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
https://yandex.ru/dev/dialogs/smart-home/doc/concepts/properties-types.html
"""

from enum import StrEnum
from typing import Any, Literal

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
https://yandex.ru/dev/dialogs/smart-home/doc/concepts/event.html
"""

from enum import StrEnum
from typing import Any, Generic, Literal, TypeVar

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
https://yandex.ru/dev/dialogs/smart-home/doc/concepts/float.html
"""

from enum import StrEnum
from typing import Literal

Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/schema/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
https://yandex.ru/dev/dialogs/smart-home/doc/concepts/response-codes.html
"""

from enum import StrEnum

from .base import APIModel
Expand Down
1 change: 1 addition & 0 deletions custom_components/yandex_smart_home/unit_conversion.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Unit conversion helpers."""

from enum import StrEnum

from homeassistant.const import (
Expand Down
2 changes: 1 addition & 1 deletion requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pre-commit==3.3.3
ruff==0.0.280
isort==5.12.0
black==24.3.0
black==24.4.2
mkdocs==1.5.3
mkdocs-material==9.5.3
mkdocs-material-extensions==1.3.1
Expand Down
1 change: 1 addition & 0 deletions tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for yandex_smart_home integration."""

from typing import Any
from unittest.mock import MagicMock

Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Global fixtures for yandex_smart_home integration."""

import asyncio
import logging
from unittest.mock import patch
Expand Down
12 changes: 4 additions & 8 deletions tests/test_property.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ def get_properties(
state: State,
property_type: PropertyType.FLOAT,
instance: FloatPropertyInstance,
) -> list[FloatProperty]:
...
) -> list[FloatProperty]: ...


@typing.overload
Expand All @@ -40,8 +39,7 @@ def get_properties(
state: State,
property_type: PropertyType.EVENT,
instance: EventPropertyInstance,
) -> list[StateEventProperty]:
...
) -> list[StateEventProperty]: ...


def get_properties(
Expand Down Expand Up @@ -72,8 +70,7 @@ def get_exact_one_property(
state: State,
property_type: PropertyType.FLOAT,
instance: FloatPropertyInstance,
) -> FloatProperty:
...
) -> FloatProperty: ...


@typing.overload
Expand All @@ -83,8 +80,7 @@ def get_exact_one_property(
state: State,
property_type: PropertyType.EVENT,
instance: EventPropertyInstance,
) -> StateEventProperty:
...
) -> StateEventProperty: ...


def get_exact_one_property(
Expand Down

0 comments on commit b357a84

Please sign in to comment.