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)
|
||||
|
||||
|
||||
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))
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in New Issue