mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-27 20:12:21 +08:00
Big diff: Use new "|" union syntax (#5872)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from typing import IO, Any, Callable, Iterator, Optional, Sequence, Text, Type, TypeVar, Union, overload
|
||||
from typing import IO, Any, Callable, Iterator, Sequence, Text, Type, TypeVar, Union, overload
|
||||
|
||||
from yaml.dumper import * # noqa: F403
|
||||
from yaml.error import * # noqa: F403
|
||||
@@ -29,14 +29,14 @@ def scan(stream, Loader=...): ...
|
||||
def parse(stream, Loader=...): ...
|
||||
def compose(stream, Loader=...): ...
|
||||
def compose_all(stream, Loader=...): ...
|
||||
def load(stream: Union[bytes, IO[bytes], Text, IO[Text]], Loader=...) -> Any: ...
|
||||
def load_all(stream: Union[bytes, IO[bytes], Text, IO[Text]], Loader=...) -> Iterator[Any]: ...
|
||||
def full_load(stream: Union[bytes, IO[bytes], Text, IO[Text]]) -> Any: ...
|
||||
def full_load_all(stream: Union[bytes, IO[bytes], Text, IO[Text]]) -> Iterator[Any]: ...
|
||||
def safe_load(stream: Union[bytes, IO[bytes], Text, IO[Text]]) -> Any: ...
|
||||
def safe_load_all(stream: Union[bytes, IO[bytes], Text, IO[Text]]) -> Iterator[Any]: ...
|
||||
def unsafe_load(stream: Union[bytes, IO[bytes], Text, IO[Text]]) -> Any: ...
|
||||
def unsafe_load_all(stream: Union[bytes, IO[bytes], Text, IO[Text]]) -> Iterator[Any]: ...
|
||||
def load(stream: bytes | IO[bytes] | Text | IO[Text], Loader=...) -> Any: ...
|
||||
def load_all(stream: bytes | IO[bytes] | Text | IO[Text], Loader=...) -> Iterator[Any]: ...
|
||||
def full_load(stream: bytes | IO[bytes] | Text | IO[Text]) -> Any: ...
|
||||
def full_load_all(stream: bytes | IO[bytes] | Text | IO[Text]) -> Iterator[Any]: ...
|
||||
def safe_load(stream: bytes | IO[bytes] | Text | IO[Text]) -> Any: ...
|
||||
def safe_load_all(stream: bytes | IO[bytes] | Text | IO[Text]) -> Iterator[Any]: ...
|
||||
def unsafe_load(stream: bytes | IO[bytes] | Text | IO[Text]) -> Any: ...
|
||||
def unsafe_load_all(stream: bytes | IO[bytes] | Text | IO[Text]) -> Iterator[Any]: ...
|
||||
def emit(events, stream=..., Dumper=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=...): ...
|
||||
@overload
|
||||
def serialize_all(
|
||||
@@ -64,7 +64,7 @@ def serialize_all(
|
||||
width=...,
|
||||
allow_unicode=...,
|
||||
line_break=...,
|
||||
encoding: Optional[_Str] = ...,
|
||||
encoding: _Str | None = ...,
|
||||
explicit_start=...,
|
||||
explicit_end=...,
|
||||
version=...,
|
||||
@@ -98,7 +98,7 @@ def serialize(
|
||||
width=...,
|
||||
allow_unicode=...,
|
||||
line_break=...,
|
||||
encoding: Optional[_Str] = ...,
|
||||
encoding: _Str | None = ...,
|
||||
explicit_start=...,
|
||||
explicit_end=...,
|
||||
version=...,
|
||||
@@ -135,7 +135,7 @@ def dump_all(
|
||||
width=...,
|
||||
allow_unicode=...,
|
||||
line_break=...,
|
||||
encoding: Optional[_Str] = ...,
|
||||
encoding: _Str | None = ...,
|
||||
explicit_start=...,
|
||||
explicit_end=...,
|
||||
version=...,
|
||||
@@ -175,7 +175,7 @@ def dump(
|
||||
width=...,
|
||||
allow_unicode=...,
|
||||
line_break=...,
|
||||
encoding: Optional[_Str] = ...,
|
||||
encoding: _Str | None = ...,
|
||||
explicit_start=...,
|
||||
explicit_end=...,
|
||||
version=...,
|
||||
@@ -213,7 +213,7 @@ def safe_dump_all(
|
||||
width=...,
|
||||
allow_unicode=...,
|
||||
line_break=...,
|
||||
encoding: Optional[_Str] = ...,
|
||||
encoding: _Str | None = ...,
|
||||
explicit_start=...,
|
||||
explicit_end=...,
|
||||
version=...,
|
||||
@@ -251,7 +251,7 @@ def safe_dump(
|
||||
width=...,
|
||||
allow_unicode=...,
|
||||
line_break=...,
|
||||
encoding: Optional[_Str] = ...,
|
||||
encoding: _Str | None = ...,
|
||||
explicit_start=...,
|
||||
explicit_end=...,
|
||||
version=...,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from typing import Any, Dict, Optional
|
||||
from typing import Any, Dict
|
||||
|
||||
from yaml.error import MarkedYAMLError
|
||||
from yaml.nodes import MappingNode, Node, ScalarNode, SequenceNode
|
||||
@@ -9,10 +9,10 @@ class Composer:
|
||||
anchors: Dict[Any, Node]
|
||||
def __init__(self) -> None: ...
|
||||
def check_node(self) -> bool: ...
|
||||
def get_node(self) -> Optional[Node]: ...
|
||||
def get_single_node(self) -> Optional[Node]: ...
|
||||
def compose_document(self) -> Optional[Node]: ...
|
||||
def compose_node(self, parent: Optional[Node], index: int) -> Optional[Node]: ...
|
||||
def get_node(self) -> Node | None: ...
|
||||
def get_single_node(self) -> Node | None: ...
|
||||
def compose_document(self) -> Node | None: ...
|
||||
def compose_node(self, parent: Node | None, index: int) -> Node | None: ...
|
||||
def compose_scalar_node(self, anchor: Dict[Any, Node]) -> ScalarNode: ...
|
||||
def compose_sequence_node(self, anchor: Dict[Any, Node]) -> SequenceNode: ...
|
||||
def compose_mapping_node(self, anchor: Dict[Any, Node]) -> MappingNode: ...
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from _typeshed import SupportsRead
|
||||
from typing import IO, Any, Mapping, Optional, Sequence, Text, Union
|
||||
from typing import IO, Any, Mapping, Sequence, Text, Union
|
||||
|
||||
from yaml.constructor import BaseConstructor, Constructor, SafeConstructor
|
||||
from yaml.representer import BaseRepresenter, Representer, SafeRepresenter
|
||||
@@ -9,16 +9,16 @@ from yaml.serializer import Serializer
|
||||
_Readable = SupportsRead[Union[Text, bytes]]
|
||||
|
||||
class CParser:
|
||||
def __init__(self, stream: Union[str, bytes, _Readable]) -> None: ...
|
||||
def __init__(self, stream: str | bytes | _Readable) -> None: ...
|
||||
|
||||
class CBaseLoader(CParser, BaseConstructor, BaseResolver):
|
||||
def __init__(self, stream: Union[str, bytes, _Readable]) -> None: ...
|
||||
def __init__(self, stream: str | bytes | _Readable) -> None: ...
|
||||
|
||||
class CLoader(CParser, SafeConstructor, Resolver):
|
||||
def __init__(self, stream: Union[str, bytes, _Readable]) -> None: ...
|
||||
def __init__(self, stream: str | bytes | _Readable) -> None: ...
|
||||
|
||||
class CSafeLoader(CParser, SafeConstructor, Resolver):
|
||||
def __init__(self, stream: Union[str, bytes, _Readable]) -> None: ...
|
||||
def __init__(self, stream: str | bytes | _Readable) -> None: ...
|
||||
|
||||
class CDangerLoader(CParser, Constructor, Resolver): ... # undocumented
|
||||
|
||||
@@ -26,34 +26,34 @@ class CEmitter(object):
|
||||
def __init__(
|
||||
self,
|
||||
stream: IO[Any],
|
||||
canonical: Optional[Any] = ...,
|
||||
indent: Optional[int] = ...,
|
||||
width: Optional[int] = ...,
|
||||
allow_unicode: Optional[Any] = ...,
|
||||
line_break: Optional[str] = ...,
|
||||
encoding: Optional[Text] = ...,
|
||||
explicit_start: Optional[Any] = ...,
|
||||
explicit_end: Optional[Any] = ...,
|
||||
version: Optional[Sequence[int]] = ...,
|
||||
tags: Optional[Mapping[Text, Text]] = ...,
|
||||
canonical: Any | None = ...,
|
||||
indent: int | None = ...,
|
||||
width: int | None = ...,
|
||||
allow_unicode: Any | None = ...,
|
||||
line_break: str | None = ...,
|
||||
encoding: Text | None = ...,
|
||||
explicit_start: Any | None = ...,
|
||||
explicit_end: Any | None = ...,
|
||||
version: Sequence[int] | None = ...,
|
||||
tags: Mapping[Text, Text] | None = ...,
|
||||
) -> None: ...
|
||||
|
||||
class CBaseDumper(CEmitter, BaseRepresenter, BaseResolver):
|
||||
def __init__(
|
||||
self,
|
||||
stream: IO[Any],
|
||||
default_style: Optional[str] = ...,
|
||||
default_flow_style: Optional[bool] = ...,
|
||||
canonical: Optional[Any] = ...,
|
||||
indent: Optional[int] = ...,
|
||||
width: Optional[int] = ...,
|
||||
allow_unicode: Optional[Any] = ...,
|
||||
line_break: Optional[str] = ...,
|
||||
encoding: Optional[Text] = ...,
|
||||
explicit_start: Optional[Any] = ...,
|
||||
explicit_end: Optional[Any] = ...,
|
||||
version: Optional[Sequence[int]] = ...,
|
||||
tags: Optional[Mapping[Text, Text]] = ...,
|
||||
default_style: str | None = ...,
|
||||
default_flow_style: bool | None = ...,
|
||||
canonical: Any | None = ...,
|
||||
indent: int | None = ...,
|
||||
width: int | None = ...,
|
||||
allow_unicode: Any | None = ...,
|
||||
line_break: str | None = ...,
|
||||
encoding: Text | None = ...,
|
||||
explicit_start: Any | None = ...,
|
||||
explicit_end: Any | None = ...,
|
||||
version: Sequence[int] | None = ...,
|
||||
tags: Mapping[Text, Text] | None = ...,
|
||||
) -> None: ...
|
||||
|
||||
class CDumper(CEmitter, SafeRepresenter, Resolver): ...
|
||||
|
||||
Reference in New Issue
Block a user