From 2a92eb1962a54b9b0cf9e349fe00bd0b5028b6b7 Mon Sep 17 00:00:00 2001 From: springstan <46536646+springstan@users.noreply.github.com> Date: Thu, 5 Dec 2019 16:56:01 +0100 Subject: [PATCH] Move imports to top for ipma (#29507) --- homeassistant/components/ipma/__init__.py | 1 + homeassistant/components/ipma/weather.py | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/homeassistant/components/ipma/__init__.py b/homeassistant/components/ipma/__init__.py index 702e12a8a63..a00941624f5 100644 --- a/homeassistant/components/ipma/__init__.py +++ b/homeassistant/components/ipma/__init__.py @@ -1,5 +1,6 @@ """Component for the Portuguese weather service - IPMA.""" from homeassistant.core import Config, HomeAssistant + from .config_flow import IpmaFlowHandler # noqa: F401 from .const import DOMAIN # noqa: F401 diff --git a/homeassistant/components/ipma/weather.py b/homeassistant/components/ipma/weather.py index 9f1836c7389..c088d76d165 100644 --- a/homeassistant/components/ipma/weather.py +++ b/homeassistant/components/ipma/weather.py @@ -1,22 +1,23 @@ """Support for IPMA weather service.""" -import logging from datetime import timedelta +import logging import async_timeout +from pyipma import Station import voluptuous as vol from homeassistant.components.weather import ( - WeatherEntity, - PLATFORM_SCHEMA, ATTR_FORECAST_CONDITION, ATTR_FORECAST_PRECIPITATION, ATTR_FORECAST_TEMP, ATTR_FORECAST_TEMP_LOW, ATTR_FORECAST_TIME, + PLATFORM_SCHEMA, + WeatherEntity, ) -from homeassistant.const import CONF_NAME, TEMP_CELSIUS, CONF_LATITUDE, CONF_LONGITUDE -from homeassistant.helpers.aiohttp_client import async_get_clientsession +from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME, TEMP_CELSIUS from homeassistant.helpers import config_validation as cv +from homeassistant.helpers.aiohttp_client import async_get_clientsession from homeassistant.util import Throttle _LOGGER = logging.getLogger(__name__) @@ -84,7 +85,6 @@ async def async_setup_entry(hass, config_entry, async_add_entities): async def async_get_station(hass, latitude, longitude): """Retrieve weather station, station name to be used as the entity name.""" - from pyipma import Station websession = async_get_clientsession(hass) with async_timeout.timeout(10):