Move imports to top for statistics (#29223)

* Move imports to top for statistics

* Added recorder to manifest.json

* Deleted recorder from manifest.json, moved import back into method, added pylint disable comment

* Moved recorder util imports away from the top

* Move recorder imports to top, add recorder as after_dependency to manifest.json
pull/29523/head
springstan 2019-12-05 18:49:28 +01:00 committed by Franck Nijhof
parent 5bdb20098e
commit 98d2eadb76
1 changed files with 9 additions and 9 deletions

View File

@ -1,25 +1,26 @@
"""Support for statistics for sensor values."""
from collections import deque
import logging
import statistics
from collections import deque
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.recorder.models import States
from homeassistant.components.recorder.util import execute, session_scope
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
CONF_NAME,
CONF_ENTITY_ID,
EVENT_HOMEASSISTANT_START,
STATE_UNKNOWN,
STATE_UNAVAILABLE,
ATTR_UNIT_OF_MEASUREMENT,
CONF_ENTITY_ID,
CONF_NAME,
EVENT_HOMEASSISTANT_START,
STATE_UNAVAILABLE,
STATE_UNKNOWN,
)
from homeassistant.core import callback
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.event import async_track_state_change
from homeassistant.util import dt as dt_util
from homeassistant.components.recorder.util import session_scope, execute
_LOGGER = logging.getLogger(__name__)
@ -275,7 +276,6 @@ class StatisticsSensor(Entity):
If MaxAge is provided then query will restrict to entries younger then
current datetime - MaxAge.
"""
from homeassistant.components.recorder.models import States
_LOGGER.debug("%s: initializing values from the database", self.entity_id)