mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-06 01:47:41 +08:00
add type hints for yaml.add_constructor and construct_scalar (#4796)
This commit is contained in:
4
third_party/2and3/yaml/__init__.pyi
vendored
4
third_party/2and3/yaml/__init__.pyi
vendored
@@ -1,5 +1,5 @@
|
||||
import sys
|
||||
from typing import IO, Any, Iterator, Optional, Sequence, Text, Union, overload
|
||||
from typing import IO, Any, Callable, Iterator, Optional, Sequence, Text, Union, overload
|
||||
|
||||
from yaml.dumper import * # noqa: F403
|
||||
from yaml.error import * # noqa: F403
|
||||
@@ -256,7 +256,7 @@ def safe_dump(
|
||||
) -> _Yaml: ...
|
||||
def add_implicit_resolver(tag, regexp, first=..., Loader=..., Dumper=...): ...
|
||||
def add_path_resolver(tag, path, kind=..., Loader=..., Dumper=...): ...
|
||||
def add_constructor(tag, constructor, Loader=...): ...
|
||||
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=...): ...
|
||||
|
||||
11
third_party/2and3/yaml/constructor.pyi
vendored
11
third_party/2and3/yaml/constructor.pyi
vendored
@@ -1,7 +1,10 @@
|
||||
import sys
|
||||
from typing import Any
|
||||
from typing import Any, Text, Union
|
||||
|
||||
from yaml.error import MarkedYAMLError
|
||||
from yaml.nodes import ScalarNode
|
||||
|
||||
_Scalar = Union[Text, int, float, bool, None]
|
||||
|
||||
class ConstructorError(MarkedYAMLError): ...
|
||||
|
||||
@@ -15,10 +18,10 @@ class BaseConstructor:
|
||||
def __init__(self) -> None: ...
|
||||
def check_data(self): ...
|
||||
def get_data(self): ...
|
||||
def get_single_data(self): ...
|
||||
def get_single_data(self) -> Any: ...
|
||||
def construct_document(self, node): ...
|
||||
def construct_object(self, node, deep=...): ...
|
||||
def construct_scalar(self, node): ...
|
||||
def construct_scalar(self, node: ScalarNode) -> _Scalar: ...
|
||||
def construct_sequence(self, node, deep=...): ...
|
||||
def construct_mapping(self, node, deep=...): ...
|
||||
def construct_pairs(self, node, deep=...): ...
|
||||
@@ -28,7 +31,7 @@ class BaseConstructor:
|
||||
def add_multi_constructor(cls, tag_prefix, multi_constructor): ...
|
||||
|
||||
class SafeConstructor(BaseConstructor):
|
||||
def construct_scalar(self, node): ...
|
||||
def construct_scalar(self, node: ScalarNode) -> _Scalar: ...
|
||||
def flatten_mapping(self, node): ...
|
||||
def construct_mapping(self, node, deep=...): ...
|
||||
def construct_yaml_null(self, node): ...
|
||||
|
||||
Reference in New Issue
Block a user