Enable pylint import-outside-toplevel (#33631)

This commit is contained in:
Franck Nijhof
2020-04-04 17:07:36 +02:00
committed by GitHub
parent 9dfcae3dc2
commit b9b1cee403
23 changed files with 47 additions and 23 deletions

View File

@@ -19,7 +19,8 @@ DATA_LOCATION_CACHE = "astral_location_cache"
@bind_hass
def get_astral_location(hass: HomeAssistantType) -> "astral.Location":
"""Get an astral location for the current Home Assistant configuration."""
from astral import Location
from astral import Location # pylint: disable=import-outside-toplevel
latitude = hass.config.latitude
longitude = hass.config.longitude
@@ -58,7 +59,7 @@ def get_location_astral_event_next(
offset: Optional[datetime.timedelta] = None,
) -> datetime.datetime:
"""Calculate the next specified solar event."""
from astral import AstralError
from astral import AstralError # pylint: disable=import-outside-toplevel
if offset is None:
offset = datetime.timedelta()
@@ -92,7 +93,7 @@ def get_astral_event_date(
date: Union[datetime.date, datetime.datetime, None] = None,
) -> Optional[datetime.datetime]:
"""Calculate the astral event time for the specified date."""
from astral import AstralError
from astral import AstralError # pylint: disable=import-outside-toplevel
location = get_astral_location(hass)