mirror of
https://github.com/home-assistant/core.git
synced 2025-05-01 20:57: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.async_
|
||||||
homeassistant.util.color
|
homeassistant.util.color
|
||||||
homeassistant.util.decorator
|
homeassistant.util.decorator
|
||||||
|
homeassistant.util.location
|
||||||
homeassistant.util.process
|
homeassistant.util.process
|
||||||
homeassistant.util.unit_system
|
homeassistant.util.unit_system
|
||||||
|
|
||||||
|
@ -6,9 +6,8 @@ detect_location_info and elevation are mocked by default during tests.
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import collections
|
|
||||||
import math
|
import math
|
||||||
from typing import Any
|
from typing import Any, NamedTuple
|
||||||
|
|
||||||
import aiohttp
|
import aiohttp
|
||||||
|
|
||||||
@ -30,22 +29,21 @@ MILES_PER_KILOMETER = 0.621371
|
|||||||
MAX_ITERATIONS = 200
|
MAX_ITERATIONS = 200
|
||||||
CONVERGENCE_THRESHOLD = 1e-12
|
CONVERGENCE_THRESHOLD = 1e-12
|
||||||
|
|
||||||
LocationInfo = collections.namedtuple(
|
|
||||||
"LocationInfo",
|
class LocationInfo(NamedTuple):
|
||||||
[
|
"""Tuple with location information."""
|
||||||
"ip",
|
|
||||||
"country_code",
|
ip: str
|
||||||
"currency",
|
country_code: str
|
||||||
"region_code",
|
currency: str
|
||||||
"region_name",
|
region_code: str
|
||||||
"city",
|
region_name: str
|
||||||
"zip_code",
|
city: str
|
||||||
"time_zone",
|
zip_code: str
|
||||||
"latitude",
|
time_zone: str
|
||||||
"longitude",
|
latitude: float
|
||||||
"use_metric",
|
longitude: float
|
||||||
],
|
use_metric: bool
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
async def async_detect_location_info(
|
async def async_detect_location_info(
|
||||||
|
3
mypy.ini
3
mypy.ini
@ -86,6 +86,9 @@ disallow_any_generics = true
|
|||||||
[mypy-homeassistant.util.decorator]
|
[mypy-homeassistant.util.decorator]
|
||||||
disallow_any_generics = true
|
disallow_any_generics = true
|
||||||
|
|
||||||
|
[mypy-homeassistant.util.location]
|
||||||
|
disallow_any_generics = true
|
||||||
|
|
||||||
[mypy-homeassistant.util.process]
|
[mypy-homeassistant.util.process]
|
||||||
disallow_any_generics = true
|
disallow_any_generics = true
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user