From 72e24b84436130f9f840617d8caeee10f6bda94e Mon Sep 17 00:00:00 2001 From: Wilfred Hughes Date: Fri, 20 Oct 2017 18:18:47 +0100 Subject: [PATCH] Add basic type annotations for YAML load functions (#1657) These are probably the most common YAML functions, so this should be useful even without type declarations on the rest of the package. --- third_party/2and3/yaml/__init__.pyi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/third_party/2and3/yaml/__init__.pyi b/third_party/2and3/yaml/__init__.pyi index 8f2edec58..9a9e9d932 100644 --- a/third_party/2and3/yaml/__init__.pyi +++ b/third_party/2and3/yaml/__init__.pyi @@ -1,4 +1,4 @@ -from typing import Any +from typing import Any, Iterator, Union, IO from yaml.error import * # noqa: F403 from yaml.tokens import * # noqa: F403 from yaml.events import * # noqa: F403 @@ -14,10 +14,10 @@ def scan(stream, Loader=...): ... def parse(stream, Loader=...): ... def compose(stream, Loader=...): ... def compose_all(stream, Loader=...): ... -def load(stream, Loader=...): ... -def load_all(stream, Loader=...): ... -def safe_load(stream): ... -def safe_load_all(stream): ... +def load(stream: Union[str, IO[str]], Loader: Loader=...) -> Any: ... +def load_all(stream: Union[str, IO[str]], Loader: Loader=...) -> Iterator[Any]: ... +def safe_load(stream: Union[str, IO[str]]) -> Any: ... +def safe_load_all(stream: Union[str, IO[str]]) -> Iterator[Any]: ... def emit(events, stream=..., Dumper=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=...): ... def serialize_all(nodes, stream=..., Dumper=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding=..., explicit_start=..., explicit_end=..., version=..., tags=...): ... def serialize(node, stream=..., Dumper=..., **kwds): ...