Move imports to top for qnap (#29326)

This commit is contained in:
springstan 2019-12-03 00:56:58 +01:00 committed by Martin Hjelmare
parent 1adcdad5a4
commit 61cb0924db

View file

@ -1,26 +1,27 @@
"""Support for QNAP NAS Sensors.""" """Support for QNAP NAS Sensors."""
import logging
from datetime import timedelta from datetime import timedelta
import logging
from qnapstats import QNAPStats
import voluptuous as vol import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.helpers.entity import Entity
from homeassistant.const import ( from homeassistant.const import (
ATTR_NAME,
CONF_HOST, CONF_HOST,
CONF_USERNAME, CONF_MONITORED_CONDITIONS,
CONF_PASSWORD, CONF_PASSWORD,
CONF_PORT, CONF_PORT,
CONF_SSL, CONF_SSL,
ATTR_NAME,
CONF_VERIFY_SSL,
CONF_TIMEOUT, CONF_TIMEOUT,
CONF_MONITORED_CONDITIONS, CONF_USERNAME,
CONF_VERIFY_SSL,
TEMP_CELSIUS, TEMP_CELSIUS,
) )
from homeassistant.util import Throttle
from homeassistant.exceptions import PlatformNotReady from homeassistant.exceptions import PlatformNotReady
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@ -170,7 +171,6 @@ class QNAPStatsAPI:
def __init__(self, config): def __init__(self, config):
"""Initialize the API wrapper.""" """Initialize the API wrapper."""
from qnapstats import QNAPStats
protocol = "https" if config.get(CONF_SSL) else "http" protocol = "https" if config.get(CONF_SSL) else "http"
self._api = QNAPStats( self._api = QNAPStats(