diff --git a/stdlib/3/json/decoder.pyi b/stdlib/3/json/decoder.pyi index d57a6a9fc..3eb4cf5d9 100644 --- a/stdlib/3/json/decoder.pyi +++ b/stdlib/3/json/decoder.pyi @@ -1,3 +1,4 @@ +import sys from typing import Any, Callable, Dict, List, Optional, Tuple class JSONDecodeError(ValueError): @@ -16,11 +17,26 @@ class JSONDecoder: strict: bool object_pairs_hook: Callable[[List[Tuple[str, Any]]], Any] - def __init__(self, object_hook: Optional[Callable[[Dict[str, Any]], Any]] = ..., - parse_float: Optional[Callable[[str], Any]] = ..., - parse_int: Optional[Callable[[str], Any]] = ..., - parse_constant: Optional[Callable[[str], Any]] = ..., - strict: bool = ..., - object_pairs_hook: Optional[Callable[[List[Tuple[str, Any]]], Any]] = ...) -> None: ... - def decode(self, s: str) -> Any: ... + if sys.version_info >= (3, 6): + def __init__( + self, + *, + object_hook: Optional[Callable[[Dict[str, Any]], Any]] = ..., + parse_float: Optional[Callable[[str], Any]] = ..., + parse_int: Optional[Callable[[str], Any]] = ..., + parse_constant: Optional[Callable[[str], Any]] = ..., + strict: bool = ..., + object_pairs_hook: Optional[Callable[[List[Tuple[str, Any]]], Any]] = ... + ) -> None: ... + else: + def __init__( + self, + object_hook: Optional[Callable[[Dict[str, Any]], Any]] = ..., + parse_float: Optional[Callable[[str], Any]] = ..., + parse_int: Optional[Callable[[str], Any]] = ..., + parse_constant: Optional[Callable[[str], Any]] = ..., + strict: bool = ..., + object_pairs_hook: Optional[Callable[[List[Tuple[str, Any]]], Any]] = ..., + ) -> None: ... + def decode(self, s: str, _w: Callable[..., Any] = ...) -> Any: ... # _w is undocumented def raw_decode(self, s: str, idx: int = ...) -> Tuple[Any, int]: ... diff --git a/stdlib/3/json/encoder.pyi b/stdlib/3/json/encoder.pyi index 63f5ffebe..69e11e102 100644 --- a/stdlib/3/json/encoder.pyi +++ b/stdlib/3/json/encoder.pyi @@ -1,3 +1,4 @@ +import sys from typing import Any, Callable, Iterator, Optional, Tuple class JSONEncoder: @@ -11,11 +12,31 @@ class JSONEncoder: sort_keys: bool indent: int - def __init__(self, skipkeys: bool = ..., ensure_ascii: bool = ..., - check_circular: bool = ..., allow_nan: bool = ..., sort_keys: bool = ..., - indent: Optional[int] = ..., separators: Optional[Tuple[str, str]] = ..., - default: Optional[Callable[..., Any]] = ...) -> None: ... - + if sys.version_info >= (3, 6): + def __init__( + self, + *, + skipkeys: bool = ..., + ensure_ascii: bool = ..., + check_circular: bool = ..., + allow_nan: bool = ..., + sort_keys: bool = ..., + indent: Optional[int] = ..., + separators: Optional[Tuple[str, str]] = ..., + default: Optional[Callable[..., Any]] = ... + ) -> None: ... + else: + def __init__( + self, + skipkeys: bool = ..., + ensure_ascii: bool = ..., + check_circular: bool = ..., + allow_nan: bool = ..., + sort_keys: bool = ..., + indent: Optional[int] = ..., + separators: Optional[Tuple[str, str]] = ..., + default: Optional[Callable[..., Any]] = ..., + ) -> None: ... def default(self, o: Any) -> Any: ... def encode(self, o: Any) -> str: ... def iterencode(self, o: Any, _one_shot: bool = ...) -> Iterator[str]: ...