Skip to content

Commit

Permalink
Use isort instead of reorder-python-imports because of incompatibilit…
Browse files Browse the repository at this point in the history
…y with black
  • Loading branch information
amosyuen committed Jan 1, 2025
1 parent 3fdee90 commit 44c4f20
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 33 deletions.
7 changes: 3 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ repos:
language: system
types: [python]
require_serial: true
- id: reorder-python-imports
name: Reorder python imports
entry: reorder-python-imports
- id: isort
name: ISort
entry: isort
language: system
types: [python]
args: [--application-directories=custom_components]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.2.1
hooks:
Expand Down
13 changes: 7 additions & 6 deletions custom_components/tplink_deco/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@
For more details about this integration, please refer to
https://github.com/amosyuen/ha-tplink-deco
"""

import asyncio
import logging
from datetime import timedelta
import logging
from typing import Any
from typing import cast

import homeassistant.helpers.config_validation as cv
import voluptuous as vol
from homeassistant.components.device_tracker.const import CONF_CONSIDER_HOME
from homeassistant.components.device_tracker.const import CONF_SCAN_INTERVAL
from homeassistant.components.device_tracker.const import (
DOMAIN as DEVICE_TRACKER_DOMAIN,
)
from homeassistant.components.device_tracker.const import CONF_CONSIDER_HOME
from homeassistant.components.device_tracker.const import CONF_SCAN_INTERVAL
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_DEVICE_ID
from homeassistant.const import CONF_HOST
Expand All @@ -28,6 +27,8 @@
from homeassistant.helpers import entity_registry
from homeassistant.helpers import restore_state
from homeassistant.helpers.aiohttp_client import async_get_clientsession
import homeassistant.helpers.config_validation as cv
import voluptuous as vol

from .api import TplinkDecoApi
from .const import ATTR_DEVICE_TYPE
Expand All @@ -51,8 +52,8 @@
from .const import SERVICE_REBOOT_DECO
from .coordinator import TpLinkDeco
from .coordinator import TpLinkDecoClient
from .coordinator import TplinkDecoClientUpdateCoordinator
from .coordinator import TpLinkDecoData
from .coordinator import TplinkDecoClientUpdateCoordinator
from .coordinator import TplinkDecoUpdateCoordinator

_LOGGER: logging.Logger = logging.getLogger(__name__)
Expand Down
8 changes: 4 additions & 4 deletions custom_components/tplink_deco/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
from typing import Any
from urllib.parse import quote_plus

from Crypto.Cipher import PKCS1_v1_5
from Crypto.PublicKey import RSA
import aiohttp
import async_timeout
from aiohttp.hdrs import CONTENT_TYPE
from aiohttp.hdrs import COOKIE
from aiohttp.hdrs import SET_COOKIE
from Crypto.Cipher import PKCS1_v1_5
from Crypto.PublicKey import RSA
import async_timeout
from cryptography.hazmat.primitives import padding
from cryptography.hazmat.primitives.ciphers import algorithms
from cryptography.hazmat.primitives.ciphers import Cipher
from cryptography.hazmat.primitives.ciphers import algorithms
from cryptography.hazmat.primitives.ciphers import modes

from .const import DEFAULT_TIMEOUT_ERROR_RETRIES
Expand Down
9 changes: 4 additions & 5 deletions custom_components/tplink_deco/config_flow.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
"""Adds config flow for TP-Link Deco."""

import asyncio
import logging
from typing import Any

import voluptuous as vol
from homeassistant import config_entries
from homeassistant.components.device_tracker.const import CONF_CONSIDER_HOME
from homeassistant.components.device_tracker.const import CONF_SCAN_INTERVAL
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_HOST
from homeassistant.const import (
CONF_PASSWORD,
)
from homeassistant.const import CONF_PASSWORD
from homeassistant.const import CONF_USERNAME
from homeassistant.core import callback
from homeassistant.core import HomeAssistant
from homeassistant.core import callback
from homeassistant.exceptions import ConfigEntryAuthFailed
from homeassistant.exceptions import ConfigEntryNotReady
import voluptuous as vol

from .__init__ import async_create_and_refresh_coordinators
from .const import CONF_CLIENT_POSTFIX
Expand Down
1 change: 1 addition & 0 deletions custom_components/tplink_deco/const.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Constants for TP-Link Deco."""

from homeassistant.components.device_tracker import DOMAIN as DEVICE_TRACKER_DOMAIN
from homeassistant.components.device_tracker.const import (
DEFAULT_CONSIDER_HOME as DEFAULT_CONSIDER_HOME_SPAN,
Expand Down
7 changes: 4 additions & 3 deletions custom_components/tplink_deco/coordinator.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
"""TP-Link Deco Coordinator"""

import asyncio
import ipaddress
import logging
from collections.abc import Callable
from datetime import datetime
from datetime import timedelta
import ipaddress
import logging
from typing import Any

from homeassistant.core import callback
from homeassistant.core import CALLBACK_TYPE
from homeassistant.core import HomeAssistant
from homeassistant.core import callback
from homeassistant.exceptions import ConfigEntryAuthFailed
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator
Expand Down
1 change: 1 addition & 0 deletions custom_components/tplink_deco/device.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""TP-Link Deco."""

from homeassistant.const import ATTR_VIA_DEVICE
from homeassistant.helpers.entity import DeviceInfo

Expand Down
7 changes: 3 additions & 4 deletions custom_components/tplink_deco/device_tracker.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""TP-Link Deco."""

import logging
from typing import Any

Expand All @@ -8,8 +9,8 @@
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import ATTR_HW_VERSION
from homeassistant.const import ATTR_SW_VERSION
from homeassistant.core import callback
from homeassistant.core import HomeAssistant
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.restore_state import RestoreEntity
Expand All @@ -33,9 +34,7 @@
from .const import CONF_CLIENT_PREFIX
from .const import CONF_DECO_POSTFIX
from .const import CONF_DECO_PREFIX
from .const import (
COORDINATOR_CLIENTS_KEY,
)
from .const import COORDINATOR_CLIENTS_KEY
from .const import COORDINATOR_DECOS_KEY
from .const import DEVICE_TYPE_CLIENT
from .const import DEVICE_TYPE_DECO
Expand Down
7 changes: 3 additions & 4 deletions custom_components/tplink_deco/sensor.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
"""TP-Link Deco."""

import logging

from homeassistant.components.sensor import SensorEntity
from homeassistant.components.sensor.const import SensorDeviceClass
from homeassistant.components.sensor.const import SensorStateClass
from homeassistant.config_entries import ConfigEntry
from homeassistant.const import UnitOfDataRate
from homeassistant.core import callback
from homeassistant.core import HomeAssistant
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity import DeviceInfo
from homeassistant.helpers.update_coordinator import CoordinatorEntity

from .const import (
COORDINATOR_CLIENTS_KEY,
)
from .const import COORDINATOR_CLIENTS_KEY
from .const import COORDINATOR_DECOS_KEY
from .const import DOMAIN
from .const import SIGNAL_DECO_ADDED
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ black==24.10.0
colorlog==6.9.0
flake8==7.1.1
homeassistant==2023.6.0
isort==5.13.2
pip>=21.0,<24.4
pre-commit==4.0.1
reorder-python-imports==3.14.0
ruff==0.8.4
4 changes: 2 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ ignore =
# https://github.com/timothycrosley/isort/wiki/isort-Settings
# splits long import on multiple lines indented by 4 spaces
multi_line_output = 3
profile=black
force_single_line=True
include_trailing_comma=True
force_grid_wrap=0
use_parentheses=True
Expand All @@ -29,8 +31,6 @@ indent = " "
not_skip = __init__.py
# will group `import x` and `from x import` of the same module.
force_sort_within_sections = true
sections = FUTURE,STDLIB,INBETWEENS,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
default_section = THIRDPARTY
known_first_party = custom_components.tplink_deco
combine_as_imports = true

Expand Down

0 comments on commit 44c4f20

Please sign in to comment.