1
- from typing import Optional , Any , Iterator , Sequence , Union , IO
1
+ from typing import Any , IO , Iterator , Optional , overload , Sequence , Text , Union
2
+ import sys
2
3
from yaml .error import * # noqa: F403
3
4
from yaml .tokens import * # noqa: F403
4
5
from yaml .events import * # noqa: F403
@@ -8,6 +9,13 @@ from yaml.dumper import * # noqa: F403
8
9
from . import resolver # Help mypy a bit; this is implied by loader and dumper
9
10
from .cyaml import *
10
11
12
+ if sys .version_info < (3 ,):
13
+ _Str = Union [Text , str ]
14
+ else :
15
+ _Str = str
16
+ # FIXME: the functions really return py2:unicode/py3:str if encoding is None, otherwise py2:str/py3:bytes. Waiting for python/mypy#5621
17
+ _Yaml = Any
18
+
11
19
__with_libyaml__ : Any
12
20
__version__ : str
13
21
@@ -22,12 +30,37 @@ def full_load_all(stream: Union[str, IO[str]]) -> Iterator[Any]: ...
22
30
def safe_load (stream : Union [str , IO [str ]]) -> Any : ...
23
31
def safe_load_all (stream : Union [str , IO [str ]]) -> Iterator [Any ]: ...
24
32
def emit (events , stream = ..., Dumper = ..., canonical = ..., indent = ..., width = ..., allow_unicode = ..., line_break = ...): ...
25
- def serialize_all (nodes , stream = ..., Dumper = ..., canonical = ..., indent = ..., width = ..., allow_unicode = ..., line_break = ..., encoding = ..., explicit_start = ..., explicit_end = ..., version = ..., tags = ...): ...
26
- def serialize (node , stream = ..., Dumper = ..., ** kwds ): ...
27
- 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 = ...) -> Any : ...
28
- def dump (data : Any , stream : Optional [IO [str ]] = ..., Dumper = ..., ** kwds ) -> Any : ...
29
- def safe_dump_all (documents : Sequence [Any ], stream : IO [str ] = ..., ** kwds ) -> Any : ...
30
- def safe_dump (data : Any , stream : IO [str ] = ..., ** kwds ) -> Any : ...
33
+
34
+ @overload
35
+ def serialize_all (nodes , stream : IO [str ], Dumper = ..., canonical = ..., indent = ..., width = ..., allow_unicode = ..., line_break = ..., encoding = ..., explicit_start = ..., explicit_end = ..., version = ..., tags = ...) -> None : ...
36
+ @overload
37
+ def serialize_all (nodes , stream : None = ..., Dumper = ..., canonical = ..., indent = ..., width = ..., allow_unicode = ..., line_break = ..., encoding : Optional [_Str ] = ..., explicit_start = ..., explicit_end = ..., version = ..., tags = ...) -> _Yaml : ...
38
+
39
+ @overload
40
+ def serialize (node , stream : IO [str ], Dumper = ..., canonical = ..., indent = ..., width = ..., allow_unicode = ..., line_break = ..., encoding = ..., explicit_start = ..., explicit_end = ..., version = ..., tags = ...) -> None : ...
41
+ @overload
42
+ def serialize (node , stream : None = ..., Dumper = ..., canonical = ..., indent = ..., width = ..., allow_unicode = ..., line_break = ..., encoding : Optional [_Str ] = ..., explicit_start = ..., explicit_end = ..., version = ..., tags = ...) -> _Yaml : ...
43
+
44
+ @overload
45
+ 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 : ...
46
+ @overload
47
+ def dump_all (documents : Sequence [Any ], stream : None = ..., Dumper = ..., default_style = ..., default_flow_style = ..., canonical = ..., indent = ..., width = ..., allow_unicode = ..., line_break = ..., encoding : Optional [_Str ] = ..., explicit_start = ..., explicit_end = ..., version = ..., tags = ...) -> _Yaml : ...
48
+
49
+ @overload
50
+ 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 : ...
51
+ @overload
52
+ def dump (data : Any , stream : None = ..., Dumper = ..., default_style = ..., default_flow_style = ..., canonical = ..., indent = ..., width = ..., allow_unicode = ..., line_break = ..., encoding : Optional [_Str ] = ..., explicit_start = ..., explicit_end = ..., version = ..., tags = ...) -> _Yaml : ...
53
+
54
+ @overload
55
+ 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 : ...
56
+ @overload
57
+ def save_dump_all (documents : Sequence [Any ], stream : None = ..., default_style = ..., default_flow_style = ..., canonical = ..., indent = ..., width = ..., allow_unicode = ..., line_break = ..., encoding : Optional [_Str ] = ..., explicit_start = ..., explicit_end = ..., version = ..., tags = ...) -> _Yaml : ...
58
+
59
+ @overload
60
+ 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 : ...
61
+ @overload
62
+ def save_dump (data : Any , stream : None = ..., default_style = ..., default_flow_style = ..., canonical = ..., indent = ..., width = ..., allow_unicode = ..., line_break = ..., encoding : Optional [_Str ] = ..., explicit_start = ..., explicit_end = ..., version = ..., tags = ...) -> _Yaml : ...
63
+
31
64
def add_implicit_resolver (tag , regexp , first = ..., Loader = ..., Dumper = ...): ...
32
65
def add_path_resolver (tag , path , kind = ..., Loader = ..., Dumper = ...): ...
33
66
def add_constructor (tag , constructor , Loader = ...): ...
0 commit comments