Skip to content

Commit

Permalink
Fix yaml overload
Browse files Browse the repository at this point in the history
Depending on if a "stream" or the "encoding" is given, the functions
either return None, str/unicode or bytes.
Use @overload fix distinguish those cases.

Also fix the functions using **kwds as they delegate their work to the
more generic functions: copy their signatures.
  • Loading branch information
pmhahn committed Oct 25, 2018
1 parent f5e4f7f commit b887713
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions third_party/2and3/yaml/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,46 @@ def safe_load_all(stream: Union[str, IO[str]]) -> Iterator[Any]: ...
def emit(events, stream=..., Dumper=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=...): ...

@overload
def serialize_all(nodes, stream: None=..., Dumper=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> AnyStr: ...
def serialize_all(nodes, stream: None=..., Dumper=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding: None=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> str: ...
@overload
def serialize_all(nodes, stream: None=..., Dumper=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding: str=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> bytes: ...
@overload
def serialize_all(nodes, stream: IO[str], Dumper=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> None: ...

def serialize(node, stream=..., Dumper=..., **kwds): ...
@overload
def serialize(node, stream: None=..., Dumper=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding: None=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> str: ...
@overload
def serialize(node, stream: None=..., Dumper=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding: str=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> bytes: ...
@overload
def serialize(node, stream: IO[str], Dumper=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> None: ...

@overload
def dump_all(documents: Sequence[Any], stream: None=..., Dumper=..., default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> AnyStr: ...
def dump_all(documents: Sequence[Any], stream: None=..., Dumper=..., default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding: None=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> str: ...
@overload
def dump_all(documents: Sequence[Any], stream: None=..., Dumper=..., default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding: str=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> bytes: ...
@overload
def dump_all(documents: Sequence[Any], stream: IO[str], Dumper=..., default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> None: ...

@overload
def dump(data: Any, stream: None=..., Dumper=..., **kwds) -> AnyStr: ...
def dump(data: Any, stream: None=..., Dumper=..., default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding: None=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> str: ...
@overload
def dump(data: Any, stream: None=..., Dumper=..., default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding: str=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> bytes: ...
@overload
def dump(data: Any, stream: IO[str], Dumper=..., **kwds) -> None: ...
def dump(data: Any, stream: IO[str], Dumper=..., default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> None: ...

@overload
def safe_dump_all(documents: Sequence[Any], stream: None=..., **kwds) -> AnyStr: ...
def save_dump_all(documents: Sequence[Any], stream: None=..., default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding: None=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> str: ...
@overload
def safe_dump_all(documents: Sequence[Any], stream: IO[str], **kwds) -> None: ...
def save_dump_all(documents: Sequence[Any], stream: None=..., default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding: str=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> bytes: ...
@overload
def save_dump_all(documents: Sequence[Any], stream: IO[str], default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> None: ...

@overload
def safe_dump(data: Any, stream: None=..., **kwds) -> AnyStr: ...
def save_dump(data: Any, stream: None=..., default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding: None=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> str: ...
@overload
def save_dump(data: Any, stream: None=..., default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding: str=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> bytes: ...
@overload
def safe_dump(data: Any, stream: IO[str], **kwds) -> None: ...
def save_dump(data: Any, stream: IO[str], default_style=..., default_flow_style=..., canonical=..., indent=..., width=..., allow_unicode=..., line_break=..., encoding=..., explicit_start=..., explicit_end=..., version=..., tags=...) -> None: ...

def add_implicit_resolver(tag, regexp, first=..., Loader=..., Dumper=...): ...
def add_path_resolver(tag, path, kind=..., Loader=..., Dumper=...): ...
Expand Down

0 comments on commit b887713

Please sign in to comment.