From d18a724a17485f17d6da34b0aa5a6fe7379edf96 Mon Sep 17 00:00:00 2001 From: Kamil Monicz Date: Sun, 5 Jan 2025 16:05:05 +0000 Subject: [PATCH] Small typing improvements --- country_code_assigner.py | 2 +- openstreetmap.py | 2 +- xmltodict_postprocessor.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/country_code_assigner.py b/country_code_assigner.py index 1d8872f..a519ddf 100644 --- a/country_code_assigner.py +++ b/country_code_assigner.py @@ -2,7 +2,7 @@ class CountryCodeAssigner: __slots__ = 'used' def __init__(self): - self.used = set() + self.used: set[str] = set() def get_unique(self, tags: dict[str, str]) -> str: for check_used in (True, False): diff --git a/openstreetmap.py b/openstreetmap.py index a7015d8..24b32a3 100644 --- a/openstreetmap.py +++ b/openstreetmap.py @@ -16,7 +16,7 @@ def osm_user_has_active_block(user: dict) -> bool: class OpenStreetMap: def __init__(self, access_token: SecretStr): - self.access_token = access_token + self.access_token: SecretStr = access_token @retry_exponential(10) @trace diff --git a/xmltodict_postprocessor.py b/xmltodict_postprocessor.py index 1f121dd..4cc72e6 100644 --- a/xmltodict_postprocessor.py +++ b/xmltodict_postprocessor.py @@ -1,8 +1,8 @@ -def xmltodict_postprocessor(_, key, value): - if key in ('@id', '@ref', '@changeset', '@uid'): +def xmltodict_postprocessor(_, key: str, value: str): + if key in {'@id', '@ref', '@changeset', '@uid'}: return key, int(value) - if key in ('@lon, @lat'): + if key in {'@lon', '@lat'}: return key, float(value) if key == '@version':