use isort to sort imports according to PEP8 for mqtt (#29649)
This commit is contained in:
parent
d2c1e5d45c
commit
ce5072fc91
13 changed files with 25 additions and 27 deletions
|
@ -1,6 +1,5 @@
|
||||||
"""Support for MQTT message handling."""
|
"""Support for MQTT message handling."""
|
||||||
import asyncio
|
import asyncio
|
||||||
import sys
|
|
||||||
from functools import partial, wraps
|
from functools import partial, wraps
|
||||||
import inspect
|
import inspect
|
||||||
from itertools import groupby
|
from itertools import groupby
|
||||||
|
@ -10,6 +9,7 @@ from operator import attrgetter
|
||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
import ssl
|
import ssl
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
from typing import Any, Callable, List, Optional, Union
|
from typing import Any, Callable, List, Optional, Union
|
||||||
|
|
||||||
|
@ -32,9 +32,9 @@ from homeassistant.const import (
|
||||||
)
|
)
|
||||||
from homeassistant.core import Event, ServiceCall, callback
|
from homeassistant.core import Event, ServiceCall, callback
|
||||||
from homeassistant.exceptions import (
|
from homeassistant.exceptions import (
|
||||||
|
ConfigEntryNotReady,
|
||||||
HomeAssistantError,
|
HomeAssistantError,
|
||||||
Unauthorized,
|
Unauthorized,
|
||||||
ConfigEntryNotReady,
|
|
||||||
)
|
)
|
||||||
from homeassistant.helpers import config_validation as cv, template
|
from homeassistant.helpers import config_validation as cv, template
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
@ -47,16 +47,16 @@ from homeassistant.util.logging import catch_log_exception
|
||||||
# Loading the config flow file will register the flow
|
# Loading the config flow file will register the flow
|
||||||
from . import config_flow, discovery, server # noqa: F401 pylint: disable=unused-import
|
from . import config_flow, discovery, server # noqa: F401 pylint: disable=unused-import
|
||||||
from .const import (
|
from .const import (
|
||||||
|
ATTR_DISCOVERY_HASH,
|
||||||
CONF_BROKER,
|
CONF_BROKER,
|
||||||
CONF_DISCOVERY,
|
CONF_DISCOVERY,
|
||||||
DEFAULT_DISCOVERY,
|
|
||||||
CONF_STATE_TOPIC,
|
CONF_STATE_TOPIC,
|
||||||
ATTR_DISCOVERY_HASH,
|
DEFAULT_DISCOVERY,
|
||||||
PROTOCOL_311,
|
|
||||||
DEFAULT_QOS,
|
DEFAULT_QOS,
|
||||||
|
PROTOCOL_311,
|
||||||
)
|
)
|
||||||
from .discovery import MQTT_DISCOVERY_UPDATED, clear_discovery_hash
|
from .discovery import MQTT_DISCOVERY_UPDATED, clear_discovery_hash
|
||||||
from .models import PublishPayloadType, Message, MessageCallbackType
|
from .models import Message, MessageCallbackType, PublishPayloadType
|
||||||
from .subscription import async_subscribe_topics, async_unsubscribe_topics
|
from .subscription import async_subscribe_topics, async_unsubscribe_topics
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
|
@ -7,7 +7,7 @@ import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components import camera, mqtt
|
from homeassistant.components import camera, mqtt
|
||||||
from homeassistant.components.camera import PLATFORM_SCHEMA, Camera
|
from homeassistant.components.camera import PLATFORM_SCHEMA, Camera
|
||||||
from homeassistant.const import CONF_NAME, CONF_DEVICE
|
from homeassistant.const import CONF_DEVICE, CONF_NAME
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers import config_validation as cv
|
from homeassistant.helpers import config_validation as cv
|
||||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||||
|
|
|
@ -20,14 +20,14 @@ from homeassistant.components.climate.const import (
|
||||||
HVAC_MODE_FAN_ONLY,
|
HVAC_MODE_FAN_ONLY,
|
||||||
HVAC_MODE_HEAT,
|
HVAC_MODE_HEAT,
|
||||||
HVAC_MODE_OFF,
|
HVAC_MODE_OFF,
|
||||||
|
PRESET_AWAY,
|
||||||
|
PRESET_NONE,
|
||||||
SUPPORT_AUX_HEAT,
|
SUPPORT_AUX_HEAT,
|
||||||
SUPPORT_FAN_MODE,
|
SUPPORT_FAN_MODE,
|
||||||
SUPPORT_PRESET_MODE,
|
SUPPORT_PRESET_MODE,
|
||||||
SUPPORT_SWING_MODE,
|
SUPPORT_SWING_MODE,
|
||||||
SUPPORT_TARGET_TEMPERATURE,
|
SUPPORT_TARGET_TEMPERATURE,
|
||||||
PRESET_AWAY,
|
|
||||||
SUPPORT_TARGET_TEMPERATURE_RANGE,
|
SUPPORT_TARGET_TEMPERATURE_RANGE,
|
||||||
PRESET_NONE,
|
|
||||||
)
|
)
|
||||||
from homeassistant.components.fan import SPEED_HIGH, SPEED_LOW, SPEED_MEDIUM
|
from homeassistant.components.fan import SPEED_HIGH, SPEED_LOW, SPEED_MEDIUM
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
|
|
|
@ -5,9 +5,9 @@ import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components import mqtt
|
from homeassistant.components import mqtt
|
||||||
from homeassistant.components.device_tracker import PLATFORM_SCHEMA, SOURCE_TYPES
|
from homeassistant.components.device_tracker import PLATFORM_SCHEMA, SOURCE_TYPES
|
||||||
|
from homeassistant.const import CONF_DEVICES, STATE_HOME, STATE_NOT_HOME
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.const import CONF_DEVICES, STATE_NOT_HOME, STATE_HOME
|
|
||||||
|
|
||||||
from . import CONF_QOS
|
from . import CONF_QOS
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
"""Modesl used by multiple MQTT modules."""
|
"""Modesl used by multiple MQTT modules."""
|
||||||
from typing import Union, Callable
|
from typing import Callable, Union
|
||||||
|
|
||||||
import attr
|
import attr
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""The tests for the MQTT binary sensor platform."""
|
"""The tests for the MQTT binary sensor platform."""
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from unittest.mock import ANY, patch
|
from unittest.mock import ANY, patch
|
||||||
|
|
||||||
from homeassistant.components import binary_sensor, mqtt
|
from homeassistant.components import binary_sensor, mqtt
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"""The tests for mqtt camera component."""
|
"""The tests for mqtt camera component."""
|
||||||
from unittest.mock import ANY
|
|
||||||
import json
|
import json
|
||||||
|
from unittest.mock import ANY
|
||||||
|
|
||||||
from homeassistant.components import camera, mqtt
|
from homeassistant.components import camera, mqtt
|
||||||
from homeassistant.components.mqtt.discovery import async_start
|
from homeassistant.components.mqtt.discovery import async_start
|
||||||
|
|
|
@ -11,19 +11,19 @@ from homeassistant.components import mqtt
|
||||||
from homeassistant.components.climate import DEFAULT_MAX_TEMP, DEFAULT_MIN_TEMP
|
from homeassistant.components.climate import DEFAULT_MAX_TEMP, DEFAULT_MIN_TEMP
|
||||||
from homeassistant.components.climate.const import (
|
from homeassistant.components.climate.const import (
|
||||||
DOMAIN as CLIMATE_DOMAIN,
|
DOMAIN as CLIMATE_DOMAIN,
|
||||||
SUPPORT_AUX_HEAT,
|
|
||||||
SUPPORT_PRESET_MODE,
|
|
||||||
SUPPORT_FAN_MODE,
|
|
||||||
SUPPORT_SWING_MODE,
|
|
||||||
SUPPORT_TARGET_TEMPERATURE,
|
|
||||||
HVAC_MODE_AUTO,
|
HVAC_MODE_AUTO,
|
||||||
HVAC_MODE_COOL,
|
HVAC_MODE_COOL,
|
||||||
HVAC_MODE_HEAT,
|
|
||||||
HVAC_MODE_DRY,
|
HVAC_MODE_DRY,
|
||||||
HVAC_MODE_FAN_ONLY,
|
HVAC_MODE_FAN_ONLY,
|
||||||
SUPPORT_TARGET_TEMPERATURE_RANGE,
|
HVAC_MODE_HEAT,
|
||||||
PRESET_NONE,
|
|
||||||
PRESET_ECO,
|
PRESET_ECO,
|
||||||
|
PRESET_NONE,
|
||||||
|
SUPPORT_AUX_HEAT,
|
||||||
|
SUPPORT_FAN_MODE,
|
||||||
|
SUPPORT_PRESET_MODE,
|
||||||
|
SUPPORT_SWING_MODE,
|
||||||
|
SUPPORT_TARGET_TEMPERATURE,
|
||||||
|
SUPPORT_TARGET_TEMPERATURE_RANGE,
|
||||||
)
|
)
|
||||||
from homeassistant.components.mqtt.discovery import async_start
|
from homeassistant.components.mqtt.discovery import async_start
|
||||||
from homeassistant.const import STATE_OFF, STATE_UNAVAILABLE
|
from homeassistant.const import STATE_OFF, STATE_UNAVAILABLE
|
||||||
|
|
|
@ -16,11 +16,11 @@ from homeassistant.const import (
|
||||||
SERVICE_SET_COVER_POSITION,
|
SERVICE_SET_COVER_POSITION,
|
||||||
SERVICE_SET_COVER_TILT_POSITION,
|
SERVICE_SET_COVER_TILT_POSITION,
|
||||||
SERVICE_STOP_COVER,
|
SERVICE_STOP_COVER,
|
||||||
|
SERVICE_TOGGLE,
|
||||||
|
SERVICE_TOGGLE_COVER_TILT,
|
||||||
STATE_CLOSED,
|
STATE_CLOSED,
|
||||||
STATE_OPEN,
|
STATE_OPEN,
|
||||||
STATE_UNAVAILABLE,
|
STATE_UNAVAILABLE,
|
||||||
SERVICE_TOGGLE,
|
|
||||||
SERVICE_TOGGLE_COVER_TILT,
|
|
||||||
STATE_UNKNOWN,
|
STATE_UNKNOWN,
|
||||||
)
|
)
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
"""The tests for the MQTT discovery."""
|
"""The tests for the MQTT discovery."""
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from homeassistant.components import mqtt
|
from homeassistant.components import mqtt
|
||||||
|
|
|
@ -15,8 +15,8 @@ from homeassistant.const import (
|
||||||
EVENT_HOMEASSISTANT_STOP,
|
EVENT_HOMEASSISTANT_STOP,
|
||||||
)
|
)
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.setup import async_setup_component
|
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
from tests.common import (
|
from tests.common import (
|
||||||
MockConfigEntry,
|
MockConfigEntry,
|
||||||
|
|
|
@ -14,8 +14,8 @@ import homeassistant.util.dt as dt_util
|
||||||
from tests.common import (
|
from tests.common import (
|
||||||
MockConfigEntry,
|
MockConfigEntry,
|
||||||
async_fire_mqtt_message,
|
async_fire_mqtt_message,
|
||||||
async_mock_mqtt_component,
|
|
||||||
async_fire_time_changed,
|
async_fire_time_changed,
|
||||||
|
async_mock_mqtt_component,
|
||||||
mock_registry,
|
mock_registry,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -26,9 +26,9 @@ from homeassistant.components.vacuum import (
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
CONF_PLATFORM,
|
CONF_PLATFORM,
|
||||||
|
ENTITY_MATCH_ALL,
|
||||||
STATE_UNAVAILABLE,
|
STATE_UNAVAILABLE,
|
||||||
STATE_UNKNOWN,
|
STATE_UNKNOWN,
|
||||||
ENTITY_MATCH_ALL,
|
|
||||||
)
|
)
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue