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