mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Sort imports according to PEP8 for google_assistant (#29633)
* sort imports and fix flake8 issue for google * add isort:skip to EVENT_SYNC_RECEIVED
This commit is contained in:
parent
bc3b7ed06b
commit
7f948594eb
@ -29,10 +29,11 @@ from .const import (
|
|||||||
DOMAIN,
|
DOMAIN,
|
||||||
SERVICE_REQUEST_SYNC,
|
SERVICE_REQUEST_SYNC,
|
||||||
)
|
)
|
||||||
from .const import EVENT_COMMAND_RECEIVED, EVENT_SYNC_RECEIVED # noqa: F401
|
|
||||||
from .const import EVENT_QUERY_RECEIVED # noqa: F401
|
from .const import EVENT_QUERY_RECEIVED # noqa: F401
|
||||||
from .http import GoogleAssistantView, GoogleConfig
|
from .http import GoogleAssistantView, GoogleConfig
|
||||||
|
|
||||||
|
from .const import EVENT_COMMAND_RECEIVED, EVENT_SYNC_RECEIVED # noqa: F401, isort:skip
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
ENTITY_SCHEMA = vol.Schema(
|
ENTITY_SCHEMA = vol.Schema(
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
"""Tests for the Google Assistant integration."""
|
"""Tests for the Google Assistant integration."""
|
||||||
from asynctest.mock import MagicMock
|
from asynctest.mock import MagicMock
|
||||||
|
|
||||||
from homeassistant.components.google_assistant import helpers
|
from homeassistant.components.google_assistant import helpers
|
||||||
|
|
||||||
|
|
||||||
|
@ -6,19 +6,19 @@ import json
|
|||||||
from aiohttp.hdrs import AUTHORIZATION
|
from aiohttp.hdrs import AUTHORIZATION
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from homeassistant import core, const, setup
|
from homeassistant import const, core, setup
|
||||||
from homeassistant.components import (
|
from homeassistant.components import (
|
||||||
fan,
|
alarm_control_panel,
|
||||||
cover,
|
cover,
|
||||||
|
fan,
|
||||||
|
google_assistant as ga,
|
||||||
light,
|
light,
|
||||||
switch,
|
|
||||||
lock,
|
lock,
|
||||||
media_player,
|
media_player,
|
||||||
alarm_control_panel,
|
switch,
|
||||||
)
|
)
|
||||||
from homeassistant.components.climate import const as climate
|
from homeassistant.components.climate import const as climate
|
||||||
from homeassistant.const import CLOUD_NEVER_EXPOSED_ENTITIES
|
from homeassistant.const import CLOUD_NEVER_EXPOSED_ENTITIES
|
||||||
from homeassistant.components import google_assistant as ga
|
|
||||||
|
|
||||||
from . import DEMO_DEVICES
|
from . import DEMO_DEVICES
|
||||||
|
|
||||||
|
@ -1,17 +1,22 @@
|
|||||||
"""Test Google Assistant helpers."""
|
"""Test Google Assistant helpers."""
|
||||||
from asynctest.mock import Mock, patch, call
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
|
||||||
|
from asynctest.mock import Mock, call, patch
|
||||||
import pytest
|
import pytest
|
||||||
from homeassistant.setup import async_setup_component
|
|
||||||
from homeassistant.components.google_assistant import helpers
|
from homeassistant.components.google_assistant import helpers
|
||||||
from homeassistant.components.google_assistant.const import EVENT_COMMAND_RECEIVED
|
from homeassistant.components.google_assistant.const import ( # noqa: F401
|
||||||
|
EVENT_COMMAND_RECEIVED,
|
||||||
|
)
|
||||||
|
from homeassistant.setup import async_setup_component
|
||||||
from homeassistant.util import dt
|
from homeassistant.util import dt
|
||||||
|
|
||||||
from . import MockConfig
|
from . import MockConfig
|
||||||
|
|
||||||
from tests.common import (
|
from tests.common import (
|
||||||
async_capture_events,
|
async_capture_events,
|
||||||
async_mock_service,
|
|
||||||
async_fire_time_changed,
|
async_fire_time_changed,
|
||||||
|
async_mock_service,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
"""Test Google http services."""
|
"""Test Google http services."""
|
||||||
from datetime import datetime, timezone, timedelta
|
from datetime import datetime, timedelta, timezone
|
||||||
from asynctest import patch, ANY
|
|
||||||
|
|
||||||
|
from asynctest import ANY, patch
|
||||||
|
|
||||||
|
from homeassistant.components.google_assistant import GOOGLE_ASSISTANT_SCHEMA
|
||||||
|
from homeassistant.components.google_assistant.const import (
|
||||||
|
HOMEGRAPH_TOKEN_URL,
|
||||||
|
REPORT_STATE_BASE_URL,
|
||||||
|
)
|
||||||
from homeassistant.components.google_assistant.http import (
|
from homeassistant.components.google_assistant.http import (
|
||||||
GoogleConfig,
|
GoogleConfig,
|
||||||
_get_homegraph_jwt,
|
_get_homegraph_jwt,
|
||||||
_get_homegraph_token,
|
_get_homegraph_token,
|
||||||
)
|
)
|
||||||
from homeassistant.components.google_assistant import GOOGLE_ASSISTANT_SCHEMA
|
|
||||||
from homeassistant.components.google_assistant.const import (
|
|
||||||
REPORT_STATE_BASE_URL,
|
|
||||||
HOMEGRAPH_TOKEN_URL,
|
|
||||||
)
|
|
||||||
|
|
||||||
DUMMY_CONFIG = GOOGLE_ASSISTANT_SCHEMA(
|
DUMMY_CONFIG = GOOGLE_ASSISTANT_SCHEMA(
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
"""The tests for google-assistant init."""
|
"""The tests for google-assistant init."""
|
||||||
import asyncio
|
import asyncio
|
||||||
|
|
||||||
|
from homeassistant.components import google_assistant as ga
|
||||||
from homeassistant.core import Context
|
from homeassistant.core import Context
|
||||||
from homeassistant.setup import async_setup_component
|
from homeassistant.setup import async_setup_component
|
||||||
from homeassistant.components import google_assistant as ga
|
|
||||||
|
|
||||||
GA_API_KEY = "Agdgjsj399sdfkosd932ksd"
|
GA_API_KEY = "Agdgjsj399sdfkosd932ksd"
|
||||||
|
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
"""Test Google report state."""
|
"""Test Google report state."""
|
||||||
from unittest.mock import patch
|
from unittest.mock import patch
|
||||||
|
|
||||||
from homeassistant.components.google_assistant import report_state, error
|
from homeassistant.components.google_assistant import error, report_state
|
||||||
from homeassistant.util.dt import utcnow
|
from homeassistant.util.dt import utcnow
|
||||||
|
|
||||||
from . import BASIC_CONFIG
|
from . import BASIC_CONFIG
|
||||||
|
|
||||||
|
from tests.common import async_fire_time_changed, mock_coro
|
||||||
from tests.common import mock_coro, async_fire_time_changed
|
|
||||||
|
|
||||||
|
|
||||||
async def test_report_state(hass, caplog):
|
async def test_report_state(hass, caplog):
|
||||||
|
@ -1,40 +1,41 @@
|
|||||||
"""Test Google Smart Home."""
|
"""Test Google Smart Home."""
|
||||||
from unittest.mock import patch, Mock
|
from unittest.mock import Mock, patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from homeassistant.core import State, EVENT_CALL_SERVICE
|
|
||||||
from homeassistant.const import ATTR_UNIT_OF_MEASUREMENT, TEMP_CELSIUS, __version__
|
|
||||||
from homeassistant.setup import async_setup_component
|
|
||||||
from homeassistant.components import camera
|
from homeassistant.components import camera
|
||||||
from homeassistant.components.climate.const import (
|
from homeassistant.components.climate.const import (
|
||||||
ATTR_MIN_TEMP,
|
|
||||||
ATTR_MAX_TEMP,
|
ATTR_MAX_TEMP,
|
||||||
|
ATTR_MIN_TEMP,
|
||||||
HVAC_MODE_HEAT,
|
HVAC_MODE_HEAT,
|
||||||
)
|
)
|
||||||
from homeassistant.components.google_assistant import (
|
|
||||||
const,
|
|
||||||
trait,
|
|
||||||
smart_home as sh,
|
|
||||||
EVENT_COMMAND_RECEIVED,
|
|
||||||
EVENT_QUERY_RECEIVED,
|
|
||||||
EVENT_SYNC_RECEIVED,
|
|
||||||
)
|
|
||||||
from homeassistant.components.demo.binary_sensor import DemoBinarySensor
|
from homeassistant.components.demo.binary_sensor import DemoBinarySensor
|
||||||
from homeassistant.components.demo.cover import DemoCover
|
from homeassistant.components.demo.cover import DemoCover
|
||||||
from homeassistant.components.demo.light import DemoLight
|
from homeassistant.components.demo.light import DemoLight
|
||||||
from homeassistant.components.demo.media_player import AbstractDemoPlayer
|
from homeassistant.components.demo.media_player import AbstractDemoPlayer
|
||||||
from homeassistant.components.demo.switch import DemoSwitch
|
from homeassistant.components.demo.switch import DemoSwitch
|
||||||
|
from homeassistant.components.google_assistant import (
|
||||||
from homeassistant.helpers import device_registry
|
EVENT_COMMAND_RECEIVED,
|
||||||
from tests.common import (
|
EVENT_QUERY_RECEIVED,
|
||||||
mock_device_registry,
|
EVENT_SYNC_RECEIVED,
|
||||||
mock_registry,
|
const,
|
||||||
mock_area_registry,
|
smart_home as sh,
|
||||||
mock_coro,
|
trait,
|
||||||
)
|
)
|
||||||
|
from homeassistant.const import ATTR_UNIT_OF_MEASUREMENT, TEMP_CELSIUS, __version__
|
||||||
|
from homeassistant.core import EVENT_CALL_SERVICE, State
|
||||||
|
from homeassistant.helpers import device_registry
|
||||||
|
from homeassistant.setup import async_setup_component
|
||||||
|
|
||||||
from . import BASIC_CONFIG, MockConfig
|
from . import BASIC_CONFIG, MockConfig
|
||||||
|
|
||||||
|
from tests.common import (
|
||||||
|
mock_area_registry,
|
||||||
|
mock_coro,
|
||||||
|
mock_device_registry,
|
||||||
|
mock_registry,
|
||||||
|
)
|
||||||
|
|
||||||
REQ_ID = "ff36a3cc-ec34-11e6-b1a0-64510650abcf"
|
REQ_ID = "ff36a3cc-ec34-11e6-b1a0-64510650abcf"
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
"""Tests for the Google Assistant traits."""
|
"""Tests for the Google Assistant traits."""
|
||||||
from unittest.mock import patch, Mock
|
|
||||||
import logging
|
import logging
|
||||||
|
from unittest.mock import Mock, patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from homeassistant.components import (
|
from homeassistant.components import (
|
||||||
|
alarm_control_panel,
|
||||||
binary_sensor,
|
binary_sensor,
|
||||||
camera,
|
camera,
|
||||||
cover,
|
cover,
|
||||||
fan,
|
fan,
|
||||||
|
group,
|
||||||
input_boolean,
|
input_boolean,
|
||||||
light,
|
light,
|
||||||
lock,
|
lock,
|
||||||
@ -17,33 +20,33 @@ from homeassistant.components import (
|
|||||||
sensor,
|
sensor,
|
||||||
switch,
|
switch,
|
||||||
vacuum,
|
vacuum,
|
||||||
group,
|
|
||||||
alarm_control_panel,
|
|
||||||
)
|
)
|
||||||
from homeassistant.components.climate import const as climate
|
from homeassistant.components.climate import const as climate
|
||||||
from homeassistant.components.google_assistant import trait, helpers, const, error
|
from homeassistant.components.google_assistant import const, error, helpers, trait
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
STATE_ON,
|
ATTR_ASSUMED_STATE,
|
||||||
STATE_OFF,
|
ATTR_DEVICE_CLASS,
|
||||||
|
ATTR_ENTITY_ID,
|
||||||
|
ATTR_SUPPORTED_FEATURES,
|
||||||
|
ATTR_TEMPERATURE,
|
||||||
|
SERVICE_TURN_OFF,
|
||||||
|
SERVICE_TURN_ON,
|
||||||
STATE_ALARM_ARMED_AWAY,
|
STATE_ALARM_ARMED_AWAY,
|
||||||
STATE_ALARM_DISARMED,
|
STATE_ALARM_DISARMED,
|
||||||
STATE_ALARM_PENDING,
|
STATE_ALARM_PENDING,
|
||||||
ATTR_ENTITY_ID,
|
STATE_OFF,
|
||||||
SERVICE_TURN_ON,
|
STATE_ON,
|
||||||
SERVICE_TURN_OFF,
|
STATE_UNKNOWN,
|
||||||
TEMP_CELSIUS,
|
TEMP_CELSIUS,
|
||||||
TEMP_FAHRENHEIT,
|
TEMP_FAHRENHEIT,
|
||||||
ATTR_SUPPORTED_FEATURES,
|
|
||||||
ATTR_TEMPERATURE,
|
|
||||||
ATTR_DEVICE_CLASS,
|
|
||||||
ATTR_ASSUMED_STATE,
|
|
||||||
STATE_UNKNOWN,
|
|
||||||
)
|
)
|
||||||
from homeassistant.core import State, DOMAIN as HA_DOMAIN, EVENT_CALL_SERVICE
|
from homeassistant.core import DOMAIN as HA_DOMAIN, EVENT_CALL_SERVICE, State
|
||||||
from homeassistant.util import color
|
from homeassistant.util import color
|
||||||
from tests.common import async_mock_service, mock_coro
|
|
||||||
from . import BASIC_CONFIG, MockConfig
|
from . import BASIC_CONFIG, MockConfig
|
||||||
|
|
||||||
|
from tests.common import async_mock_service, mock_coro
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
REQ_ID = "ff36a3cc-ec34-11e6-b1a0-64510650abcf"
|
REQ_ID = "ff36a3cc-ec34-11e6-b1a0-64510650abcf"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user