Remove some Any instances from the codebase (#3372)
This commit is contained in:
parent
20bd845fbe
commit
0028a572e8
|
|
@ -46,7 +46,7 @@ def clear_vt100_escape_codes_from_str(data: str) -> str:
|
||||||
return re.sub(_VT100_ESCAPE_REGEX, '', data)
|
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.
|
Converts objects into json.dumps() compatible nested dictionaries.
|
||||||
Setting safe to True skips dictionary keys starting with a bang (!)
|
Setting safe to True skips dictionary keys starting with a bang (!)
|
||||||
|
|
@ -85,7 +85,7 @@ class JSON(json.JSONEncoder, json.JSONDecoder):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@override
|
@override
|
||||||
def encode(self, o: Any) -> str:
|
def encode(self, o: object) -> str:
|
||||||
return super().encode(jsonify(o))
|
return super().encode(jsonify(o))
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -95,7 +95,7 @@ class UNSAFE_JSON(json.JSONEncoder, json.JSONDecoder):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@override
|
@override
|
||||||
def encode(self, o: Any) -> str:
|
def encode(self, o: object) -> str:
|
||||||
return super().encode(jsonify(o, safe=False))
|
return super().encode(jsonify(o, safe=False))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class LocaleConfiguration:
|
||||||
return output
|
return output
|
||||||
|
|
||||||
@classmethod
|
@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:
|
if 'sys_lang' in args:
|
||||||
config.sys_lang = args['sys_lang']
|
config.sys_lang = args['sys_lang']
|
||||||
if 'sys_enc' in args:
|
if 'sys_enc' in args:
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import ssl
|
||||||
import struct
|
import struct
|
||||||
import time
|
import time
|
||||||
from types import FrameType, TracebackType
|
from types import FrameType, TracebackType
|
||||||
from typing import Any, Self
|
from typing import Self
|
||||||
from urllib.error import URLError
|
from urllib.error import URLError
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
|
|
@ -99,7 +99,7 @@ def update_keyring() -> bool:
|
||||||
return False
|
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 = {}
|
result = {}
|
||||||
|
|
||||||
for iface in interfaces:
|
for iface in interfaces:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue