From 5a35e52adf5630e9068a046d661c7808c1e3af1a Mon Sep 17 00:00:00 2001 From: bouni Date: Wed, 16 Oct 2019 10:25:37 +0200 Subject: [PATCH] Move imports in device_tracker component (#27676) * moved imports to top level * sorted imports using isort --- .../components/device_tracker/legacy.py | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/homeassistant/components/device_tracker/legacy.py b/homeassistant/components/device_tracker/legacy.py index 5c186cc12a1..ad7ff3fe3f5 100644 --- a/homeassistant/components/device_tracker/legacy.py +++ b/homeassistant/components/device_tracker/legacy.py @@ -1,11 +1,12 @@ """Legacy device tracker classes.""" import asyncio from datetime import timedelta +import hashlib from typing import Any, List, Sequence import voluptuous as vol -from homeassistant.core import callback +from homeassistant import util from homeassistant.components import zone from homeassistant.components.group import ( ATTR_ADD_ENTITIES, @@ -16,16 +17,7 @@ from homeassistant.components.group import ( SERVICE_SET, ) from homeassistant.components.zone import async_active_zone -from homeassistant.config import load_yaml_config_file, async_log_exception -from homeassistant.exceptions import HomeAssistantError -import homeassistant.helpers.config_validation as cv -from homeassistant.helpers.entity_registry import async_get_registry -from homeassistant.helpers.restore_state import RestoreEntity -from homeassistant.helpers.typing import GPSType, HomeAssistantType -from homeassistant import util -import homeassistant.util.dt as dt_util -from homeassistant.util.yaml import dump - +from homeassistant.config import async_log_exception, load_yaml_config_file from homeassistant.const import ( ATTR_ENTITY_ID, ATTR_GPS_ACCURACY, @@ -37,9 +29,17 @@ from homeassistant.const import ( CONF_MAC, CONF_NAME, DEVICE_DEFAULT_NAME, - STATE_NOT_HOME, STATE_HOME, + STATE_NOT_HOME, ) +from homeassistant.core import callback +from homeassistant.exceptions import HomeAssistantError +import homeassistant.helpers.config_validation as cv +from homeassistant.helpers.entity_registry import async_get_registry +from homeassistant.helpers.restore_state import RestoreEntity +from homeassistant.helpers.typing import GPSType, HomeAssistantType +import homeassistant.util.dt as dt_util +from homeassistant.util.yaml import dump from .const import ( ATTR_BATTERY, @@ -635,7 +635,6 @@ def get_gravatar_for_email(email: str): Async friendly. """ - import hashlib url = "https://www.gravatar.com/avatar/{}.jpg?s=80&d=wavatar" return url.format(hashlib.md5(email.encode("utf-8").lower()).hexdigest())