from _typeshed import Incomplete from collections.abc import Callable, Generator, Hashable from datetime import date from re import Pattern from types import GeneratorType, ModuleType from typing import ClassVar, TypeVar from typing_extensions import Never from yaml.error import MarkedYAMLError from yaml.nodes import MappingNode, Node, ScalarNode, SequenceNode from .cyaml import _CLoader from .emitter import _YAMLObject from .loader import _Loader _L = TypeVar("_L", bound=_Loader | _CLoader) _N = TypeVar("_N", bound=Node) class ConstructorError(MarkedYAMLError): ... class BaseConstructor: yaml_constructors: ClassVar[dict[str | None, Incomplete]] yaml_multi_constructors: ClassVar[dict[str | None, Incomplete]] constructed_objects: dict[Incomplete, Incomplete] recursive_objects: dict[Incomplete, Incomplete] state_generators: list[GeneratorType[Incomplete, Incomplete, Incomplete]] deep_construct: bool def __init__(self) -> None: ... def check_data(self): ... def check_state_key(self, key: str) -> None: ... def get_data(self) -> _YAMLObject: ... def get_single_data(self) -> _YAMLObject: ... def construct_document(self, node) -> _YAMLObject: ... def construct_object(self, node, deep: bool = False) -> _YAMLObject: ... def construct_scalar(self, node: ScalarNode) -> str: ... def construct_sequence(self, node: SequenceNode, deep: bool = False) -> list[Incomplete]: ... def construct_mapping(self, node: MappingNode, deep: bool = False) -> dict[Hashable, Incomplete]: ... def construct_pairs(self, node, deep: bool = False) -> list[tuple[Incomplete, Incomplete]]: ... @classmethod # Use typevars so we can have covariant behaviour in the parameter types def add_constructor(cls, tag: str, constructor: Callable[[_L, _N], Incomplete]) -> None: ... @classmethod def add_multi_constructor(cls, tag_prefix: str | None, multi_constructor) -> None: ... class SafeConstructor(BaseConstructor): def construct_scalar(self, node: ScalarNode | MappingNode) -> str: ... def flatten_mapping(self, node: MappingNode) -> None: ... def construct_mapping(self, node: MappingNode, deep: bool = False) -> dict[Hashable, Incomplete]: ... def construct_yaml_null(self, node: ScalarNode) -> None: ... bool_values: ClassVar[dict[str, bool]] def construct_yaml_bool(self, node: ScalarNode) -> bool: ... def construct_yaml_int(self, node: ScalarNode) -> int: ... inf_value: ClassVar[float] nan_value: ClassVar[float] def construct_yaml_float(self, node: ScalarNode) -> float: ... def construct_yaml_binary(self, node: ScalarNode) -> bytes: ... timestamp_regexp: ClassVar[Pattern[str]] def construct_yaml_timestamp(self, node: ScalarNode) -> date: ... def construct_yaml_omap(self, node) -> Generator[list[tuple[Incomplete, Incomplete]]]: ... def construct_yaml_pairs(self, node) -> Generator[list[tuple[Incomplete, Incomplete]]]: ... def construct_yaml_set(self, node) -> Generator[set[dict[Hashable, Incomplete]]]: ... def construct_yaml_str(self, node) -> str: ... def construct_yaml_seq(self, node) -> Generator[list[Incomplete]]: ... def construct_yaml_map(self, node) -> Generator[dict[Incomplete, Incomplete]]: ... def construct_yaml_object(self, node, cls) -> Generator[Incomplete]: ... def construct_undefined(self, node) -> Never: ... class FullConstructor(SafeConstructor): def get_state_keys_blacklist(self) -> list[str]: ... def get_state_keys_blacklist_regexp(self) -> Pattern[str]: ... def construct_python_str(self, node) -> str: ... def construct_python_unicode(self, node) -> str: ... def construct_python_bytes(self, node) -> bytes: ... def construct_python_long(self, node) -> int: ... def construct_python_complex(self, node) -> complex: ... def construct_python_tuple(self, node) -> tuple[Incomplete, ...]: ... def find_python_module(self, name: str, mark, unsafe: bool = False) -> ModuleType: ... def find_python_name(self, name: str, mark, unsafe: bool = False): ... def construct_python_name(self, suffix: str, node): ... def construct_python_module(self, suffix: str, node) -> ModuleType: ... def make_python_instance(self, suffix: str, node, args=None, kwds=None, newobj: bool = False, unsafe: bool = False): ... def set_python_instance_state(self, instance: object, state, unsafe: bool = False) -> None: ... def construct_python_object(self, suffix: str, node) -> Generator[Incomplete]: ... def construct_python_object_apply(self, suffix: str, node, newobj: bool = False): ... def construct_python_object_new(self, suffix: str, node): ... class UnsafeConstructor(FullConstructor): def find_python_module(self, name: str, mark) -> ModuleType: ... # type: ignore[override] def find_python_name(self, name: str, mark): ... # type: ignore[override] def make_python_instance(self, suffix: str, node, args=None, kwds=None, newobj: bool = False): ... # type: ignore[override] def set_python_instance_state(self, instance: object, state) -> None: ... # type: ignore[override] class Constructor(SafeConstructor): ... __all__ = ["BaseConstructor", "SafeConstructor", "FullConstructor", "UnsafeConstructor", "Constructor", "ConstructorError"]