Add type hints for representer registration functions (#5636)

bump version to the current major release of PyYAML

Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
This commit is contained in:
Oleg Höfling
2021-06-14 17:53:59 +02:00
committed by GitHub
parent 04627bfb83
commit 03809dc604
2 changed files with 8 additions and 4 deletions

View File

@@ -1,2 +1,2 @@
version = "0.1"
version = "5.4"
python2 = true

View File

@@ -1,11 +1,12 @@
import sys
from typing import IO, Any, Callable, Iterator, Optional, Sequence, Text, Union, overload
from typing import IO, Any, Callable, Iterator, Optional, Sequence, Text, Type, TypeVar, Union, overload
from yaml.dumper import * # noqa: F403
from yaml.error import * # noqa: F403
from yaml.events import * # noqa: F403
from yaml.loader import * # noqa: F403
from yaml.nodes import * # noqa: F403
from yaml.representer import BaseRepresenter
from yaml.tokens import * # noqa: F403
from . import resolver as resolver # Help mypy a bit; this is implied by loader and dumper
@@ -21,6 +22,9 @@ _Yaml = Any
__with_libyaml__: Any
__version__: str
_T = TypeVar("_T")
_R = TypeVar("_R", bound=BaseRepresenter)
def scan(stream, Loader=...): ...
def parse(stream, Loader=...): ...
def compose(stream, Loader=...): ...
@@ -258,8 +262,8 @@ def add_implicit_resolver(tag, regexp, first=..., Loader=..., Dumper=...): ...
def add_path_resolver(tag, path, kind=..., Loader=..., Dumper=...): ...
def add_constructor(tag: _Str, constructor: Callable[[Loader, Node], Any], Loader: Loader = ...): ...
def add_multi_constructor(tag_prefix, multi_constructor, Loader=...): ...
def add_representer(data_type, representer, Dumper=...): ...
def add_multi_representer(data_type, multi_representer, Dumper=...): ...
def add_representer(data_type: Type[_T], representer: Callable[[_R, _T], Node], Dumper: Type[_R] = ...) -> None: ...
def add_multi_representer(data_type: Type[_T], multi_representer: Callable[[_R, _T], Node], Dumper: Type[_R] = ...) -> None: ...
class YAMLObjectMetaclass(type):
def __init__(self, name, bases, kwds) -> None: ...