general: migrate modules to use 3.9 features

This commit is contained in:
Dima Gerasimov 2024-10-19 22:10:40 +01:00 committed by karlicoss
parent d3f9a8e8b6
commit 8496d131e7
125 changed files with 889 additions and 739 deletions

View file

@ -9,10 +9,9 @@ For an example of how this could be used, see https://github.com/seanbreckenridg
REQUIRES = ["git+https://github.com/seanbreckenridge/ipgeocache"]
from typing import Iterator
from collections.abc import Iterator
from my.core import Stats, warn_if_empty
from my.ip.common import IP

View file

@ -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)