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