sort imports according to PEP8 for alexa (#29618)
This commit is contained in:
parent
6ad3b6426a
commit
ba34922b03
19 changed files with 72 additions and 68 deletions
|
@ -3,25 +3,24 @@ import logging
|
|||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers import entityfilter
|
||||
from homeassistant.const import CONF_NAME
|
||||
from homeassistant.helpers import config_validation as cv, entityfilter
|
||||
|
||||
from . import flash_briefings, intent, smart_home_http
|
||||
from .const import (
|
||||
CONF_AUDIO,
|
||||
CONF_CLIENT_ID,
|
||||
CONF_CLIENT_SECRET,
|
||||
CONF_DESCRIPTION,
|
||||
CONF_DISPLAY_CATEGORIES,
|
||||
CONF_DISPLAY_URL,
|
||||
CONF_ENDPOINT,
|
||||
CONF_ENTITY_CONFIG,
|
||||
CONF_FILTER,
|
||||
CONF_TEXT,
|
||||
CONF_TITLE,
|
||||
CONF_UID,
|
||||
DOMAIN,
|
||||
CONF_FILTER,
|
||||
CONF_ENTITY_CONFIG,
|
||||
CONF_DESCRIPTION,
|
||||
CONF_DISPLAY_CATEGORIES,
|
||||
)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
"""Support for Alexa skill auth."""
|
||||
import asyncio
|
||||
from datetime import timedelta
|
||||
import json
|
||||
import logging
|
||||
from datetime import timedelta
|
||||
|
||||
import aiohttp
|
||||
import async_timeout
|
||||
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
"""Alexa capabilities."""
|
||||
import logging
|
||||
|
||||
from homeassistant.components import cover, fan, light
|
||||
from homeassistant.components.alarm_control_panel import ATTR_CODE_FORMAT, FORMAT_NUMBER
|
||||
import homeassistant.components.climate.const as climate
|
||||
import homeassistant.components.media_player.const as media_player
|
||||
from homeassistant.const import (
|
||||
ATTR_SUPPORTED_FEATURES,
|
||||
ATTR_TEMPERATURE,
|
||||
|
@ -20,21 +24,17 @@ from homeassistant.const import (
|
|||
STATE_UNKNOWN,
|
||||
STATE_UNLOCKED,
|
||||
)
|
||||
import homeassistant.components.climate.const as climate
|
||||
import homeassistant.components.media_player.const as media_player
|
||||
from homeassistant.components.alarm_control_panel import ATTR_CODE_FORMAT, FORMAT_NUMBER
|
||||
from homeassistant.components import light, fan, cover
|
||||
import homeassistant.util.color as color_util
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from .const import (
|
||||
Catalog,
|
||||
API_TEMP_UNITS,
|
||||
API_THERMOSTAT_MODES,
|
||||
API_THERMOSTAT_PRESETS,
|
||||
DATE_FORMAT,
|
||||
PERCENTAGE_FAN_MAP,
|
||||
RANGE_FAN_MAP,
|
||||
Catalog,
|
||||
Inputs,
|
||||
)
|
||||
from .errors import UnsupportedProperty
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
"""Constants for the Alexa integration."""
|
||||
from collections import OrderedDict
|
||||
|
||||
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT
|
||||
from homeassistant.components.climate import const as climate
|
||||
from homeassistant.components import fan
|
||||
from homeassistant.components.climate import const as climate
|
||||
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT
|
||||
|
||||
DOMAIN = "alexa"
|
||||
|
||||
|
|
|
@ -1,18 +1,6 @@
|
|||
"""Alexa entity adapters."""
|
||||
from typing import List
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.const import (
|
||||
ATTR_DEVICE_CLASS,
|
||||
ATTR_SUPPORTED_FEATURES,
|
||||
ATTR_UNIT_OF_MEASUREMENT,
|
||||
CLOUD_NEVER_EXPOSED_ENTITIES,
|
||||
CONF_NAME,
|
||||
TEMP_CELSIUS,
|
||||
TEMP_FAHRENHEIT,
|
||||
)
|
||||
from homeassistant.util.decorator import Registry
|
||||
from homeassistant.components.climate import const as climate
|
||||
from homeassistant.components import (
|
||||
alarm_control_panel,
|
||||
alert,
|
||||
|
@ -30,8 +18,19 @@ from homeassistant.components import (
|
|||
sensor,
|
||||
switch,
|
||||
)
|
||||
from homeassistant.components.climate import const as climate
|
||||
from homeassistant.const import (
|
||||
ATTR_DEVICE_CLASS,
|
||||
ATTR_SUPPORTED_FEATURES,
|
||||
ATTR_UNIT_OF_MEASUREMENT,
|
||||
CLOUD_NEVER_EXPOSED_ENTITIES,
|
||||
CONF_NAME,
|
||||
TEMP_CELSIUS,
|
||||
TEMP_FAHRENHEIT,
|
||||
)
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.util.decorator import Registry
|
||||
|
||||
from .const import CONF_DESCRIPTION, CONF_DISPLAY_CATEGORIES
|
||||
from .capabilities import (
|
||||
Alexa,
|
||||
AlexaBrightnessController,
|
||||
|
@ -60,6 +59,7 @@ from .capabilities import (
|
|||
AlexaThermostatController,
|
||||
AlexaToggleController,
|
||||
)
|
||||
from .const import CONF_DESCRIPTION, CONF_DISPLAY_CATEGORIES
|
||||
|
||||
ENTITY_ADAPTERS = Registry()
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@ import copy
|
|||
import logging
|
||||
import uuid
|
||||
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.components import http
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import template
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from .const import (
|
||||
ATTR_MAIN_TEXT,
|
||||
|
|
|
@ -34,20 +34,20 @@ from homeassistant.const import (
|
|||
TEMP_FAHRENHEIT,
|
||||
)
|
||||
import homeassistant.util.color as color_util
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.util.decorator import Registry
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.util.temperature import convert as convert_temperature
|
||||
|
||||
from .const import (
|
||||
API_TEMP_UNITS,
|
||||
API_THERMOSTAT_MODES_CUSTOM,
|
||||
API_THERMOSTAT_MODES,
|
||||
API_THERMOSTAT_MODES_CUSTOM,
|
||||
API_THERMOSTAT_PRESETS,
|
||||
Cause,
|
||||
Inputs,
|
||||
PERCENTAGE_FAN_MAP,
|
||||
RANGE_FAN_MAP,
|
||||
SPEED_FAN_MAP,
|
||||
Cause,
|
||||
Inputs,
|
||||
)
|
||||
from .entities import async_get_entities
|
||||
from .errors import (
|
||||
|
|
|
@ -4,7 +4,7 @@ import logging
|
|||
import homeassistant.core as ha
|
||||
|
||||
from .const import API_DIRECTIVE, API_HEADER
|
||||
from .errors import AlexaError, AlexaBridgeUnreachableError
|
||||
from .errors import AlexaBridgeUnreachableError, AlexaError
|
||||
from .handlers import HANDLERS
|
||||
from .messages import AlexaDirective
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ from .const import (
|
|||
CONF_ENTITY_CONFIG,
|
||||
CONF_FILTER,
|
||||
)
|
||||
from .state_report import async_enable_proactive_mode
|
||||
from .smart_home import async_handle_message
|
||||
from .state_report import async_enable_proactive_mode
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
SMART_HOME_HTTP_ENDPOINT = "/api/alexa/smart_home"
|
||||
|
|
|
@ -6,8 +6,8 @@ import logging
|
|||
import aiohttp
|
||||
import async_timeout
|
||||
|
||||
import homeassistant.util.dt as dt_util
|
||||
from homeassistant.const import MATCH_ALL, STATE_ON
|
||||
import homeassistant.util.dt as dt_util
|
||||
|
||||
from .const import API_CHANGE, Cause
|
||||
from .entities import ENTITY_ADAPTERS
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""Tests for the Alexa integration."""
|
||||
from uuid import uuid4
|
||||
|
||||
from homeassistant.core import Context
|
||||
from homeassistant.components.alexa import config, smart_home
|
||||
from homeassistant.core import Context
|
||||
|
||||
from tests.common import async_mock_service
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
"""Test Alexa auth endpoints."""
|
||||
from homeassistant.components.alexa.auth import Auth
|
||||
|
||||
from . import TEST_TOKEN_URL
|
||||
|
||||
|
||||
|
|
|
@ -1,37 +1,38 @@
|
|||
"""Test Alexa capabilities."""
|
||||
import pytest
|
||||
|
||||
from homeassistant.const import (
|
||||
ATTR_UNIT_OF_MEASUREMENT,
|
||||
TEMP_CELSIUS,
|
||||
STATE_LOCKED,
|
||||
STATE_UNLOCKED,
|
||||
STATE_UNKNOWN,
|
||||
STATE_UNAVAILABLE,
|
||||
STATE_ALARM_DISARMED,
|
||||
STATE_ALARM_ARMED_AWAY,
|
||||
STATE_ALARM_ARMED_CUSTOM_BYPASS,
|
||||
STATE_ALARM_ARMED_HOME,
|
||||
STATE_ALARM_ARMED_NIGHT,
|
||||
)
|
||||
from homeassistant.components.climate import const as climate
|
||||
from homeassistant.components.alexa import smart_home
|
||||
from homeassistant.components.alexa.errors import UnsupportedProperty
|
||||
from homeassistant.components.climate import const as climate
|
||||
from homeassistant.components.media_player.const import (
|
||||
SUPPORT_PAUSE,
|
||||
SUPPORT_PLAY,
|
||||
SUPPORT_STOP,
|
||||
)
|
||||
from tests.common import async_mock_service
|
||||
from homeassistant.const import (
|
||||
ATTR_UNIT_OF_MEASUREMENT,
|
||||
STATE_ALARM_ARMED_AWAY,
|
||||
STATE_ALARM_ARMED_CUSTOM_BYPASS,
|
||||
STATE_ALARM_ARMED_HOME,
|
||||
STATE_ALARM_ARMED_NIGHT,
|
||||
STATE_ALARM_DISARMED,
|
||||
STATE_LOCKED,
|
||||
STATE_UNAVAILABLE,
|
||||
STATE_UNKNOWN,
|
||||
STATE_UNLOCKED,
|
||||
TEMP_CELSIUS,
|
||||
)
|
||||
|
||||
from . import (
|
||||
DEFAULT_CONFIG,
|
||||
get_new_request,
|
||||
assert_request_calls_service,
|
||||
assert_request_fails,
|
||||
get_new_request,
|
||||
reported_properties,
|
||||
)
|
||||
|
||||
from tests.common import async_mock_service
|
||||
|
||||
|
||||
@pytest.mark.parametrize("result,adjust", [(25, "-5"), (35, "5"), (0, "-80")])
|
||||
async def test_api_adjust_brightness(hass, result, adjust):
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Test Alexa entity representation."""
|
||||
from homeassistant.components.alexa import smart_home
|
||||
from . import get_new_request, DEFAULT_CONFIG
|
||||
|
||||
from . import DEFAULT_CONFIG, get_new_request
|
||||
|
||||
|
||||
async def test_unsupported_domain(hass):
|
||||
|
|
|
@ -5,10 +5,10 @@ import datetime
|
|||
|
||||
import pytest
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.components import alexa
|
||||
from homeassistant.components.alexa import const
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
SESSION_ID = "amzn1.echo-api.session.0000000-0000-0000-0000-00000000000"
|
||||
APPLICATION_ID = "amzn1.echo-sdk-ams.app.000000-d0ed-0000-ad00-000000d00ebe"
|
||||
|
|
|
@ -5,10 +5,10 @@ import json
|
|||
|
||||
import pytest
|
||||
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.components import alexa
|
||||
from homeassistant.components.alexa import intent
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
SESSION_ID = "amzn1.echo-api.session.0000000-0000-0000-0000-00000000000"
|
||||
APPLICATION_ID = "amzn1.echo-sdk-ams.app.000000-d0ed-0000-ad00-000000d00ebe"
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
"""Test for smart home alexa support."""
|
||||
import pytest
|
||||
|
||||
from homeassistant.core import Context, callback
|
||||
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT
|
||||
from homeassistant.components.alexa import smart_home, messages
|
||||
from homeassistant.components.alexa import messages, smart_home
|
||||
from homeassistant.components.media_player.const import (
|
||||
SUPPORT_NEXT_TRACK,
|
||||
SUPPORT_PAUSE,
|
||||
|
@ -18,22 +16,24 @@ from homeassistant.components.media_player.const import (
|
|||
SUPPORT_VOLUME_MUTE,
|
||||
SUPPORT_VOLUME_SET,
|
||||
)
|
||||
from homeassistant.const import TEMP_CELSIUS, TEMP_FAHRENHEIT
|
||||
from homeassistant.core import Context, callback
|
||||
from homeassistant.helpers import entityfilter
|
||||
|
||||
from tests.common import async_mock_service
|
||||
|
||||
from . import (
|
||||
get_new_request,
|
||||
MockConfig,
|
||||
DEFAULT_CONFIG,
|
||||
assert_request_calls_service,
|
||||
assert_request_fails,
|
||||
MockConfig,
|
||||
ReportedProperties,
|
||||
assert_power_controller_works,
|
||||
assert_request_calls_service,
|
||||
assert_request_fails,
|
||||
assert_scene_controller_works,
|
||||
get_new_request,
|
||||
reported_properties,
|
||||
)
|
||||
|
||||
from tests.common import async_mock_service
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def events(hass):
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
"""Test Smart Home HTTP endpoints."""
|
||||
import json
|
||||
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.components.alexa import DOMAIN, smart_home_http
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
from . import get_new_request
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Test report state."""
|
||||
from homeassistant.components.alexa import state_report
|
||||
from . import TEST_URL, DEFAULT_CONFIG
|
||||
|
||||
from . import DEFAULT_CONFIG, TEST_URL
|
||||
|
||||
|
||||
async def test_report_state(hass, aioclient_mock):
|
||||
|
|
Loading…
Add table
Reference in a new issue