mirror of
https://github.com/home-assistant/core.git
synced 2025-04-26 10:17:51 +00:00
Improve typing [util.location] (#70893)
This commit is contained in:
parent
964c764dae
commit
02ddfd513a
@ -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
|
||||
|
||||
|
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user