Skip to content

Commit e784ef1

Browse files
committed
Add basic type annotations for YAML load functions
These are probably the most common YAML functions, so this should be useful even without type declarations on the rest of the package.
1 parent 8982999 commit e784ef1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

third_party/2and3/yaml/__init__.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any
1+
from typing import Any, Iterator, Union, IO
22
from yaml.error import * # noqa: F403
33
from yaml.tokens import * # noqa: F403
44
from yaml.events import * # noqa: F403
@@ -14,10 +14,10 @@ def scan(stream, Loader=...): ...
1414
def parse(stream, Loader=...): ...
1515
def compose(stream, Loader=...): ...
1616
def compose_all(stream, Loader=...): ...
17-
def load(stream, Loader=...): ...
18-
def load_all(stream, Loader=...): ...
19-
def safe_load(stream): ...
20-
def safe_load_all(stream): ...
17+
def load(stream: Union[str, IO[str]], Loader: Loader=...) -> Any: ...
18+
def load_all(stream: Union[str, IO[str]], Loader: Loader=...) -> Iterator[Any]: ...
19+
def safe_load(stream: Union[str, IO[str]]) -> Any: ...
20+
def safe_load_all(stream: Union[str, IO[str]]) -> Iterator[Any]: ...
2121
def emit(events, stream=..., Dumper=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=...): ...
2222
def serialize_all(nodes, stream=..., Dumper=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding=..., explicit_start=..., explicit_end=..., version=..., tags=...): ...
2323
def serialize(node, stream=..., Dumper=..., **kwds): ...

0 commit comments

Comments
 (0)