Big diff: Use new "|" union syntax (#5872)

This commit is contained in:
Akuli
2021-08-08 12:05:21 +03:00
committed by GitHub
parent b9adb7a874
commit ee487304d7
578 changed files with 8080 additions and 8966 deletions

View File

@@ -1,5 +1,5 @@
from _typeshed import SupportsRead
from typing import IO, Any, Callable, Dict, List, Optional, Tuple, Type, Union
from typing import IO, Any, Callable, Dict, List, Tuple, Type
from .decoder import JSONDecodeError as JSONDecodeError, JSONDecoder as JSONDecoder
from .encoder import JSONEncoder as JSONEncoder
@@ -11,10 +11,10 @@ def dumps(
ensure_ascii: bool = ...,
check_circular: bool = ...,
allow_nan: bool = ...,
cls: Optional[Type[JSONEncoder]] = ...,
indent: Union[None, int, str] = ...,
separators: Optional[Tuple[str, str]] = ...,
default: Optional[Callable[[Any], Any]] = ...,
cls: Type[JSONEncoder] | None = ...,
indent: None | int | str = ...,
separators: Tuple[str, str] | None = ...,
default: Callable[[Any], Any] | None = ...,
sort_keys: bool = ...,
**kwds: Any,
) -> str: ...
@@ -26,33 +26,33 @@ def dump(
ensure_ascii: bool = ...,
check_circular: bool = ...,
allow_nan: bool = ...,
cls: Optional[Type[JSONEncoder]] = ...,
indent: Union[None, int, str] = ...,
separators: Optional[Tuple[str, str]] = ...,
default: Optional[Callable[[Any], Any]] = ...,
cls: Type[JSONEncoder] | None = ...,
indent: None | int | str = ...,
separators: Tuple[str, str] | None = ...,
default: Callable[[Any], Any] | None = ...,
sort_keys: bool = ...,
**kwds: Any,
) -> None: ...
def loads(
s: Union[str, bytes],
s: str | bytes,
*,
cls: Optional[Type[JSONDecoder]] = ...,
object_hook: Optional[Callable[[Dict[Any, Any]], Any]] = ...,
parse_float: Optional[Callable[[str], Any]] = ...,
parse_int: Optional[Callable[[str], Any]] = ...,
parse_constant: Optional[Callable[[str], Any]] = ...,
object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ...,
cls: Type[JSONDecoder] | None = ...,
object_hook: Callable[[Dict[Any, Any]], Any] | None = ...,
parse_float: Callable[[str], Any] | None = ...,
parse_int: Callable[[str], Any] | None = ...,
parse_constant: Callable[[str], Any] | None = ...,
object_pairs_hook: Callable[[List[Tuple[Any, Any]]], Any] | None = ...,
**kwds: Any,
) -> Any: ...
def load(
fp: SupportsRead[Union[str, bytes]],
fp: SupportsRead[str | bytes],
*,
cls: Optional[Type[JSONDecoder]] = ...,
object_hook: Optional[Callable[[Dict[Any, Any]], Any]] = ...,
parse_float: Optional[Callable[[str], Any]] = ...,
parse_int: Optional[Callable[[str], Any]] = ...,
parse_constant: Optional[Callable[[str], Any]] = ...,
object_pairs_hook: Optional[Callable[[List[Tuple[Any, Any]]], Any]] = ...,
cls: Type[JSONDecoder] | None = ...,
object_hook: Callable[[Dict[Any, Any]], Any] | None = ...,
parse_float: Callable[[str], Any] | None = ...,
parse_int: Callable[[str], Any] | None = ...,
parse_constant: Callable[[str], Any] | None = ...,
object_pairs_hook: Callable[[List[Tuple[Any, Any]]], Any] | None = ...,
**kwds: Any,
) -> Any: ...
def detect_encoding(b: bytes) -> str: ... # undocumented

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, Dict, List, Optional, Tuple
from typing import Any, Callable, Dict, List, Tuple
class JSONDecodeError(ValueError):
msg: str
@@ -18,12 +18,12 @@ class JSONDecoder:
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]] = ...,
object_hook: Callable[[Dict[str, Any]], Any] | None = ...,
parse_float: Callable[[str], Any] | None = ...,
parse_int: Callable[[str], Any] | None = ...,
parse_constant: Callable[[str], Any] | None = ...,
strict: bool = ...,
object_pairs_hook: Optional[Callable[[List[Tuple[str, Any]]], Any]] = ...,
object_pairs_hook: Callable[[List[Tuple[str, Any]]], Any] | None = ...,
) -> None: ...
def decode(self, s: str, _w: Callable[..., Any] = ...) -> Any: ... # _w is undocumented
def raw_decode(self, s: str, idx: int = ...) -> Tuple[Any, int]: ...

View File

@@ -1,4 +1,4 @@
from typing import Any, Callable, Iterator, Optional, Tuple
from typing import Any, Callable, Iterator, Tuple
def py_encode_basestring(s: str) -> str: ... # undocumented
def py_encode_basestring_ascii(s: str) -> str: ... # undocumented
@@ -21,9 +21,9 @@ class JSONEncoder:
check_circular: bool = ...,
allow_nan: bool = ...,
sort_keys: bool = ...,
indent: Optional[int] = ...,
separators: Optional[Tuple[str, str]] = ...,
default: Optional[Callable[..., Any]] = ...,
indent: int | None = ...,
separators: Tuple[str, str] | None = ...,
default: Callable[..., Any] | None = ...,
) -> None: ...
def default(self, o: Any) -> Any: ...
def encode(self, o: Any) -> str: ...