general: migrate modules to use 3.9 features
This commit is contained in:
parent
d3f9a8e8b6
commit
8496d131e7
125 changed files with 889 additions and 739 deletions
|
@ -2,11 +2,12 @@
|
|||
Provides location/timezone data from IP addresses, using [[https://github.com/seanbreckenridge/ipgeocache][ipgeocache]]
|
||||
"""
|
||||
|
||||
from my.core import __NOT_HPI_MODULE__
|
||||
from my.core import __NOT_HPI_MODULE__ # isort: skip
|
||||
|
||||
import ipaddress
|
||||
from typing import NamedTuple, Iterator, Tuple
|
||||
from collections.abc import Iterator
|
||||
from datetime import datetime
|
||||
from typing import NamedTuple
|
||||
|
||||
import ipgeocache
|
||||
|
||||
|
@ -22,7 +23,7 @@ class IP(NamedTuple):
|
|||
return ipgeocache.get(self.addr)
|
||||
|
||||
@property
|
||||
def latlon(self) -> Tuple[float, float]:
|
||||
def latlon(self) -> tuple[float, float]:
|
||||
loc: str = self.ipgeocache()["loc"]
|
||||
lat, _, lon = loc.partition(",")
|
||||
return float(lat), float(lon)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue