Switch to PEP-604 syntax in python2 stubs (#5915)

Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
This commit is contained in:
Oleg Höfling
2021-08-14 11:12:30 +02:00
committed by GitHub
parent 431c4f7fc1
commit ff63953188
235 changed files with 2473 additions and 2768 deletions

View File

@@ -1,5 +1,5 @@
from _typeshed import SupportsRead
from typing import IO, Any, Callable, Dict, List, Optional, Text, Tuple, Type, Union
from typing import IO, Any, Callable, Dict, List, Text, Tuple, Type
def dumps(
obj: Any,
@@ -7,56 +7,56 @@ def dumps(
ensure_ascii: bool = ...,
check_circular: bool = ...,
allow_nan: bool = ...,
cls: Optional[Type[JSONEncoder]] = ...,
indent: Optional[int] = ...,
separators: Optional[Tuple[str, str]] = ...,
cls: Type[JSONEncoder] | None = ...,
indent: int | None = ...,
separators: Tuple[str, str] | None = ...,
encoding: str = ...,
default: Optional[Callable[[Any], Any]] = ...,
default: Callable[[Any], Any] | None = ...,
sort_keys: bool = ...,
**kwds: Any,
) -> str: ...
def dump(
obj: Any,
fp: Union[IO[str], IO[Text]],
fp: IO[str] | IO[Text],
skipkeys: bool = ...,
ensure_ascii: bool = ...,
check_circular: bool = ...,
allow_nan: bool = ...,
cls: Optional[Type[JSONEncoder]] = ...,
indent: Optional[int] = ...,
separators: Optional[Tuple[str, str]] = ...,
cls: Type[JSONEncoder] | None = ...,
indent: int | None = ...,
separators: Tuple[str, str] | None = ...,
encoding: str = ...,
default: Optional[Callable[[Any], Any]] = ...,
default: Callable[[Any], Any] | None = ...,
sort_keys: bool = ...,
**kwds: Any,
) -> None: ...
def loads(
s: Union[Text, bytes],
s: Text | bytes,
encoding: Any = ...,
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[Text, bytes]],
encoding: Optional[str] = ...,
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]] = ...,
fp: SupportsRead[Text | bytes],
encoding: str | None = ...,
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: ...
class JSONDecoder(object):
def __init__(
self,
encoding: Union[Text, bytes] = ...,
encoding: Text | bytes = ...,
object_hook: Callable[..., Any] = ...,
parse_float: Callable[[str], float] = ...,
parse_int: Callable[[str], int] = ...,
@@ -64,8 +64,8 @@ class JSONDecoder(object):
strict: bool = ...,
object_pairs_hook: Callable[..., Any] = ...,
) -> None: ...
def decode(self, s: Union[Text, bytes], _w: Any = ...) -> Any: ...
def raw_decode(self, s: Union[Text, bytes], idx: int = ...) -> Tuple[Any, Any]: ...
def decode(self, s: Text | bytes, _w: Any = ...) -> Any: ...
def raw_decode(self, s: Text | bytes, idx: int = ...) -> Tuple[Any, Any]: ...
class JSONEncoder(object):
item_separator: str
@@ -75,7 +75,7 @@ class JSONEncoder(object):
check_circular: bool
allow_nan: bool
sort_keys: bool
indent: Optional[int]
indent: int | None
def __init__(
self,
skipkeys: bool = ...,
@@ -83,9 +83,9 @@ class JSONEncoder(object):
check_circular: bool = ...,
allow_nan: bool = ...,
sort_keys: bool = ...,
indent: Optional[int] = ...,
separators: Tuple[Union[Text, bytes], Union[Text, bytes]] = ...,
encoding: Union[Text, bytes] = ...,
indent: int | None = ...,
separators: Tuple[Text | bytes, Text | bytes] = ...,
encoding: Text | bytes = ...,
default: Callable[..., Any] = ...,
) -> None: ...
def default(self, o: Any) -> Any: ...