Move imports to top for izone (#29508)

* Move imports to top for izone

* Isorted all imports, fixed tests for config_flow
This commit is contained in:
springstan 2019-12-06 06:08:08 +01:00 committed by Franck Nijhof
parent dc911ecc5b
commit 8def0326dd
5 changed files with 23 additions and 23 deletions

View file

@ -13,7 +13,7 @@ from homeassistant.const import CONF_EXCLUDE
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
from .const import IZONE, DATA_CONFIG
from .const import DATA_CONFIG, IZONE
from .discovery import async_start_discovery_service, async_stop_discovery_service
_LOGGER = logging.getLogger(__name__)

View file

@ -1,22 +1,21 @@
"""Support for the iZone HVAC."""
import logging
from typing import Optional, List
from typing import List, Optional
from pizone import Zone, Controller
from pizone import Controller, Zone
from homeassistant.core import callback
from homeassistant.components.climate import ClimateDevice
from homeassistant.components.climate.const import (
HVAC_MODE_HEAT_COOL,
FAN_AUTO,
FAN_HIGH,
FAN_LOW,
FAN_MEDIUM,
HVAC_MODE_COOL,
HVAC_MODE_DRY,
HVAC_MODE_FAN_ONLY,
HVAC_MODE_HEAT,
HVAC_MODE_HEAT_COOL,
HVAC_MODE_OFF,
FAN_LOW,
FAN_MEDIUM,
FAN_HIGH,
FAN_AUTO,
PRESET_ECO,
PRESET_NONE,
SUPPORT_FAN_MODE,
@ -25,23 +24,24 @@ from homeassistant.components.climate.const import (
)
from homeassistant.const import (
ATTR_TEMPERATURE,
CONF_EXCLUDE,
PRECISION_HALVES,
TEMP_CELSIUS,
CONF_EXCLUDE,
)
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.temperature import display_temp as show_temp
from homeassistant.helpers.typing import ConfigType, HomeAssistantType
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .const import (
DATA_CONFIG,
DATA_DISCOVERY_SERVICE,
IZONE,
DISPATCH_CONTROLLER_DISCOVERED,
DISPATCH_CONTROLLER_DISCONNECTED,
DISPATCH_CONTROLLER_DISCOVERED,
DISPATCH_CONTROLLER_RECONNECTED,
DISPATCH_CONTROLLER_UPDATE,
DISPATCH_ZONE_UPDATE,
DATA_CONFIG,
IZONE,
)
_LOGGER = logging.getLogger(__name__)

View file

@ -1,7 +1,7 @@
"""Config flow for izone."""
import logging
import asyncio
import logging
from async_timeout import timeout
@ -9,14 +9,13 @@ from homeassistant import config_entries
from homeassistant.helpers import config_entry_flow
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .const import IZONE, TIMEOUT_DISCOVERY, DISPATCH_CONTROLLER_DISCOVERED
from .const import DISPATCH_CONTROLLER_DISCOVERED, IZONE, TIMEOUT_DISCOVERY
from .discovery import async_start_discovery_service, async_stop_discovery_service
_LOGGER = logging.getLogger(__name__)
async def _async_has_devices(hass):
from .discovery import async_start_discovery_service, async_stop_discovery_service
controller_ready = asyncio.Event()
async_dispatcher_connect(

View file

@ -1,17 +1,18 @@
"""Internal discovery service for iZone AC."""
import logging
import pizone
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
from homeassistant.helpers import aiohttp_client
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.helpers.dispatcher import async_dispatcher_send
from homeassistant.helpers.typing import HomeAssistantType
from .const import (
DATA_DISCOVERY_SERVICE,
DISPATCH_CONTROLLER_DISCOVERED,
DISPATCH_CONTROLLER_DISCONNECTED,
DISPATCH_CONTROLLER_DISCOVERED,
DISPATCH_CONTROLLER_RECONNECTED,
DISPATCH_CONTROLLER_UPDATE,
DISPATCH_ZONE_UPDATE,

View file

@ -33,9 +33,9 @@ async def test_not_found(hass, mock_disco):
"""Test not finding iZone controller."""
with patch(
"homeassistant.components.izone.discovery.async_start_discovery_service"
"homeassistant.components.izone.config_flow.async_start_discovery_service"
) as start_disco, patch(
"homeassistant.components.izone.discovery.async_stop_discovery_service",
"homeassistant.components.izone.config_flow.async_stop_discovery_service",
return_value=mock_coro(),
) as stop_disco:
start_disco.side_effect = _mock_start_discovery(hass, mock_disco)
@ -62,7 +62,7 @@ async def test_found(hass, mock_disco):
"homeassistant.components.izone.climate.async_setup_entry",
return_value=mock_coro(True),
) as mock_setup, patch(
"homeassistant.components.izone.discovery.async_start_discovery_service"
"homeassistant.components.izone.config_flow.async_start_discovery_service"
) as start_disco, patch(
"homeassistant.components.izone.async_start_discovery_service",
return_value=mock_coro(),