mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
json: mark kwonly args, improve decode (#3679)
* json: mark args as kwonly for py36 on * json: add undocumented arg to JSONDecoder.decode
This commit is contained in:
@@ -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]: ...
|
||||
|
||||
@@ -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]: ...
|
||||
|
||||
Reference in New Issue
Block a user