Skip to content

Commit

Permalink
chore: ruff sort
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanSchalton committed Mar 16, 2024
1 parent 038d442 commit 5490807
Show file tree
Hide file tree
Showing 21 changed files with 37 additions and 55 deletions.
16 changes: 8 additions & 8 deletions custom_components/tuya_openapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
from typing import NamedTuple

import requests
from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers import entity_registry as er
from homeassistant.helpers.dispatcher import dispatcher_send
from tuya_iot import (
AuthType,
TuyaDevice,
Expand All @@ -14,14 +22,6 @@
TuyaOpenMQ,
)

from homeassistant.components.light import DOMAIN as LIGHT_DOMAIN
from homeassistant.components.switch import DOMAIN as SWITCH_DOMAIN
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers import device_registry as dr, entity_registry as er
from homeassistant.helpers.dispatcher import dispatcher_send

from .const import (
CONF_ACCESS_ID,
CONF_ACCESS_SECRET,
Expand Down
3 changes: 1 addition & 2 deletions custom_components/tuya_openapi/alarm_control_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

from enum import StrEnum

from tuya_iot import TuyaDevice, TuyaDeviceManager

from homeassistant.components.alarm_control_panel import (
AlarmControlPanelEntity,
AlarmControlPanelEntityDescription,
Expand All @@ -20,6 +18,7 @@
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from tuya_iot import TuyaDevice, TuyaDeviceManager

from . import HomeAssistantTuyaData
from .base import TuyaEntity
Expand Down
5 changes: 2 additions & 3 deletions custom_components/tuya_openapi/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@
from __future__ import annotations

import base64
from dataclasses import dataclass
import json
import struct
from dataclasses import dataclass
from typing import Any, Literal, Self, overload

from tuya_iot import TuyaDevice, TuyaDeviceManager

from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import Entity
from tuya_iot import TuyaDevice, TuyaDeviceManager

from .const import (
DOMAIN,
Expand Down
3 changes: 1 addition & 2 deletions custom_components/tuya_openapi/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

from dataclasses import dataclass

from tuya_iot import TuyaDevice, TuyaDeviceManager

from homeassistant.components.binary_sensor import (
BinarySensorDeviceClass,
BinarySensorEntity,
Expand All @@ -15,6 +13,7 @@
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from tuya_iot import TuyaDevice, TuyaDeviceManager

from . import HomeAssistantTuyaData
from .base import TuyaEntity
Expand Down
3 changes: 1 addition & 2 deletions custom_components/tuya_openapi/button.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
"""Support for Tuya buttons."""
from __future__ import annotations

from tuya_iot import TuyaDevice, TuyaDeviceManager

from homeassistant.components.button import ButtonEntity, ButtonEntityDescription
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EntityCategory
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from tuya_iot import TuyaDevice, TuyaDeviceManager

from . import HomeAssistantTuyaData
from .base import TuyaEntity
Expand Down
6 changes: 3 additions & 3 deletions custom_components/tuya_openapi/camera.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"""Support for Tuya cameras."""
from __future__ import annotations

from tuya_iot import TuyaDevice, TuyaDeviceManager

from homeassistant.components import ffmpeg
from homeassistant.components.camera import Camera as CameraEntity, CameraEntityFeature
from homeassistant.components.camera import Camera as CameraEntity
from homeassistant.components.camera import CameraEntityFeature
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from tuya_iot import TuyaDevice, TuyaDeviceManager

from . import HomeAssistantTuyaData
from .base import TuyaEntity
Expand Down
3 changes: 1 addition & 2 deletions custom_components/tuya_openapi/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from dataclasses import dataclass
from typing import Any

from tuya_iot import TuyaDevice, TuyaDeviceManager

from homeassistant.components.climate import (
SWING_BOTH,
SWING_HORIZONTAL,
Expand All @@ -22,6 +20,7 @@
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from tuya_iot import TuyaDevice, TuyaDeviceManager

from . import HomeAssistantTuyaData
from .base import IntegerTypeData, TuyaEntity
Expand Down
3 changes: 1 addition & 2 deletions custom_components/tuya_openapi/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@

from typing import Any

from tuya_iot import AuthType, TuyaOpenAPI
import voluptuous as vol

from homeassistant import config_entries
from tuya_iot import AuthType, TuyaOpenAPI

from .const import (
CONF_ACCESS_ID,
Expand Down
5 changes: 2 additions & 3 deletions custom_components/tuya_openapi/const.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
"""Constants for the Tuya integration."""
from __future__ import annotations

import logging
from collections.abc import Callable
from dataclasses import dataclass, field
from enum import StrEnum
import logging

from tuya_iot import TuyaCloudOpenAPIEndpoint

from homeassistant.components.sensor import SensorDeviceClass
from homeassistant.const import (
Expand All @@ -27,6 +25,7 @@
UnitOfTemperature,
UnitOfVolume,
)
from tuya_iot import TuyaCloudOpenAPIEndpoint

DOMAIN = "tuya"
LOGGER = logging.getLogger(__package__)
Expand Down
3 changes: 1 addition & 2 deletions custom_components/tuya_openapi/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
from dataclasses import dataclass
from typing import Any

from tuya_iot import TuyaDevice, TuyaDeviceManager

from homeassistant.components.cover import (
ATTR_POSITION,
ATTR_TILT_POSITION,
Expand All @@ -18,6 +16,7 @@
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from tuya_iot import TuyaDevice, TuyaDeviceManager

from . import HomeAssistantTuyaData
from .base import IntegerTypeData, TuyaEntity
Expand Down
8 changes: 4 additions & 4 deletions custom_components/tuya_openapi/diagnostics.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
"""Diagnostics support for Tuya."""
from __future__ import annotations

from contextlib import suppress
import json
from contextlib import suppress
from typing import Any, cast

from tuya_iot import TuyaDevice

from homeassistant.components.diagnostics import REDACTED
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers import device_registry as dr, entity_registry as er
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers import entity_registry as er
from homeassistant.helpers.device_registry import DeviceEntry
from homeassistant.util import dt as dt_util
from tuya_iot import TuyaDevice

from . import HomeAssistantTuyaData
from .const import (
Expand Down
3 changes: 1 addition & 2 deletions custom_components/tuya_openapi/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

from typing import Any

from tuya_iot import TuyaDevice, TuyaDeviceManager

from homeassistant.components.fan import (
DIRECTION_FORWARD,
DIRECTION_REVERSE,
Expand All @@ -19,6 +17,7 @@
ordered_list_item_to_percentage,
percentage_to_ordered_list_item,
)
from tuya_iot import TuyaDevice, TuyaDeviceManager

from . import HomeAssistantTuyaData
from .base import EnumTypeData, IntegerTypeData, TuyaEntity
Expand Down
3 changes: 1 addition & 2 deletions custom_components/tuya_openapi/humidifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

from dataclasses import dataclass

from tuya_iot import TuyaDevice, TuyaDeviceManager

from homeassistant.components.humidifier import (
HumidifierDeviceClass,
HumidifierEntity,
Expand All @@ -15,6 +13,7 @@
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from tuya_iot import TuyaDevice, TuyaDeviceManager

from . import HomeAssistantTuyaData
from .base import IntegerTypeData, TuyaEntity
Expand Down
5 changes: 2 additions & 3 deletions custom_components/tuya_openapi/light.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
"""Support for the Tuya lights."""
from __future__ import annotations

from dataclasses import dataclass, field
import json
from dataclasses import dataclass, field
from typing import Any, cast

from tuya_iot import TuyaDevice, TuyaDeviceManager

from homeassistant.components.light import (
ATTR_BRIGHTNESS,
ATTR_COLOR_TEMP,
Expand All @@ -20,6 +18,7 @@
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from tuya_iot import TuyaDevice, TuyaDeviceManager

from . import HomeAssistantTuyaData
from .base import IntegerTypeData, TuyaEntity
Expand Down
3 changes: 1 addition & 2 deletions custom_components/tuya_openapi/number.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
"""Support for Tuya number."""
from __future__ import annotations

from tuya_iot import TuyaDevice, TuyaDeviceManager

from homeassistant.components.number import (
NumberDeviceClass,
NumberEntity,
Expand All @@ -13,6 +11,7 @@
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from tuya_iot import TuyaDevice, TuyaDeviceManager

from . import HomeAssistantTuyaData
from .base import IntegerTypeData, TuyaEntity
Expand Down
3 changes: 1 addition & 2 deletions custom_components/tuya_openapi/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@

from typing import Any

from tuya_iot import TuyaHomeManager, TuyaScene

from homeassistant.components.scene import Scene
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant
from homeassistant.helpers.device_registry import DeviceInfo
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from tuya_iot import TuyaHomeManager, TuyaScene

from . import HomeAssistantTuyaData
from .const import DOMAIN
Expand Down
3 changes: 1 addition & 2 deletions custom_components/tuya_openapi/select.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
"""Support for Tuya select."""
from __future__ import annotations

from tuya_iot import TuyaDevice, TuyaDeviceManager

from homeassistant.components.select import SelectEntity, SelectEntityDescription
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import EntityCategory
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from tuya_iot import TuyaDevice, TuyaDeviceManager

from . import HomeAssistantTuyaData
from .base import TuyaEntity
Expand Down
5 changes: 2 additions & 3 deletions custom_components/tuya_openapi/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

from dataclasses import dataclass

from tuya_iot import TuyaDevice, TuyaDeviceManager
from tuya_iot.device import TuyaDeviceStatusRange

from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
Expand All @@ -25,6 +22,8 @@
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.typing import StateType
from tuya_iot import TuyaDevice, TuyaDeviceManager
from tuya_iot.device import TuyaDeviceStatusRange

from . import HomeAssistantTuyaData
from .base import (
Expand Down
3 changes: 1 addition & 2 deletions custom_components/tuya_openapi/siren.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

from typing import Any

from tuya_iot import TuyaDevice, TuyaDeviceManager

from homeassistant.components.siren import (
SirenEntity,
SirenEntityDescription,
Expand All @@ -14,6 +12,7 @@
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from tuya_iot import TuyaDevice, TuyaDeviceManager

from . import HomeAssistantTuyaData
from .base import TuyaEntity
Expand Down
3 changes: 1 addition & 2 deletions custom_components/tuya_openapi/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

from typing import Any

from tuya_iot import TuyaDevice, TuyaDeviceManager

from homeassistant.components.switch import (
SwitchDeviceClass,
SwitchEntity,
Expand All @@ -15,6 +13,7 @@
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from tuya_iot import TuyaDevice, TuyaDeviceManager

from . import HomeAssistantTuyaData
from .base import TuyaEntity
Expand Down
3 changes: 1 addition & 2 deletions custom_components/tuya_openapi/vacuum.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

from typing import Any

from tuya_iot import TuyaDevice, TuyaDeviceManager

from homeassistant.components.vacuum import (
STATE_CLEANING,
STATE_DOCKED,
Expand All @@ -18,6 +16,7 @@
from homeassistant.helpers import issue_registry as ir
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from tuya_iot import TuyaDevice, TuyaDeviceManager

from . import HomeAssistantTuyaData
from .base import EnumTypeData, IntegerTypeData, TuyaEntity
Expand Down

0 comments on commit 5490807

Please sign in to comment.