Remove type annotation from some Loader args (#1695)

There were two problems AFAICT:
- There are multiple Loader classes without a common base class,
  so this should really be a union or a protocol.
- The argument is supposed to be a class, not an instance.

Rather than figuring out a fix (which would probably require some
nasty refactoring) I'm just going back to the old situation where
these arguments are implicitly annotated with `Any`.

See also https://github.com/python/typeshed/pull/1657#pullrequestreview-72049880
This commit is contained in:
Guido van Rossum
2017-10-27 09:30:16 -07:00
committed by GitHub
parent fcf1d38c57
commit 77c06d411c

View File

@@ -14,8 +14,8 @@ def scan(stream, Loader=...): ...
def parse(stream, Loader=...): ...
def compose(stream, Loader=...): ...
def compose_all(stream, Loader=...): ...
def load(stream: Union[str, IO[str]], Loader: Loader=...) -> Any: ...
def load_all(stream: Union[str, IO[str]], Loader: Loader=...) -> Iterator[Any]: ...
def load(stream: Union[str, IO[str]], Loader=...) -> Any: ...
def load_all(stream: Union[str, IO[str]], 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=...): ...