mirror of
https://github.com/home-assistant/core.git
synced 2025-08-01 03:35:09 +02:00
Enable pylint import-outside-toplevel (#33631)
This commit is contained in:
@@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user