1
0
mirror of https://github.com/home-assistant/core.git synced 2026-05-08 17:49:37 +01:00

Add caching to the distance calculation utility (#107626)

This commit is contained in:
J. Nick Koston
2024-01-08 21:51:56 -10:00
committed by GitHub
parent 49e3c740cc
commit 1e4d10efe1
+2
View File
@@ -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: