mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
Add stubs for yaml.nodes and yaml.representer (py3) (#5634)
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
This commit is contained in:
@@ -1,31 +1,29 @@
|
||||
from typing import Any
|
||||
from typing import Any, ClassVar
|
||||
|
||||
from yaml.error import Mark
|
||||
|
||||
class Node:
|
||||
tag: Any
|
||||
tag: str
|
||||
value: Any
|
||||
start_mark: Any
|
||||
end_mark: Any
|
||||
def __init__(self, tag, value, start_mark, end_mark) -> None: ...
|
||||
start_mark: Mark | Any
|
||||
end_mark: Mark | Any
|
||||
def __init__(self, tag: str, value, start_mark: Mark | None, end_mark: Mark | None) -> None: ...
|
||||
|
||||
class ScalarNode(Node):
|
||||
id: Any
|
||||
tag: Any
|
||||
value: Any
|
||||
start_mark: Any
|
||||
end_mark: Any
|
||||
style: Any
|
||||
def __init__(self, tag, value, start_mark=..., end_mark=..., style=...) -> None: ...
|
||||
id: ClassVar[str]
|
||||
style: str | Any
|
||||
def __init__(
|
||||
self, tag: str, value, start_mark: Mark | None = ..., end_mark: Mark | None = ..., style: str | None = ...
|
||||
) -> None: ...
|
||||
|
||||
class CollectionNode(Node):
|
||||
tag: Any
|
||||
value: Any
|
||||
start_mark: Any
|
||||
end_mark: Any
|
||||
flow_style: Any
|
||||
def __init__(self, tag, value, start_mark=..., end_mark=..., flow_style=...) -> None: ...
|
||||
flow_style: bool | Any
|
||||
def __init__(
|
||||
self, tag: str, value, start_mark: Mark | None = ..., end_mark: Mark | None = ..., flow_style: bool | None = ...
|
||||
) -> None: ...
|
||||
|
||||
class SequenceNode(CollectionNode):
|
||||
id: Any
|
||||
id: ClassVar[str]
|
||||
|
||||
class MappingNode(CollectionNode):
|
||||
id: Any
|
||||
id: ClassVar[str]
|
||||
|
||||
@@ -1,60 +1,67 @@
|
||||
import datetime
|
||||
import sys
|
||||
from typing import Any
|
||||
from types import BuiltinFunctionType, FunctionType, ModuleType
|
||||
from typing import Any, Callable, ClassVar, Mapping, NoReturn, Sequence, Tuple, Type, TypeVar
|
||||
|
||||
from yaml.error import YAMLError
|
||||
from yaml.error import YAMLError as YAMLError
|
||||
from yaml.nodes import MappingNode as MappingNode, Node as Node, ScalarNode as ScalarNode, SequenceNode as SequenceNode
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_R = TypeVar("_R", bound=BaseRepresenter)
|
||||
|
||||
class RepresenterError(YAMLError): ...
|
||||
|
||||
class BaseRepresenter:
|
||||
yaml_representers: Any
|
||||
yaml_multi_representers: Any
|
||||
default_style: Any
|
||||
default_flow_style: Any
|
||||
yaml_representers: ClassVar[dict[Type[Any], Callable[[BaseRepresenter, Any], Node]]]
|
||||
yaml_multi_representers: ClassVar[dict[Type[Any], Callable[[BaseRepresenter, Any], Node]]]
|
||||
default_style: str | Any
|
||||
sort_keys: bool
|
||||
represented_objects: Any
|
||||
object_keeper: Any
|
||||
alias_key: Any
|
||||
def __init__(self, default_style=..., default_flow_style=..., sort_keys: bool = ...) -> None: ...
|
||||
def represent(self, data): ...
|
||||
default_flow_style: bool
|
||||
represented_objects: dict[int, Node]
|
||||
object_keeper: list[Any]
|
||||
alias_key: int | Any
|
||||
def __init__(self, default_style: str | None = ..., default_flow_style: bool = ..., sort_keys: bool = ...) -> None: ...
|
||||
def represent(self, data) -> None: ...
|
||||
def represent_data(self, data) -> Node: ...
|
||||
if sys.version_info < (3, 0):
|
||||
def get_classobj_bases(self, cls): ...
|
||||
def represent_data(self, data): ...
|
||||
@classmethod
|
||||
def add_representer(cls, data_type, representer): ...
|
||||
def add_representer(cls: Type[_R], data_type: Type[_T], representer: Callable[[_R, _T], Node]) -> None: ...
|
||||
@classmethod
|
||||
def add_multi_representer(cls, data_type, representer): ...
|
||||
def represent_scalar(self, tag, value, style=...): ...
|
||||
def represent_sequence(self, tag, sequence, flow_style=...): ...
|
||||
def represent_mapping(self, tag, mapping, flow_style=...): ...
|
||||
def ignore_aliases(self, data): ...
|
||||
def add_multi_representer(cls: Type[_R], data_type: Type[_T], representer: Callable[[_R, _T], Node]) -> None: ...
|
||||
def represent_scalar(self, tag: str, value, style: str | None = ...) -> ScalarNode: ...
|
||||
def represent_sequence(self, tag: str, sequence: Sequence[Any], flow_style: bool | None = ...) -> SequenceNode: ...
|
||||
def represent_mapping(self, tag: str, mapping: Mapping[Any, Any], flow_style: bool | None = ...) -> MappingNode: ...
|
||||
def ignore_aliases(self, data) -> bool: ...
|
||||
|
||||
class SafeRepresenter(BaseRepresenter):
|
||||
def ignore_aliases(self, data): ...
|
||||
def represent_none(self, data): ...
|
||||
def represent_str(self, data): ...
|
||||
inf_value: ClassVar[float]
|
||||
def ignore_aliases(self, data) -> bool: ...
|
||||
def represent_none(self, data) -> ScalarNode: ...
|
||||
def represent_str(self, data: str) -> ScalarNode: ...
|
||||
if sys.version_info < (3, 0):
|
||||
def represent_unicode(self, data): ...
|
||||
def represent_long(self, data): ...
|
||||
def represent_bool(self, data): ...
|
||||
def represent_int(self, data): ...
|
||||
inf_value: Any
|
||||
def represent_float(self, data): ...
|
||||
def represent_list(self, data): ...
|
||||
def represent_dict(self, data): ...
|
||||
def represent_set(self, data): ...
|
||||
def represent_date(self, data): ...
|
||||
def represent_datetime(self, data): ...
|
||||
def represent_yaml_object(self, tag, data, cls, flow_style=...): ...
|
||||
def represent_undefined(self, data): ...
|
||||
def represent_binary(self, data: bytes) -> ScalarNode: ...
|
||||
def represent_bool(self, data: bool) -> ScalarNode: ...
|
||||
def represent_int(self, data: int) -> ScalarNode: ...
|
||||
def represent_float(self, data: float) -> ScalarNode: ...
|
||||
def represent_list(self, data: Sequence[Any]) -> SequenceNode: ...
|
||||
def represent_dict(self, data: Mapping[Any, Any]) -> MappingNode: ...
|
||||
def represent_set(self, data: set[Any]) -> MappingNode: ...
|
||||
def represent_date(self, data: datetime.date) -> ScalarNode: ...
|
||||
def represent_datetime(self, data: datetime.datetime) -> ScalarNode: ...
|
||||
def represent_yaml_object(self, tag: str, data, cls, flow_style: bool | None = ...) -> MappingNode: ...
|
||||
def represent_undefined(self, data) -> NoReturn: ...
|
||||
|
||||
class Representer(SafeRepresenter):
|
||||
def represent_str(self, data): ...
|
||||
if sys.version_info < (3, 0):
|
||||
def represent_unicode(self, data): ...
|
||||
def represent_long(self, data): ...
|
||||
def represent_instance(self, data): ...
|
||||
def represent_complex(self, data): ...
|
||||
def represent_tuple(self, data): ...
|
||||
def represent_name(self, data): ...
|
||||
def represent_module(self, data): ...
|
||||
def represent_object(self, data): ...
|
||||
def represent_complex(self, data: complex) -> ScalarNode: ...
|
||||
def represent_tuple(self, data: Tuple[Any, ...]) -> SequenceNode: ...
|
||||
def represent_name(self, data: BuiltinFunctionType | FunctionType) -> ScalarNode: ...
|
||||
def represent_module(self, data: ModuleType) -> ScalarNode: ...
|
||||
def represent_object(self, data) -> SequenceNode | MappingNode: ...
|
||||
def represent_ordered_dict(self, data: Mapping[Any, Any]) -> SequenceNode: ...
|
||||
|
||||
Reference in New Issue
Block a user