Skip to content

Commit

Permalink
refactor: harmonize imports
Browse files Browse the repository at this point in the history
  • Loading branch information
muhlba91 committed Dec 15, 2023
1 parent 3aabd03 commit 5be6160
Show file tree
Hide file tree
Showing 22 changed files with 74 additions and 79 deletions.
13 changes: 6 additions & 7 deletions onyx_client/authorizer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
"""Onyx Client authorizer."""

import logging
from typing import Optional

import aiohttp

from onyx_client.client import OnyxClient
from onyx_client.configuration.configuration import Configuration
from onyx_client.utils.const import API_URL, API_HEADERS
from onyx_client.utils.response import check
from typing import Optional

from ..client import OnyxClient
from ..configuration.configuration import Configuration
from ..utils.const import API_URL, API_HEADERS
from ..utils.response import check

_LOGGER = logging.getLogger(__name__)

Expand Down
30 changes: 15 additions & 15 deletions onyx_client/client.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
"""Onyx Client API class."""
import json
import logging
from typing import Optional
from random import uniform

import aiohttp
import asyncio

from onyx_client.configuration.configuration import Configuration
from onyx_client.data.date_information import DateInformation
from onyx_client.data.device_command import DeviceCommand
from onyx_client.data.supported_versions import SupportedVersions
from onyx_client.device.device import Device
from onyx_client.enum.action import Action
from onyx_client.enum.device_type import DeviceType
from onyx_client.group.group import Group
from onyx_client.helpers.url import UrlHelper
from onyx_client.utils.const import API_VERSION
from onyx_client.utils.filter import present
from onyx_client.utils.mapper import init_device
from typing import Optional
from random import uniform

from .configuration.configuration import Configuration
from .data.date_information import DateInformation
from .data.device_command import DeviceCommand
from .data.supported_versions import SupportedVersions
from .device.device import Device
from .enum.action import Action
from .enum.device_type import DeviceType
from .group.group import Group
from .helpers.url import UrlHelper
from .utils.const import API_VERSION
from .utils.filter import present
from .utils.mapper import init_device

_LOGGER = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion onyx_client/data/animation_value.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Animation Values of Onyx devices."""
from typing import Optional

from onyx_client.data.animation_keyframe import AnimationKeyframe
from ..data.animation_keyframe import AnimationKeyframe


class AnimationValue:
Expand Down
4 changes: 2 additions & 2 deletions onyx_client/data/device_command.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Device Command for an Onyx device."""
from onyx_client.enum.action import Action
from onyx_client.exception.invalid_command import InvalidCommandException
from ..enum.action import Action
from ..exception.invalid_command import InvalidCommandException


class DeviceCommand:
Expand Down
2 changes: 1 addition & 1 deletion onyx_client/data/device_mode.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Device Mode for an Onyx device."""
from onyx_client.enum.device_type import DeviceType
from ..enum.device_type import DeviceType


class DeviceMode:
Expand Down
2 changes: 1 addition & 1 deletion onyx_client/data/numeric_value.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Numeric Values of Onyx devices."""
from typing import Optional

from onyx_client.data.animation_value import AnimationValue
from ..data.animation_value import AnimationValue


class NumericValue:
Expand Down
6 changes: 3 additions & 3 deletions onyx_client/device/click.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Click class."""
from onyx_client.data.device_mode import DeviceMode
from onyx_client.device.device import Device
from onyx_client.enum.device_type import DeviceType
from ..data.device_mode import DeviceMode
from ..device.device import Device
from ..enum.device_type import DeviceType


class Click(Device):
Expand Down
6 changes: 3 additions & 3 deletions onyx_client/device/device.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Device class."""
from typing import Optional

from onyx_client.data.device_mode import DeviceMode
from onyx_client.enum.device_type import DeviceType
from onyx_client.exception.update_exception import UpdateException
from ..data.device_mode import DeviceMode
from ..enum.device_type import DeviceType
from ..exception.update_exception import UpdateException


class Device:
Expand Down
8 changes: 4 additions & 4 deletions onyx_client/device/light.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Light class."""
from typing import Optional

from onyx_client.data.device_mode import DeviceMode
from onyx_client.data.numeric_value import NumericValue
from onyx_client.device.device import Device
from onyx_client.enum.device_type import DeviceType
from ..data.device_mode import DeviceMode
from ..data.numeric_value import NumericValue
from ..device.device import Device
from ..enum.device_type import DeviceType


class Light(Device):
Expand Down
8 changes: 4 additions & 4 deletions onyx_client/device/shutter.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Shutter class."""
from typing import Optional

from onyx_client.data.device_mode import DeviceMode
from onyx_client.data.numeric_value import NumericValue
from onyx_client.device.device import Device
from onyx_client.enum.device_type import DeviceType
from ..data.device_mode import DeviceMode
from ..data.numeric_value import NumericValue
from ..device.device import Device
from ..enum.device_type import DeviceType


# not mapped properties:
Expand Down
6 changes: 3 additions & 3 deletions onyx_client/device/switch.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Switch class."""
from typing import Optional

from onyx_client.data.device_mode import DeviceMode
from onyx_client.device.device import Device
from onyx_client.enum.device_type import DeviceType
from ..data.device_mode import DeviceMode
from ..device.device import Device
from ..enum.device_type import DeviceType


class Switch(Device):
Expand Down
8 changes: 4 additions & 4 deletions onyx_client/device/weather.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Weather class."""
from typing import Optional

from onyx_client.data.device_mode import DeviceMode
from onyx_client.data.numeric_value import NumericValue
from onyx_client.device.device import Device
from onyx_client.enum.device_type import DeviceType
from ..data.device_mode import DeviceMode
from ..data.numeric_value import NumericValue
from ..device.device import Device
from ..enum.device_type import DeviceType


class Weather(Device):
Expand Down
10 changes: 5 additions & 5 deletions onyx_client/helpers/url.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""Onyx Client URL helper."""
from typing import Optional, Any

import aiohttp

from onyx_client.configuration.configuration import Configuration
from onyx_client.utils.const import API_URL, API_HEADERS, API_VERSION
from onyx_client.utils.response import check
from typing import Optional, Any

from ..configuration.configuration import Configuration
from ..utils.const import API_URL, API_HEADERS, API_VERSION
from ..utils.response import check


class UrlHelper:
Expand Down
12 changes: 6 additions & 6 deletions onyx_client/utils/device_type.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
"""Onyx Client device type utils."""
from typing import Optional

from onyx_client.device.click import Click
from onyx_client.device.light import Light
from onyx_client.device.shutter import Shutter
from onyx_client.device.switch import Switch
from onyx_client.device.weather import Weather
from onyx_client.enum.device_type import DeviceType
from ..device.click import Click
from ..device.light import Light
from ..device.shutter import Shutter
from ..device.switch import Switch
from ..device.weather import Weather
from ..enum.device_type import DeviceType


def is_shutter(device_type: DeviceType, properties: dict) -> bool:
Expand Down
22 changes: 11 additions & 11 deletions onyx_client/utils/mapper.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"""Onyx Client mapper utils."""
from onyx_client.data.boolean_value import BooleanValue
from onyx_client.data.device_mode import DeviceMode
from onyx_client.data.numeric_value import NumericValue
from onyx_client.device.click import Click
from onyx_client.device.device import Device
from onyx_client.device.light import Light
from onyx_client.device.shutter import Shutter
from onyx_client.device.switch import Switch
from onyx_client.device.weather import Weather
from onyx_client.enum.device_type import DeviceType
from onyx_client.utils.device_type import (
from ..data.boolean_value import BooleanValue
from ..data.device_mode import DeviceMode
from ..data.numeric_value import NumericValue
from ..device.click import Click
from ..device.device import Device
from ..device.light import Light
from ..device.shutter import Shutter
from ..device.switch import Switch
from ..device.weather import Weather
from ..enum.device_type import DeviceType
from ..utils.device_type import (
is_click,
is_light,
is_weather,
Expand Down
1 change: 0 additions & 1 deletion onyx_client/utils/response.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Onyx Client response utils."""
import logging

import aiohttp

_LOGGER = logging.getLogger(__name__)
Expand Down
4 changes: 2 additions & 2 deletions tests/authorizer/test_init.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Tests for __init__."""
from unittest.mock import patch

import aiohttp
import pytest

from unittest.mock import patch
from aioresponses import aioresponses

from onyx_client.authorizer import exchange_code, authorize
Expand Down
1 change: 0 additions & 1 deletion tests/group/test_group.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Tests for the Group class."""

from onyx_client.group.group import Group


Expand Down
2 changes: 1 addition & 1 deletion tests/helpers/test_url.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Tests for the Onyx Client URL helper."""

import aiohttp
import pytest
import pytest_asyncio

from aioresponses import aioresponses

from onyx_client.configuration.configuration import Configuration
Expand Down
4 changes: 2 additions & 2 deletions tests/test_client.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""Tests for the Onyx Client."""
from unittest.mock import patch

import aiohttp
import pytest
import pytest_asyncio
import asyncio

from unittest.mock import patch
from aioresponses import aioresponses

from onyx_client.client import create, OnyxClient
Expand Down
1 change: 0 additions & 1 deletion tests/utils/test_filter.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Tests for the filters."""

from onyx_client.utils.filter import present


Expand Down
1 change: 0 additions & 1 deletion tests/utils/test_mapper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Tests for mapper utils."""

from onyx_client.data.boolean_value import BooleanValue
from onyx_client.data.numeric_value import NumericValue
from onyx_client.device.click import Click
Expand Down

0 comments on commit 5be6160

Please sign in to comment.