From 0028a572e8fc63e17cc6a397a5760570f8fb1325 Mon Sep 17 00:00:00 2001 From: correctmost <134317971+correctmost@users.noreply.github.com> Date: Wed, 9 Apr 2025 05:22:02 +0000 Subject: [PATCH] Remove some Any instances from the codebase (#3372) --- archinstall/lib/general.py | 6 +++--- archinstall/lib/models/locale.py | 2 +- archinstall/lib/networking.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py index 22260e21..07565bdc 100644 --- a/archinstall/lib/general.py +++ b/archinstall/lib/general.py @@ -46,7 +46,7 @@ def clear_vt100_escape_codes_from_str(data: str) -> str: return re.sub(_VT100_ESCAPE_REGEX, '', data) -def jsonify(obj: Any, safe: bool = True) -> Any: +def jsonify(obj: object, safe: bool = True) -> object: """ Converts objects into json.dumps() compatible nested dictionaries. Setting safe to True skips dictionary keys starting with a bang (!) @@ -85,7 +85,7 @@ class JSON(json.JSONEncoder, json.JSONDecoder): """ @override - def encode(self, o: Any) -> str: + def encode(self, o: object) -> str: return super().encode(jsonify(o)) @@ -95,7 +95,7 @@ class UNSAFE_JSON(json.JSONEncoder, json.JSONDecoder): """ @override - def encode(self, o: Any) -> str: + def encode(self, o: object) -> str: return super().encode(jsonify(o, safe=False)) diff --git a/archinstall/lib/models/locale.py b/archinstall/lib/models/locale.py index 5ec73c99..897408d9 100644 --- a/archinstall/lib/models/locale.py +++ b/archinstall/lib/models/locale.py @@ -38,7 +38,7 @@ class LocaleConfiguration: return output @classmethod - def _load_config(cls, config: 'LocaleConfiguration', args: dict[str, Any]) -> 'LocaleConfiguration': + def _load_config(cls, config: 'LocaleConfiguration', args: dict[str, str]) -> 'LocaleConfiguration': if 'sys_lang' in args: config.sys_lang = args['sys_lang'] if 'sys_enc' in args: diff --git a/archinstall/lib/networking.py b/archinstall/lib/networking.py index b50c0f79..edc7054f 100644 --- a/archinstall/lib/networking.py +++ b/archinstall/lib/networking.py @@ -7,7 +7,7 @@ import ssl import struct import time from types import FrameType, TracebackType -from typing import Any, Self +from typing import Self from urllib.error import URLError from urllib.parse import urlencode from urllib.request import urlopen @@ -99,7 +99,7 @@ def update_keyring() -> bool: return False -def enrich_iface_types(interfaces: dict[str, Any] | list[str]) -> dict[str, str]: +def enrich_iface_types(interfaces: list[str]) -> dict[str, str]: result = {} for iface in interfaces: