mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Add caching to the distance calculation utility (#107626)
This commit is contained in:
parent
49e3c740cc
commit
1e4d10efe1
@ -5,6 +5,7 @@ detect_location_info and elevation are mocked by default during tests.
|
||||
from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
from functools import lru_cache
|
||||
import math
|
||||
from typing import Any, NamedTuple
|
||||
|
||||
@ -57,6 +58,7 @@ async def async_detect_location_info(
|
||||
return LocationInfo(**data)
|
||||
|
||||
|
||||
@lru_cache
|
||||
def distance(
|
||||
lat1: float | None, lon1: float | None, lat2: float, lon2: float
|
||||
) -> float | None:
|
||||
|
Loading…
x
Reference in New Issue
Block a user