From e784ef1e18b60b91fa3ce21e327df3a0ae3ae211 Mon Sep 17 00:00:00 2001 From: Wilfred Hughes Date: Mon, 9 Oct 2017 11:46:55 +0100 Subject: [PATCH] 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. --- 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 8f2edec5804f..9a9e9d9323ca 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): ...