Replace isort with ruff (#94302)
This commit is contained in:
parent
ed3d38bb17
commit
c3936e6f14
56 changed files with 95 additions and 117 deletions
41
.github/workflows/ci.yaml
vendored
41
.github/workflows/ci.yaml
vendored
|
@ -338,44 +338,6 @@ jobs:
|
|||
shopt -s globstar
|
||||
pre-commit run --hook-stage manual ruff --files {homeassistant,tests}/components/${{ needs.info.outputs.integrations_glob }}/{*,**/*} --show-diff-on-failure
|
||||
|
||||
lint-isort:
|
||||
name: Check isort
|
||||
runs-on: ubuntu-22.04
|
||||
needs:
|
||||
- info
|
||||
- pre-commit
|
||||
steps:
|
||||
- name: Check out code from GitHub
|
||||
uses: actions/checkout@v3.5.2
|
||||
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
|
||||
uses: actions/setup-python@v4.6.1
|
||||
id: python
|
||||
with:
|
||||
python-version: ${{ env.DEFAULT_PYTHON }}
|
||||
check-latest: true
|
||||
- name: Restore base Python virtual environment
|
||||
id: cache-venv
|
||||
uses: actions/cache/restore@v3.3.1
|
||||
with:
|
||||
path: venv
|
||||
fail-on-cache-miss: true
|
||||
key: >-
|
||||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-venv-${{
|
||||
needs.info.outputs.pre-commit_cache_key }}
|
||||
- name: Restore pre-commit environment from cache
|
||||
id: cache-precommit
|
||||
uses: actions/cache/restore@v3.3.1
|
||||
with:
|
||||
path: ${{ env.PRE_COMMIT_CACHE }}
|
||||
fail-on-cache-miss: true
|
||||
key: >-
|
||||
${{ runner.os }}-${{ steps.python.outputs.python-version }}-${{
|
||||
needs.info.outputs.pre-commit_cache_key }}
|
||||
- name: Run isort
|
||||
run: |
|
||||
. venv/bin/activate
|
||||
pre-commit run --hook-stage manual isort --all-files --show-diff-on-failure
|
||||
|
||||
lint-other:
|
||||
name: Check other linters
|
||||
runs-on: ubuntu-22.04
|
||||
|
@ -719,7 +681,6 @@ jobs:
|
|||
- base
|
||||
- gen-requirements-all
|
||||
- hassfest
|
||||
- lint-isort
|
||||
- lint-other
|
||||
- lint-ruff
|
||||
- mypy
|
||||
|
@ -844,7 +805,6 @@ jobs:
|
|||
- base
|
||||
- gen-requirements-all
|
||||
- hassfest
|
||||
- lint-isort
|
||||
- lint-other
|
||||
- lint-ruff
|
||||
- mypy
|
||||
|
@ -952,7 +912,6 @@ jobs:
|
|||
- base
|
||||
- gen-requirements-all
|
||||
- hassfest
|
||||
- lint-isort
|
||||
- lint-other
|
||||
- lint-ruff
|
||||
- mypy
|
||||
|
|
|
@ -22,10 +22,6 @@ repos:
|
|||
- --quiet-level=2
|
||||
exclude_types: [csv, json]
|
||||
exclude: ^tests/fixtures/|homeassistant/generated/
|
||||
- repo: https://github.com/PyCQA/isort
|
||||
rev: 5.12.0
|
||||
hooks:
|
||||
- id: isort
|
||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||
rev: v4.4.0
|
||||
hooks:
|
||||
|
|
|
@ -13,8 +13,8 @@ from homeassistant.const import CONF_COMMAND
|
|||
from homeassistant.data_entry_flow import FlowResult
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
|
||||
from . import AUTH_PROVIDER_SCHEMA, AUTH_PROVIDERS, AuthProvider, LoginFlow
|
||||
from ..models import Credentials, UserMeta
|
||||
from . import AUTH_PROVIDER_SCHEMA, AUTH_PROVIDERS, AuthProvider, LoginFlow
|
||||
|
||||
CONF_ARGS = "args"
|
||||
CONF_META = "meta"
|
||||
|
|
|
@ -16,8 +16,8 @@ from homeassistant.data_entry_flow import FlowResult
|
|||
from homeassistant.exceptions import HomeAssistantError
|
||||
from homeassistant.helpers.storage import Store
|
||||
|
||||
from . import AUTH_PROVIDER_SCHEMA, AUTH_PROVIDERS, AuthProvider, LoginFlow
|
||||
from ..models import Credentials, UserMeta
|
||||
from . import AUTH_PROVIDER_SCHEMA, AUTH_PROVIDERS, AuthProvider, LoginFlow
|
||||
|
||||
STORAGE_VERSION = 1
|
||||
STORAGE_KEY = "auth_provider.homeassistant"
|
||||
|
|
|
@ -11,8 +11,8 @@ from homeassistant.core import callback
|
|||
from homeassistant.data_entry_flow import FlowResult
|
||||
from homeassistant.exceptions import HomeAssistantError
|
||||
|
||||
from . import AUTH_PROVIDER_SCHEMA, AUTH_PROVIDERS, AuthProvider, LoginFlow
|
||||
from ..models import Credentials, UserMeta
|
||||
from . import AUTH_PROVIDER_SCHEMA, AUTH_PROVIDERS, AuthProvider, LoginFlow
|
||||
|
||||
USER_SCHEMA = vol.Schema(
|
||||
{
|
||||
|
|
|
@ -15,8 +15,8 @@ from homeassistant.data_entry_flow import FlowResult
|
|||
from homeassistant.exceptions import HomeAssistantError
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
from . import AUTH_PROVIDER_SCHEMA, AUTH_PROVIDERS, AuthProvider, LoginFlow
|
||||
from ..models import Credentials, UserMeta
|
||||
from . import AUTH_PROVIDER_SCHEMA, AUTH_PROVIDERS, AuthProvider, LoginFlow
|
||||
|
||||
AUTH_PROVIDER_TYPE = "legacy_api_password"
|
||||
CONF_API_PASSWORD = "api_password"
|
||||
|
|
|
@ -23,9 +23,9 @@ from homeassistant.data_entry_flow import FlowResult
|
|||
from homeassistant.exceptions import HomeAssistantError
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
from . import AUTH_PROVIDER_SCHEMA, AUTH_PROVIDERS, AuthProvider, LoginFlow
|
||||
from .. import InvalidAuthError
|
||||
from ..models import Credentials, RefreshToken, UserMeta
|
||||
from . import AUTH_PROVIDER_SCHEMA, AUTH_PROVIDERS, AuthProvider, LoginFlow
|
||||
|
||||
IPAddress = IPv4Address | IPv6Address
|
||||
IPNetwork = IPv4Network | IPv6Network
|
||||
|
|
|
@ -10,6 +10,7 @@ import homeassistant.helpers.config_validation as cv
|
|||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType, StateType
|
||||
|
||||
from .. import ads
|
||||
from . import (
|
||||
ADS_TYPEMAP,
|
||||
CONF_ADS_FACTOR,
|
||||
|
@ -18,7 +19,6 @@ from . import (
|
|||
STATE_KEY_STATE,
|
||||
AdsEntity,
|
||||
)
|
||||
from .. import ads
|
||||
|
||||
DEFAULT_NAME = "ADS sensor"
|
||||
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
|
||||
|
|
|
@ -3,10 +3,10 @@ import asyncio
|
|||
import io
|
||||
import logging
|
||||
|
||||
from PIL import UnidentifiedImageError
|
||||
import aiohttp
|
||||
import async_timeout
|
||||
from colorthief import ColorThief
|
||||
from PIL import UnidentifiedImageError
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.light import (
|
||||
|
|
|
@ -9,10 +9,10 @@ import io
|
|||
import logging
|
||||
from typing import Any
|
||||
|
||||
import PIL
|
||||
from aiohttp import web
|
||||
from async_timeout import timeout
|
||||
from httpx import HTTPStatusError, RequestError, TimeoutException
|
||||
import PIL
|
||||
import voluptuous as vol
|
||||
import yarl
|
||||
|
||||
|
|
|
@ -28,10 +28,10 @@ from .const import ( # noqa: F401
|
|||
DEFAULT_EXPOSE_BY_DEFAULT,
|
||||
DEFAULT_EXPOSED_DOMAINS,
|
||||
DOMAIN,
|
||||
EVENT_QUERY_RECEIVED, # noqa: F401
|
||||
SERVICE_REQUEST_SYNC,
|
||||
SOURCE_CLOUD,
|
||||
)
|
||||
from .const import EVENT_QUERY_RECEIVED # noqa: F401
|
||||
from .http import GoogleAssistantView, GoogleConfig
|
||||
|
||||
from .const import EVENT_COMMAND_RECEIVED, EVENT_SYNC_RECEIVED # noqa: F401, isort:skip
|
||||
|
|
|
@ -8,7 +8,6 @@ from urllib.parse import urlparse
|
|||
|
||||
from huawei_lte_api.Client import Client
|
||||
from huawei_lte_api.Connection import Connection
|
||||
from huawei_lte_api.Session import GetResponseType
|
||||
from huawei_lte_api.exceptions import (
|
||||
LoginErrorPasswordWrongException,
|
||||
LoginErrorUsernamePasswordOverrunException,
|
||||
|
@ -16,6 +15,7 @@ from huawei_lte_api.exceptions import (
|
|||
LoginErrorUsernameWrongException,
|
||||
ResponseErrorException,
|
||||
)
|
||||
from huawei_lte_api.Session import GetResponseType
|
||||
from requests.exceptions import Timeout
|
||||
from url_normalize import url_normalize
|
||||
import voluptuous as vol
|
||||
|
|
|
@ -8,9 +8,9 @@ import secrets
|
|||
import shutil
|
||||
from typing import Any
|
||||
|
||||
from PIL import Image, ImageOps, UnidentifiedImageError
|
||||
from aiohttp import hdrs, web
|
||||
from aiohttp.web_request import FileField
|
||||
from PIL import Image, ImageOps, UnidentifiedImageError
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.http.static import CACHE_HEADERS
|
||||
|
|
|
@ -14,6 +14,7 @@ from . import websocket_api
|
|||
from .const import (
|
||||
ATTR_LEVEL,
|
||||
DOMAIN,
|
||||
EVENT_LOGGING_CHANGED, # noqa: F401
|
||||
LOGGER_DEFAULT,
|
||||
LOGGER_FILTERS,
|
||||
LOGGER_LOGS,
|
||||
|
@ -21,7 +22,6 @@ from .const import (
|
|||
SERVICE_SET_DEFAULT_LEVEL,
|
||||
SERVICE_SET_LEVEL,
|
||||
)
|
||||
from .const import EVENT_LOGGING_CHANGED # noqa: F401
|
||||
from .helpers import (
|
||||
LoggerDomainConfig,
|
||||
LoggerSettings,
|
||||
|
|
|
@ -8,8 +8,8 @@ import attr
|
|||
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
from . import debug_info
|
||||
from .. import mqtt
|
||||
from . import debug_info
|
||||
from .const import DEFAULT_QOS
|
||||
from .models import MessageCallbackType
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Automation manager for boards manufactured by ProgettiHWSW Italy."""
|
||||
|
||||
from ProgettiHWSW.ProgettiHWSWAPI import ProgettiHWSWAPI
|
||||
from ProgettiHWSW.input import Input
|
||||
from ProgettiHWSW.ProgettiHWSWAPI import ProgettiHWSWAPI
|
||||
from ProgettiHWSW.relay import Relay
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
from datetime import timedelta
|
||||
import logging
|
||||
|
||||
from ProgettiHWSW.input import Input
|
||||
import async_timeout
|
||||
from ProgettiHWSW.input import Input
|
||||
|
||||
from homeassistant.components.binary_sensor import BinarySensorEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
|
|
@ -3,8 +3,8 @@ from datetime import timedelta
|
|||
import logging
|
||||
from typing import Any
|
||||
|
||||
from ProgettiHWSW.relay import Relay
|
||||
import async_timeout
|
||||
from ProgettiHWSW.relay import Relay
|
||||
|
||||
from homeassistant.components.switch import SwitchEntity
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
|
|
@ -10,11 +10,11 @@ from sqlalchemy.orm.session import Session
|
|||
from homeassistant.core import Event
|
||||
from homeassistant.util.json import JSON_ENCODE_EXCEPTIONS
|
||||
|
||||
from . import BaseLRUTableManager
|
||||
from ..const import SQLITE_MAX_BIND_VARS
|
||||
from ..db_schema import EventData
|
||||
from ..queries import get_shared_event_datas
|
||||
from ..util import chunked, execute_stmt_lambda_element
|
||||
from . import BaseLRUTableManager
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..core import Recorder
|
||||
|
|
|
@ -9,12 +9,12 @@ from sqlalchemy.orm.session import Session
|
|||
|
||||
from homeassistant.core import Event
|
||||
|
||||
from . import BaseLRUTableManager
|
||||
from ..const import SQLITE_MAX_BIND_VARS
|
||||
from ..db_schema import EventTypes
|
||||
from ..queries import find_event_type_ids
|
||||
from ..tasks import RefreshEventTypesTask
|
||||
from ..util import chunked, execute_stmt_lambda_element
|
||||
from . import BaseLRUTableManager
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..core import Recorder
|
||||
|
|
|
@ -11,11 +11,11 @@ from homeassistant.core import Event
|
|||
from homeassistant.helpers.entity import entity_sources
|
||||
from homeassistant.util.json import JSON_ENCODE_EXCEPTIONS
|
||||
|
||||
from . import BaseLRUTableManager
|
||||
from ..const import SQLITE_MAX_BIND_VARS
|
||||
from ..db_schema import StateAttributes
|
||||
from ..queries import get_shared_attributes
|
||||
from ..util import chunked, execute_stmt_lambda_element
|
||||
from . import BaseLRUTableManager
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..core import Recorder
|
||||
|
|
|
@ -8,11 +8,11 @@ from sqlalchemy.orm.session import Session
|
|||
|
||||
from homeassistant.core import Event
|
||||
|
||||
from . import BaseLRUTableManager
|
||||
from ..const import SQLITE_MAX_BIND_VARS
|
||||
from ..db_schema import StatesMeta
|
||||
from ..queries import find_all_states_metadata_ids, find_states_metadata_ids
|
||||
from ..util import chunked, execute_stmt_lambda_element
|
||||
from . import BaseLRUTableManager
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..core import Recorder
|
||||
|
|
|
@ -11,6 +11,7 @@ import homeassistant.helpers.config_validation as cv
|
|||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from .. import remote_rpi_gpio
|
||||
from . import (
|
||||
CONF_BOUNCETIME,
|
||||
CONF_INVERT_LOGIC,
|
||||
|
@ -19,7 +20,6 @@ from . import (
|
|||
DEFAULT_INVERT_LOGIC,
|
||||
DEFAULT_PULL_MODE,
|
||||
)
|
||||
from .. import remote_rpi_gpio
|
||||
|
||||
CONF_PORTS = "ports"
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ import homeassistant.helpers.config_validation as cv
|
|||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
|
||||
|
||||
from . import CONF_INVERT_LOGIC, DEFAULT_INVERT_LOGIC
|
||||
from .. import remote_rpi_gpio
|
||||
from . import CONF_INVERT_LOGIC, DEFAULT_INVERT_LOGIC
|
||||
|
||||
CONF_PORTS = "ports"
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ import copy
|
|||
import logging
|
||||
from typing import Any, NamedTuple, cast
|
||||
|
||||
import RFXtrx as rfxtrxmod
|
||||
import async_timeout
|
||||
import RFXtrx as rfxtrxmod
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
|
|
|
@ -8,8 +8,8 @@ import itertools
|
|||
import os
|
||||
from typing import Any, TypedDict, cast
|
||||
|
||||
import RFXtrx as rfxtrxmod
|
||||
from async_timeout import timeout
|
||||
import RFXtrx as rfxtrxmod
|
||||
import serial
|
||||
import serial.tools.list_ports
|
||||
import voluptuous as vol
|
||||
|
|
|
@ -8,8 +8,8 @@ from homeassistant.core import HomeAssistant
|
|||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
from . import TelldusLiveClient
|
||||
from .. import tellduslive
|
||||
from . import TelldusLiveClient
|
||||
from .entry import TelldusLiveEntity
|
||||
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@ import os
|
|||
import sys
|
||||
import time
|
||||
|
||||
from PIL import Image, ImageDraw, UnidentifiedImageError
|
||||
import numpy as np
|
||||
from PIL import Image, ImageDraw, UnidentifiedImageError
|
||||
import tensorflow as tf # pylint: disable=import-error
|
||||
import voluptuous as vol
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""Support for w800rf32 devices."""
|
||||
import logging
|
||||
|
||||
import W800rf32 as w800
|
||||
import voluptuous as vol
|
||||
import W800rf32 as w800
|
||||
|
||||
from homeassistant.const import (
|
||||
CONF_DEVICE,
|
||||
|
|
|
@ -3,8 +3,8 @@ from __future__ import annotations
|
|||
|
||||
import logging
|
||||
|
||||
import W800rf32 as w800
|
||||
import voluptuous as vol
|
||||
import W800rf32 as w800
|
||||
|
||||
from homeassistant.components.binary_sensor import (
|
||||
DEVICE_CLASSES_SCHEMA,
|
||||
|
|
|
@ -3,9 +3,9 @@ from zigpy.zcl.clusters import closures
|
|||
|
||||
from homeassistant.core import callback
|
||||
|
||||
from . import AttrReportConfig, ClientClusterHandler, ClusterHandler
|
||||
from .. import registries
|
||||
from ..const import REPORT_CONFIG_IMMEDIATE, SIGNAL_ATTR_UPDATED
|
||||
from . import AttrReportConfig, ClientClusterHandler, ClusterHandler
|
||||
|
||||
|
||||
@registries.ZIGBEE_CLUSTER_HANDLER_REGISTRY.register(closures.DoorLock.cluster_id)
|
||||
|
|
|
@ -14,12 +14,6 @@ from zigpy.zcl.foundation import Status
|
|||
from homeassistant.core import callback
|
||||
from homeassistant.helpers.event import async_call_later
|
||||
|
||||
from . import (
|
||||
AttrReportConfig,
|
||||
ClientClusterHandler,
|
||||
ClusterHandler,
|
||||
parse_and_log_command,
|
||||
)
|
||||
from .. import registries
|
||||
from ..const import (
|
||||
REPORT_CONFIG_ASAP,
|
||||
|
@ -33,6 +27,12 @@ from ..const import (
|
|||
SIGNAL_SET_LEVEL,
|
||||
SIGNAL_UPDATE_DEVICE,
|
||||
)
|
||||
from . import (
|
||||
AttrReportConfig,
|
||||
ClientClusterHandler,
|
||||
ClusterHandler,
|
||||
parse_and_log_command,
|
||||
)
|
||||
from .helpers import is_hue_motion_sensor
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
|
|
@ -5,7 +5,6 @@ import enum
|
|||
|
||||
from zigpy.zcl.clusters import homeautomation
|
||||
|
||||
from . import AttrReportConfig, ClusterHandler
|
||||
from .. import registries
|
||||
from ..const import (
|
||||
CLUSTER_HANDLER_ELECTRICAL_MEASUREMENT,
|
||||
|
@ -13,6 +12,7 @@ from ..const import (
|
|||
REPORT_CONFIG_OP,
|
||||
SIGNAL_ATTR_UPDATED,
|
||||
)
|
||||
from . import AttrReportConfig, ClusterHandler
|
||||
|
||||
|
||||
@registries.ZIGBEE_CLUSTER_HANDLER_REGISTRY.register(
|
||||
|
|
|
@ -14,7 +14,6 @@ from zigpy.zcl.foundation import Status
|
|||
|
||||
from homeassistant.core import callback
|
||||
|
||||
from . import AttrReportConfig, ClusterHandler
|
||||
from .. import registries
|
||||
from ..const import (
|
||||
REPORT_CONFIG_MAX_INT,
|
||||
|
@ -22,6 +21,7 @@ from ..const import (
|
|||
REPORT_CONFIG_OP,
|
||||
SIGNAL_ATTR_UPDATED,
|
||||
)
|
||||
from . import AttrReportConfig, ClusterHandler
|
||||
|
||||
AttributeUpdateRecord = namedtuple("AttributeUpdateRecord", "attr_id, attr_name, value")
|
||||
REPORT_CONFIG_CLIMATE = (REPORT_CONFIG_MIN_INT, REPORT_CONFIG_MAX_INT, 25)
|
||||
|
|
|
@ -5,9 +5,9 @@ from functools import cached_property
|
|||
|
||||
from zigpy.zcl.clusters import lighting
|
||||
|
||||
from . import AttrReportConfig, ClientClusterHandler, ClusterHandler
|
||||
from .. import registries
|
||||
from ..const import REPORT_CONFIG_DEFAULT
|
||||
from . import AttrReportConfig, ClientClusterHandler, ClusterHandler
|
||||
|
||||
|
||||
@registries.ZIGBEE_CLUSTER_HANDLER_REGISTRY.register(lighting.Ballast.cluster_id)
|
||||
|
|
|
@ -5,8 +5,8 @@ import zigpy.exceptions
|
|||
from zigpy.zcl.clusters import lightlink
|
||||
from zigpy.zcl.foundation import GENERAL_COMMANDS, GeneralCommand
|
||||
|
||||
from . import ClusterHandler, ClusterHandlerStatus
|
||||
from .. import registries
|
||||
from . import ClusterHandler, ClusterHandlerStatus
|
||||
|
||||
|
||||
@registries.CLUSTER_HANDLER_ONLY_CLUSTERS.register(lightlink.LightLink.cluster_id)
|
||||
|
|
|
@ -10,7 +10,6 @@ import zigpy.zcl
|
|||
|
||||
from homeassistant.core import callback
|
||||
|
||||
from . import AttrReportConfig, ClientClusterHandler, ClusterHandler
|
||||
from .. import registries
|
||||
from ..const import (
|
||||
ATTR_ATTRIBUTE_ID,
|
||||
|
@ -24,6 +23,7 @@ from ..const import (
|
|||
SIGNAL_ATTR_UPDATED,
|
||||
UNKNOWN,
|
||||
)
|
||||
from . import AttrReportConfig, ClientClusterHandler, ClusterHandler
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..endpoint import Endpoint
|
||||
|
|
|
@ -6,7 +6,6 @@ from typing import TYPE_CHECKING
|
|||
import zigpy.zcl
|
||||
from zigpy.zcl.clusters import measurement
|
||||
|
||||
from . import AttrReportConfig, ClusterHandler
|
||||
from .. import registries
|
||||
from ..const import (
|
||||
REPORT_CONFIG_DEFAULT,
|
||||
|
@ -14,6 +13,7 @@ from ..const import (
|
|||
REPORT_CONFIG_MAX_INT,
|
||||
REPORT_CONFIG_MIN_INT,
|
||||
)
|
||||
from . import AttrReportConfig, ClusterHandler
|
||||
from .helpers import is_hue_motion_sensor
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""Protocol cluster handlers module for Zigbee Home Automation."""
|
||||
from zigpy.zcl.clusters import protocol
|
||||
|
||||
from . import ClusterHandler
|
||||
from .. import registries
|
||||
from . import ClusterHandler
|
||||
|
||||
|
||||
@registries.ZIGBEE_CLUSTER_HANDLER_REGISTRY.register(
|
||||
|
|
|
@ -15,7 +15,6 @@ from zigpy.zcl.clusters.security import IasAce as AceCluster, IasZone
|
|||
|
||||
from homeassistant.core import callback
|
||||
|
||||
from . import ClusterHandler, ClusterHandlerStatus
|
||||
from .. import registries
|
||||
from ..const import (
|
||||
SIGNAL_ATTR_UPDATED,
|
||||
|
@ -25,6 +24,7 @@ from ..const import (
|
|||
WARNING_DEVICE_STROBE_HIGH,
|
||||
WARNING_DEVICE_STROBE_YES,
|
||||
)
|
||||
from . import ClusterHandler, ClusterHandlerStatus
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..endpoint import Endpoint
|
||||
|
|
|
@ -8,7 +8,6 @@ from typing import TYPE_CHECKING
|
|||
import zigpy.zcl
|
||||
from zigpy.zcl.clusters import smartenergy
|
||||
|
||||
from . import AttrReportConfig, ClusterHandler
|
||||
from .. import registries
|
||||
from ..const import (
|
||||
REPORT_CONFIG_ASAP,
|
||||
|
@ -16,6 +15,7 @@ from ..const import (
|
|||
REPORT_CONFIG_OP,
|
||||
SIGNAL_ATTR_UPDATED,
|
||||
)
|
||||
from . import AttrReportConfig, ClusterHandler
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..endpoint import Endpoint
|
||||
|
|
|
@ -16,7 +16,6 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
|||
from homeassistant.helpers.entity_registry import async_entries_for_device
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from . import const as zha_const, registries as zha_regs
|
||||
from .. import ( # noqa: F401 pylint: disable=unused-import,
|
||||
alarm_control_panel,
|
||||
binary_sensor,
|
||||
|
@ -33,6 +32,7 @@ from .. import ( # noqa: F401 pylint: disable=unused-import,
|
|||
siren,
|
||||
switch,
|
||||
)
|
||||
from . import const as zha_const, registries as zha_regs
|
||||
|
||||
# importing cluster handlers updates registries
|
||||
from .cluster_handlers import ( # noqa: F401 pylint: disable=unused-import,
|
||||
|
|
7
pylint/ruff.toml
Normal file
7
pylint/ruff.toml
Normal file
|
@ -0,0 +1,7 @@
|
|||
# This extend our general Ruff rules specifically for tests
|
||||
extend = "../pyproject.toml"
|
||||
|
||||
[isort]
|
||||
known-third-party = [
|
||||
"pylint",
|
||||
]
|
|
@ -77,20 +77,6 @@ include = ["homeassistant*"]
|
|||
[tool.black]
|
||||
extend-exclude = "/generated/"
|
||||
|
||||
[tool.isort]
|
||||
# https://github.com/PyCQA/isort/wiki/isort-Settings
|
||||
profile = "black"
|
||||
# will group `import x` and `from x import` of the same module.
|
||||
force_sort_within_sections = true
|
||||
known_first_party = [
|
||||
"homeassistant",
|
||||
"tests",
|
||||
]
|
||||
forced_separate = [
|
||||
"tests",
|
||||
]
|
||||
combine_as_imports = true
|
||||
|
||||
[tool.pylint.MAIN]
|
||||
py-version = "3.10"
|
||||
ignore = [
|
||||
|
@ -248,6 +234,7 @@ select = [
|
|||
"D", # docstrings
|
||||
"E", # pycodestyle
|
||||
"F", # pyflakes/autoflake
|
||||
"I", # isort
|
||||
"ICN001", # import concentions; {name} should be imported as {asname}
|
||||
"PGH004", # Use specific rule codes when using noqa
|
||||
"PLC0414", # Useless import alias. Import alias does not rename original package.
|
||||
|
@ -308,6 +295,13 @@ voluptuous = "vol"
|
|||
[tool.ruff.flake8-pytest-style]
|
||||
fixture-parentheses = false
|
||||
|
||||
[tool.ruff.isort]
|
||||
force-sort-within-sections = true
|
||||
known-first-party = [
|
||||
"homeassistant",
|
||||
]
|
||||
combine-as-imports = true
|
||||
|
||||
[tool.ruff.per-file-ignores]
|
||||
|
||||
# Allow for main entry & scripts to write to stdout
|
||||
|
|
|
@ -2,6 +2,5 @@
|
|||
|
||||
black==23.3.0
|
||||
codespell==2.2.2
|
||||
isort==5.12.0
|
||||
ruff==0.0.272
|
||||
yamllint==1.28.0
|
||||
|
|
7
script/ruff.toml
Normal file
7
script/ruff.toml
Normal file
|
@ -0,0 +1,7 @@
|
|||
# This extend our general Ruff rules specifically for tests
|
||||
extend = "../pyproject.toml"
|
||||
|
||||
[isort]
|
||||
forced-separate = [
|
||||
"tests",
|
||||
]
|
|
@ -5,15 +5,15 @@ from unittest.mock import patch
|
|||
import pytest
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.components.application_credentials import (
|
||||
ClientCredential,
|
||||
async_import_client_credential,
|
||||
)
|
||||
from homeassistant.components.NEW_DOMAIN.const import (
|
||||
DOMAIN,
|
||||
OAUTH2_AUTHORIZE,
|
||||
OAUTH2_TOKEN,
|
||||
)
|
||||
from homeassistant.components.application_credentials import (
|
||||
ClientCredential,
|
||||
async_import_client_credential,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import config_entry_oauth2_flow
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
import pytest
|
||||
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.NEW_DOMAIN import DOMAIN
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.NEW_DOMAIN import DOMAIN
|
||||
from homeassistant.const import EntityCategory
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
|
|
@ -4,8 +4,8 @@ from __future__ import annotations
|
|||
import pytest
|
||||
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.NEW_DOMAIN import DOMAIN
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.NEW_DOMAIN import DOMAIN
|
||||
from homeassistant.const import STATE_OFF, STATE_ON
|
||||
from homeassistant.core import HomeAssistant, ServiceCall
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
import pytest
|
||||
|
||||
from homeassistant.components import automation
|
||||
from homeassistant.components.NEW_DOMAIN import DOMAIN
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.components.NEW_DOMAIN import DOMAIN
|
||||
from homeassistant.const import STATE_OFF, STATE_ON
|
||||
from homeassistant.core import HomeAssistant, ServiceCall
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
|
|
|
@ -3,8 +3,8 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any, NamedTuple
|
||||
|
||||
import RFXtrx
|
||||
import pytest
|
||||
import RFXtrx
|
||||
|
||||
import homeassistant.components.automation as automation
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
|
|
|
@ -4,8 +4,8 @@ from __future__ import annotations
|
|||
from collections.abc import AsyncGenerator, Generator
|
||||
from unittest.mock import AsyncMock, Mock, patch
|
||||
|
||||
from PyViCare.PyViCareDeviceConfig import PyViCareDeviceConfig
|
||||
import pytest
|
||||
from PyViCare.PyViCareDeviceConfig import PyViCareDeviceConfig
|
||||
|
||||
from homeassistant.components.vicare.const import DOMAIN
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""Test the ViCare config flow."""
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
from PyViCare.PyViCareUtils import PyViCareInvalidCredentialsError
|
||||
import pytest
|
||||
from PyViCare.PyViCareUtils import PyViCareInvalidCredentialsError
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components import dhcp
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""Fixtures for Waze Travel Time tests."""
|
||||
from unittest.mock import patch
|
||||
|
||||
from WazeRouteCalculator import WRCError
|
||||
import pytest
|
||||
from WazeRouteCalculator import WRCError
|
||||
|
||||
|
||||
@pytest.fixture(name="mock_wrc", autouse=True)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
"""Test Waze Travel Time sensors."""
|
||||
from WazeRouteCalculator import WRCError
|
||||
import pytest
|
||||
from WazeRouteCalculator import WRCError
|
||||
|
||||
from homeassistant.components.waze_travel_time.const import (
|
||||
CONF_AVOID_FERRIES,
|
||||
|
|
|
@ -10,4 +10,20 @@ extend-select = [
|
|||
"PT015", # Assertion always fails, replace with pytest.fail()
|
||||
"PT021", # use yield instead of request.addfinalizer
|
||||
"PT022", # No teardown in fixture, replace useless yield with return
|
||||
]
|
||||
|
||||
[isort]
|
||||
known-first-party = [
|
||||
"homeassistant",
|
||||
"tests",
|
||||
"script",
|
||||
]
|
||||
known-third-party = [
|
||||
"syrupy",
|
||||
"pytest",
|
||||
"voluptuous",
|
||||
"pylint",
|
||||
]
|
||||
forced-separate = [
|
||||
"tests",
|
||||
]
|
Loading…
Add table
Reference in a new issue