mirror of
https://github.com/home-assistant/core.git
synced 2025-04-29 11:47:50 +00:00
Sort imports according to PEP8 for components starting with "Z" (#29784)
* use isort to sort imports for components starting with 'z' * add skip to end of zha/core/channels/__init__.py * put 'pylint: disable=import-error' at the right place * remove the import of config_flow in zha/__init__.py According to @balloob it is no longer needed. * revert previous commit * isort:skip homeassistant/components/zha/__init__.py completely
This commit is contained in:
parent
6b6570e7ca
commit
6cc75fc6f3
@ -1,8 +1,6 @@
|
|||||||
"""Support to check for available updates."""
|
"""Support to check for available updates."""
|
||||||
import asyncio
|
import asyncio
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
# pylint: disable=import-error
|
|
||||||
from distutils.version import StrictVersion
|
from distutils.version import StrictVersion
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
@ -10,7 +8,7 @@ import uuid
|
|||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import async_timeout
|
import async_timeout
|
||||||
from distro import linux_distribution
|
from distro import linux_distribution # pylint: disable=import-error
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import __version__ as current_version
|
from homeassistant.const import __version__ as current_version
|
||||||
|
@ -12,18 +12,18 @@ import requests
|
|||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.weather import (
|
from homeassistant.components.weather import (
|
||||||
|
ATTR_WEATHER_ATTRIBUTION,
|
||||||
ATTR_WEATHER_HUMIDITY,
|
ATTR_WEATHER_HUMIDITY,
|
||||||
ATTR_WEATHER_PRESSURE,
|
ATTR_WEATHER_PRESSURE,
|
||||||
ATTR_WEATHER_WIND_SPEED,
|
|
||||||
ATTR_WEATHER_ATTRIBUTION,
|
|
||||||
ATTR_WEATHER_TEMPERATURE,
|
ATTR_WEATHER_TEMPERATURE,
|
||||||
ATTR_WEATHER_WIND_BEARING,
|
ATTR_WEATHER_WIND_BEARING,
|
||||||
|
ATTR_WEATHER_WIND_SPEED,
|
||||||
)
|
)
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_NAME,
|
|
||||||
CONF_LATITUDE,
|
CONF_LATITUDE,
|
||||||
CONF_LONGITUDE,
|
CONF_LONGITUDE,
|
||||||
CONF_MONITORED_CONDITIONS,
|
CONF_MONITORED_CONDITIONS,
|
||||||
|
CONF_NAME,
|
||||||
__version__,
|
__version__,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
"""Support for Zengge lights."""
|
"""Support for Zengge lights."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from zengge import zengge
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
from zengge import zengge
|
||||||
|
|
||||||
from homeassistant.const import CONF_DEVICES, CONF_NAME
|
|
||||||
from homeassistant.components.light import (
|
from homeassistant.components.light import (
|
||||||
ATTR_BRIGHTNESS,
|
ATTR_BRIGHTNESS,
|
||||||
ATTR_HS_COLOR,
|
ATTR_HS_COLOR,
|
||||||
ATTR_WHITE_VALUE,
|
ATTR_WHITE_VALUE,
|
||||||
|
PLATFORM_SCHEMA,
|
||||||
SUPPORT_BRIGHTNESS,
|
SUPPORT_BRIGHTNESS,
|
||||||
SUPPORT_COLOR,
|
SUPPORT_COLOR,
|
||||||
SUPPORT_WHITE_VALUE,
|
SUPPORT_WHITE_VALUE,
|
||||||
Light,
|
Light,
|
||||||
PLATFORM_SCHEMA,
|
|
||||||
)
|
)
|
||||||
|
from homeassistant.const import CONF_DEVICES, CONF_NAME
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
import homeassistant.util.color as color_util
|
import homeassistant.util.color as color_util
|
||||||
|
|
||||||
|
@ -1,26 +1,25 @@
|
|||||||
"""Support for exposing Home Assistant via Zeroconf."""
|
"""Support for exposing Home Assistant via Zeroconf."""
|
||||||
|
|
||||||
|
import ipaddress
|
||||||
import logging
|
import logging
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
import ipaddress
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from zeroconf import (
|
from zeroconf import (
|
||||||
|
NonUniqueNameException,
|
||||||
ServiceBrowser,
|
ServiceBrowser,
|
||||||
ServiceInfo,
|
ServiceInfo,
|
||||||
ServiceStateChange,
|
ServiceStateChange,
|
||||||
Zeroconf,
|
Zeroconf,
|
||||||
NonUniqueNameException,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
from homeassistant import util
|
from homeassistant import util
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
EVENT_HOMEASSISTANT_STOP,
|
|
||||||
EVENT_HOMEASSISTANT_START,
|
EVENT_HOMEASSISTANT_START,
|
||||||
|
EVENT_HOMEASSISTANT_STOP,
|
||||||
__version__,
|
__version__,
|
||||||
)
|
)
|
||||||
from homeassistant.generated.zeroconf import ZEROCONF, HOMEKIT
|
from homeassistant.generated.zeroconf import HOMEKIT, ZEROCONF
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -3,11 +3,11 @@ from datetime import timedelta
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
import xmltodict
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
import xmltodict
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
from homeassistant.const import CONF_API_KEY, CONF_NAME, ATTR_ATTRIBUTION
|
from homeassistant.const import ATTR_ATTRIBUTION, CONF_API_KEY, CONF_NAME
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
"""Support for Zigbee Home Automation devices."""
|
"""Support for Zigbee Home Automation devices.
|
||||||
|
|
||||||
|
isort:skip_file
|
||||||
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
@ -7,7 +11,6 @@ from homeassistant import config_entries, const as ha_const
|
|||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.device_registry import CONNECTION_ZIGBEE
|
from homeassistant.helpers.device_registry import CONNECTION_ZIGBEE
|
||||||
|
|
||||||
# Loading the config flow file will register the flow
|
|
||||||
from . import config_flow # noqa: F401 pylint: disable=unused-import
|
from . import config_flow # noqa: F401 pylint: disable=unused-import
|
||||||
from . import api
|
from . import api
|
||||||
from .core import ZHAGateway
|
from .core import ZHAGateway
|
||||||
@ -100,7 +103,7 @@ async def async_setup_entry(hass, config_entry):
|
|||||||
if config.get(CONF_ENABLE_QUIRKS, True):
|
if config.get(CONF_ENABLE_QUIRKS, True):
|
||||||
# needs to be done here so that the ZHA module is finished loading
|
# needs to be done here so that the ZHA module is finished loading
|
||||||
# before zhaquirks is imported
|
# before zhaquirks is imported
|
||||||
import zhaquirks # noqa: F401 pylint: disable=unused-import, import-outside-toplevel
|
import zhaquirks # noqa: F401 pylint: disable=unused-import, import-outside-toplevel, import-error
|
||||||
|
|
||||||
zha_gateway = ZHAGateway(hass, config, config_entry)
|
zha_gateway = ZHAGateway(hass, config, config_entry)
|
||||||
await zha_gateway.async_initialize()
|
await zha_gateway.async_initialize()
|
||||||
|
@ -395,14 +395,16 @@ class EventRelayChannel(ZigbeeChannel):
|
|||||||
|
|
||||||
|
|
||||||
# pylint: disable=wrong-import-position, import-outside-toplevel
|
# pylint: disable=wrong-import-position, import-outside-toplevel
|
||||||
from . import closures # noqa: F401
|
from . import ( # noqa: F401 isort:skip
|
||||||
from . import general # noqa: F401
|
closures,
|
||||||
from . import homeautomation # noqa: F401
|
general,
|
||||||
from . import hvac # noqa: F401
|
homeautomation,
|
||||||
from . import lighting # noqa: F401
|
hvac,
|
||||||
from . import lightlink # noqa: F401
|
lighting,
|
||||||
from . import manufacturerspecific # noqa: F401
|
lightlink,
|
||||||
from . import measurement # noqa: F401
|
manufacturerspecific,
|
||||||
from . import protocol # noqa: F401
|
measurement,
|
||||||
from . import security # noqa: F401
|
protocol,
|
||||||
from . import smartenergy # noqa: F401
|
security,
|
||||||
|
smartenergy,
|
||||||
|
)
|
||||||
|
@ -1,24 +1,24 @@
|
|||||||
"""Support for Zigbee devices."""
|
"""Support for Zigbee devices."""
|
||||||
import logging
|
|
||||||
from binascii import hexlify, unhexlify
|
from binascii import hexlify, unhexlify
|
||||||
|
import logging
|
||||||
|
|
||||||
import xbee_helper.const as xb_const
|
|
||||||
from xbee_helper import ZigBee
|
|
||||||
from xbee_helper.device import convert_adc
|
|
||||||
from xbee_helper.exceptions import ZigBeeException, ZigBeeTxFailure
|
|
||||||
from serial import Serial, SerialException
|
from serial import Serial, SerialException
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
from xbee_helper import ZigBee
|
||||||
|
import xbee_helper.const as xb_const
|
||||||
|
from xbee_helper.device import convert_adc
|
||||||
|
from xbee_helper.exceptions import ZigBeeException, ZigBeeTxFailure
|
||||||
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
EVENT_HOMEASSISTANT_STOP,
|
CONF_ADDRESS,
|
||||||
CONF_DEVICE,
|
CONF_DEVICE,
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
CONF_PIN,
|
CONF_PIN,
|
||||||
CONF_ADDRESS,
|
EVENT_HOMEASSISTANT_STOP,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect, dispatcher_send
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect, dispatcher_send
|
||||||
|
from homeassistant.helpers.entity import Entity
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ from homeassistant.components.switch import SwitchDevice
|
|||||||
|
|
||||||
from . import PLATFORM_SCHEMA, ZigBeeDigitalOut, ZigBeeDigitalOutConfig
|
from . import PLATFORM_SCHEMA, ZigBeeDigitalOut, ZigBeeDigitalOutConfig
|
||||||
|
|
||||||
|
|
||||||
CONF_ON_STATE = "on_state"
|
CONF_ON_STATE = "on_state"
|
||||||
|
|
||||||
DEFAULT_ON_STATE = "high"
|
DEFAULT_ON_STATE = "high"
|
||||||
|
@ -4,9 +4,9 @@ from unittest.mock import patch
|
|||||||
import pytest
|
import pytest
|
||||||
from zeroconf import ServiceInfo, ServiceStateChange
|
from zeroconf import ServiceInfo, ServiceStateChange
|
||||||
|
|
||||||
|
from homeassistant.components import zeroconf
|
||||||
from homeassistant.generated import zeroconf as zc_gen
|
from homeassistant.generated import zeroconf as zc_gen
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
from homeassistant.components import zeroconf
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
Loading…
x
Reference in New Issue
Block a user