mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Move imports in crimereports component (#27973)
This commit is contained in:
parent
c44163548d
commit
57b6c2c6b0
@ -3,27 +3,28 @@ from collections import defaultdict
|
|||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import crimereports
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_INCLUDE,
|
|
||||||
CONF_EXCLUDE,
|
|
||||||
CONF_NAME,
|
|
||||||
CONF_LATITUDE,
|
|
||||||
CONF_LONGITUDE,
|
|
||||||
ATTR_ATTRIBUTION,
|
ATTR_ATTRIBUTION,
|
||||||
ATTR_LATITUDE,
|
ATTR_LATITUDE,
|
||||||
ATTR_LONGITUDE,
|
ATTR_LONGITUDE,
|
||||||
|
CONF_EXCLUDE,
|
||||||
|
CONF_INCLUDE,
|
||||||
|
CONF_LATITUDE,
|
||||||
|
CONF_LONGITUDE,
|
||||||
|
CONF_NAME,
|
||||||
CONF_RADIUS,
|
CONF_RADIUS,
|
||||||
LENGTH_KILOMETERS,
|
LENGTH_KILOMETERS,
|
||||||
LENGTH_METERS,
|
LENGTH_METERS,
|
||||||
)
|
)
|
||||||
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
from homeassistant.util import slugify
|
from homeassistant.util import slugify
|
||||||
from homeassistant.util.distance import convert
|
from homeassistant.util.distance import convert
|
||||||
from homeassistant.util.dt import now
|
from homeassistant.util.dt import now
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -65,8 +66,6 @@ class CrimeReportsSensor(Entity):
|
|||||||
|
|
||||||
def __init__(self, hass, name, latitude, longitude, radius, include, exclude):
|
def __init__(self, hass, name, latitude, longitude, radius, include, exclude):
|
||||||
"""Initialize the Crime Reports sensor."""
|
"""Initialize the Crime Reports sensor."""
|
||||||
import crimereports
|
|
||||||
|
|
||||||
self._hass = hass
|
self._hass = hass
|
||||||
self._name = name
|
self._name = name
|
||||||
self._include = include
|
self._include = include
|
||||||
@ -113,8 +112,6 @@ class CrimeReportsSensor(Entity):
|
|||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Update device state."""
|
"""Update device state."""
|
||||||
import crimereports
|
|
||||||
|
|
||||||
incident_counts = defaultdict(int)
|
incident_counts = defaultdict(int)
|
||||||
incidents = self._crimereports.get_incidents(
|
incidents = self._crimereports.get_incidents(
|
||||||
now().date(), include=self._include, exclude=self._exclude
|
now().date(), include=self._include, exclude=self._exclude
|
||||||
|
Loading…
x
Reference in New Issue
Block a user