diff --git a/stdlib/2/json.pyi b/stdlib/2/json.pyi index 9cc151b27..84ed8b9c3 100644 --- a/stdlib/2/json.pyi +++ b/stdlib/2/json.pyi @@ -1,4 +1,4 @@ -from typing import Any, IO, Optional, Tuple, Callable, Dict, List, Union, Text, Protocol +from typing import Any, IO, Optional, Tuple, Callable, Dict, List, Union, Text, Protocol, Type class JSONDecodeError(ValueError): def dumps(self, obj: Any) -> str: ... @@ -11,7 +11,7 @@ def dumps(obj: Any, ensure_ascii: bool = ..., check_circular: bool = ..., allow_nan: bool = ..., - cls: Any = ..., + cls: Optional[Type[JSONEncoder]] = ..., indent: Optional[int] = ..., separators: Optional[Tuple[str, str]] = ..., encoding: str = ..., @@ -25,7 +25,7 @@ def dump(obj: Any, ensure_ascii: bool = ..., check_circular: bool = ..., allow_nan: bool = ..., - cls: Any = ..., + cls: Optional[Type[JSONEncoder]] = ..., indent: Optional[int] = ..., separators: Optional[Tuple[str, str]] = ..., encoding: str = ..., @@ -35,7 +35,7 @@ def dump(obj: Any, def loads(s: Union[Text, bytes], encoding: Any = ..., - cls: Any = ..., + cls: Optional[Type[JSONDecoder]] = ..., object_hook: Optional[Callable[[Dict], Any]] = ..., parse_float: Optional[Callable[[str], Any]] = ..., parse_int: Optional[Callable[[str], Any]] = ..., @@ -48,7 +48,7 @@ class _Reader(Protocol): def load(fp: _Reader, encoding: Optional[str] = ..., - cls: Any = ..., + cls: Optional[Type[JSONDecoder]] = ..., object_hook: Optional[Callable[[Dict], Any]] = ..., parse_float: Optional[Callable[[str], Any]] = ..., parse_int: Optional[Callable[[str], Any]] = ..., diff --git a/stdlib/3/json/__init__.pyi b/stdlib/3/json/__init__.pyi index 620b239b4..cf42c36c7 100644 --- a/stdlib/3/json/__init__.pyi +++ b/stdlib/3/json/__init__.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, IO, Optional, Tuple, Callable, Dict, List, Union, Protocol +from typing import Any, IO, Optional, Tuple, Callable, Dict, List, Union, Protocol, Type from .decoder import JSONDecoder as JSONDecoder from .encoder import JSONEncoder as JSONEncoder @@ -11,7 +11,7 @@ def dumps(obj: Any, ensure_ascii: bool = ..., check_circular: bool = ..., allow_nan: bool = ..., - cls: Any = ..., + cls: Optional[Type[JSONEncoder]] = ..., indent: Union[None, int, str] = ..., separators: Optional[Tuple[str, str]] = ..., default: Optional[Callable[[Any], Any]] = ..., @@ -24,7 +24,7 @@ def dump(obj: Any, ensure_ascii: bool = ..., check_circular: bool = ..., allow_nan: bool = ..., - cls: Any = ..., + cls: Optional[Type[JSONEncoder]] = ..., indent: Union[None, int, str] = ..., separators: Optional[Tuple[str, str]] = ..., default: Optional[Callable[[Any], Any]] = ..., @@ -37,7 +37,7 @@ else: _LoadsString = str def loads(s: _LoadsString, encoding: Any = ..., # ignored and deprecated - cls: Any = ..., + cls: Optional[Type[JSONDecoder]] = ..., object_hook: Optional[Callable[[Dict], Any]] = ..., parse_float: Optional[Callable[[str], Any]] = ..., parse_int: Optional[Callable[[str], Any]] = ..., @@ -49,7 +49,7 @@ class _Reader(Protocol): def read(self) -> _LoadsString: ... def load(fp: _Reader, - cls: Any = ..., + cls: Optional[Type[JSONDecoder]] = ..., object_hook: Optional[Callable[[Dict], Any]] = ..., parse_float: Optional[Callable[[str], Any]] = ..., parse_int: Optional[Callable[[str], Any]] = ...,