mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +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
|
||||
import logging
|
||||
|
||||
import crimereports
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||
from homeassistant.const import (
|
||||
CONF_INCLUDE,
|
||||
CONF_EXCLUDE,
|
||||
CONF_NAME,
|
||||
CONF_LATITUDE,
|
||||
CONF_LONGITUDE,
|
||||
ATTR_ATTRIBUTION,
|
||||
ATTR_LATITUDE,
|
||||
ATTR_LONGITUDE,
|
||||
CONF_EXCLUDE,
|
||||
CONF_INCLUDE,
|
||||
CONF_LATITUDE,
|
||||
CONF_LONGITUDE,
|
||||
CONF_NAME,
|
||||
CONF_RADIUS,
|
||||
LENGTH_KILOMETERS,
|
||||
LENGTH_METERS,
|
||||
)
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers.entity import Entity
|
||||
from homeassistant.util import slugify
|
||||
from homeassistant.util.distance import convert
|
||||
from homeassistant.util.dt import now
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@ -65,8 +66,6 @@ class CrimeReportsSensor(Entity):
|
||||
|
||||
def __init__(self, hass, name, latitude, longitude, radius, include, exclude):
|
||||
"""Initialize the Crime Reports sensor."""
|
||||
import crimereports
|
||||
|
||||
self._hass = hass
|
||||
self._name = name
|
||||
self._include = include
|
||||
@ -113,8 +112,6 @@ class CrimeReportsSensor(Entity):
|
||||
|
||||
def update(self):
|
||||
"""Update device state."""
|
||||
import crimereports
|
||||
|
||||
incident_counts = defaultdict(int)
|
||||
incidents = self._crimereports.get_incidents(
|
||||
now().date(), include=self._include, exclude=self._exclude
|
||||
|
Loading…
x
Reference in New Issue
Block a user