Move imports to top for nut (#29368)

This commit is contained in:
springstan 2019-12-04 00:19:43 +01:00 committed by Alexei Chetroi
parent f220c73e8f
commit 655780447c

View File

@ -1,25 +1,26 @@
"""Provides a sensor to track various status aspects of a UPS.""" """Provides a sensor to track various status aspects of a UPS."""
import logging
from datetime import timedelta from datetime import timedelta
import logging
from pynut2.nut2 import PyNUTClient, PyNUTError
import voluptuous as vol import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.components.sensor import PLATFORM_SCHEMA
import homeassistant.helpers.config_validation as cv
from homeassistant.const import ( from homeassistant.const import (
CONF_HOST,
CONF_PORT,
CONF_NAME,
CONF_USERNAME,
CONF_PASSWORD,
TEMP_CELSIUS,
CONF_RESOURCES,
CONF_ALIAS,
ATTR_STATE, ATTR_STATE,
STATE_UNKNOWN, CONF_ALIAS,
CONF_HOST,
CONF_NAME,
CONF_PASSWORD,
CONF_PORT,
CONF_RESOURCES,
CONF_USERNAME,
POWER_WATT, POWER_WATT,
STATE_UNKNOWN,
TEMP_CELSIUS,
) )
from homeassistant.exceptions import PlatformNotReady from homeassistant.exceptions import PlatformNotReady
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity from homeassistant.helpers.entity import Entity
from homeassistant.util import Throttle from homeassistant.util import Throttle
@ -270,7 +271,6 @@ class PyNUTData:
def __init__(self, host, port, alias, username, password): def __init__(self, host, port, alias, username, password):
"""Initialize the data object.""" """Initialize the data object."""
from pynut2.nut2 import PyNUTClient, PyNUTError
self._host = host self._host = host
self._port = port self._port = port