diff --git a/.strict-typing b/.strict-typing index f63122d66bb..d907421d50e 100644 --- a/.strict-typing +++ b/.strict-typing @@ -25,6 +25,7 @@ homeassistant.helpers.translation homeassistant.util.async_ homeassistant.util.color homeassistant.util.decorator +homeassistant.util.location homeassistant.util.process homeassistant.util.unit_system diff --git a/homeassistant/util/location.py b/homeassistant/util/location.py index e653b439e0e..b4d7274ded7 100644 --- a/homeassistant/util/location.py +++ b/homeassistant/util/location.py @@ -6,9 +6,8 @@ detect_location_info and elevation are mocked by default during tests. from __future__ import annotations import asyncio -import collections import math -from typing import Any +from typing import Any, NamedTuple import aiohttp @@ -30,22 +29,21 @@ MILES_PER_KILOMETER = 0.621371 MAX_ITERATIONS = 200 CONVERGENCE_THRESHOLD = 1e-12 -LocationInfo = collections.namedtuple( - "LocationInfo", - [ - "ip", - "country_code", - "currency", - "region_code", - "region_name", - "city", - "zip_code", - "time_zone", - "latitude", - "longitude", - "use_metric", - ], -) + +class LocationInfo(NamedTuple): + """Tuple with location information.""" + + ip: str + country_code: str + currency: str + region_code: str + region_name: str + city: str + zip_code: str + time_zone: str + latitude: float + longitude: float + use_metric: bool async def async_detect_location_info( diff --git a/mypy.ini b/mypy.ini index abd37cb3783..165bca681ff 100644 --- a/mypy.ini +++ b/mypy.ini @@ -86,6 +86,9 @@ disallow_any_generics = true [mypy-homeassistant.util.decorator] disallow_any_generics = true +[mypy-homeassistant.util.location] +disallow_any_generics = true + [mypy-homeassistant.util.process] disallow_any_generics = true