diff --git a/poetry.lock b/poetry.lock index 09b82fa8..328c419f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1989,13 +1989,13 @@ files = [ [[package]] name = "pyright" -version = "1.1.358" +version = "1.1.357" description = "Command line wrapper for pyright" optional = false python-versions = ">=3.7" files = [ - {file = "pyright-1.1.358-py3-none-any.whl", hash = "sha256:0995b6a95eb11bd26f093cd5dee3d5e7258441b1b94d4a171b5dc5b79a1d4f4e"}, - {file = "pyright-1.1.358.tar.gz", hash = "sha256:185524a8d52f6f14bbd3b290b92ad905f25b964dddc9e7148aad760bd35c9f60"}, + {file = "pyright-1.1.357-py3-none-any.whl", hash = "sha256:1cf29ee38e4928131895cd8e90eef37b5b77e2ed72a14e6e8e2405266f5f0aca"}, + {file = "pyright-1.1.357.tar.gz", hash = "sha256:7c66261116c78c5fa9629134fe85c54cc5302ab73e376be4b0a99d89c80a9403"}, ] [package.dependencies] @@ -3425,13 +3425,13 @@ standard = ["colorama (>=0.4)", "httptools (>=0.5.0)", "python-dotenv (>=0.13)", [[package]] name = "virtualenv" -version = "20.25.1" +version = "20.25.2" description = "Virtual Python Environment builder" optional = false python-versions = ">=3.7" files = [ - {file = "virtualenv-20.25.1-py3-none-any.whl", hash = "sha256:961c026ac520bac5f69acb8ea063e8a4f071bcc9457b9c1f28f6b085c511583a"}, - {file = "virtualenv-20.25.1.tar.gz", hash = "sha256:e08e13ecdca7a0bd53798f356d5831434afa5b07b93f0abdf0797b7a06ffe197"}, + {file = "virtualenv-20.25.2-py3-none-any.whl", hash = "sha256:6e1281a57849c8a54da89ba82e5eb7c8937b9d057ff01aaf5bc9afaa3552e90f"}, + {file = "virtualenv-20.25.2.tar.gz", hash = "sha256:fa7edb8428620518010928242ec17aa7132ae435319c29c1651d1cf4c4173aad"}, ] [package.dependencies] @@ -3440,7 +3440,7 @@ filelock = ">=3.12.2,<4" platformdirs = ">=3.9.1,<5" [package.extras] -docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"] +docs = ["furo (>=2023.7.26)", "proselint (>=0.13)", "sphinx (>=7.1.2,!=7.3)", "sphinx-argparse (>=0.4)", "sphinxcontrib-towncrier (>=0.2.1a0)", "towncrier (>=23.6)"] test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess (>=1)", "flaky (>=3.7)", "packaging (>=23.1)", "pytest (>=7.4)", "pytest-env (>=0.8.2)", "pytest-freezer (>=0.4.8)", "pytest-mock (>=3.11.1)", "pytest-randomly (>=3.12)", "pytest-timeout (>=2.1)", "setuptools (>=68)", "time-machine (>=2.10)"] [[package]] @@ -3735,4 +3735,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = ">=3.8,<4.0" -content-hash = "5c75d3085ce1d46686416d4a287133ac777485d553822f56dd63965a0de5fd6f" +content-hash = "d275d944145b48ee56866078eeb57829ed6a69e572a93cbe2653f12a2fde700e" diff --git a/pyproject.toml b/pyproject.toml index c4bfd87d..f54752aa 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,23 +64,23 @@ pandas = [ { version = "<=2.0.3", python = "<3.9" }, { version = ">=2.1.1", python = ">=3.12" }, ] -# minimum 8.2.0 to use post-copy mesages -copier = ">=8.2.0" +# minimum 9.2.0 because of breaking dependency changes and changes to validation errors +copier = ">=9.2.0" jinja2-time = ">=0.2.0" # minimum 2.31.0 because of security vulnerability requests = ">=2.31.0" ruamel-yaml = ">=0.17.2" lazy-loader = ">=0.3" # Docutils is a requirement of snakemake, for snakebids otherwise it is merely a doc -# dependency. Can't do 0.21 with poetry because of https://github.com/python-poetry/poetry/issues/9293 -docutils = "!=0.21.1" +# dependency. 0.21.post1 needs to be excluded because of +# https://github.com/python-poetry/poetry/issues/9293 +docutils = "!=0.21.post1" [tool.poetry.group.dev.dependencies] pytest = "^7.0.0" pytest-mock = "^3.7.0" poethepoet = "^0.25.1" pre-commit = "^3.0.0" -# need custom fork of mkinit to handle .pyi files. PR to main repo pending # a mkinit dep has the 'platform_system == "Windows"' as a marker on an incompatible dependeny # (pydantic<2.0 cf copier), so set the inverse as a marker here so mkinit can # still be resolved @@ -90,7 +90,9 @@ pytest-benchmark = "^4.0.0" pyfakefs = "^5.1.0" pyparsing = "^3.0.9" pathvalidate = "^3.0.0" -pyright = "^1.1.339" +# Bug in .358 preventing the types from the converter arguments of attrs classes to +# propogate properly +pyright = "^1.1.339,<1.1.358" ruff = "^0.1.7" pytest-xdist = "^3.3.1" pytest-split = "^0.8.1" diff --git a/snakebids/io/yaml.py b/snakebids/io/yaml.py index 51c8958c..1af98d3a 100644 --- a/snakebids/io/yaml.py +++ b/snakebids/io/yaml.py @@ -14,7 +14,7 @@ def path2str(dumper: Dumper, data: Path): return dumper.represent_scalar( "tag:yaml.org,2002:str", str(data), - ) # type: ignore + ) def to_dict(dumper: Dumper, data: OrderedDict[Any, Any]): return dumper.represent_dict(dict(data)) diff --git a/snakebids/tests/test_generate_inputs.py b/snakebids/tests/test_generate_inputs.py index 9070cab8..d09c3b3c 100644 --- a/snakebids/tests/test_generate_inputs.py +++ b/snakebids/tests/test_generate_inputs.py @@ -1102,7 +1102,9 @@ def test_collects_only_filtered_entities( name="foo", path=get_bids_path(result_filtered), zip_lists=result_filtered ) - @settings(deadline=400, suppress_health_check=[HealthCheck.function_scoped_fixture]) + @settings( + deadline=None, suppress_health_check=[HealthCheck.function_scoped_fixture] + ) @given(path_entities=path_entities()) def test_collect_all_but_filters_when_exclusion_filters_used( self, diff --git a/snakebids/tests/test_template.py b/snakebids/tests/test_template.py index 193354a4..82f08001 100644 --- a/snakebids/tests/test_template.py +++ b/snakebids/tests/test_template.py @@ -11,7 +11,6 @@ import copier import more_itertools as itx import pathvalidate -import prompt_toolkit.validation import pytest import requests_mock from hypothesis import HealthCheck, assume, given, settings @@ -98,7 +97,7 @@ def invalid_emails(): def test_invalid_email_raises_error(email: str, tmp_path: Path): data = get_empty_data("testapp", "setuptools") data["email"] = email - with pytest.raises(prompt_toolkit.validation.ValidationError): + with pytest.raises(ValueError, match="Must be a valid email"): copier.run_copy( str(Path(itx.first(snakebids.__path__), "project_template")), tmp_path / data["app_full_name"], @@ -184,7 +183,7 @@ def test_gets_correct_snakebids_version( @allow_function_scoped def test_invalid_app_name_raises_error(name: str, tmp_path: Path): data = get_empty_data(name, "setuptools") - with pytest.raises(prompt_toolkit.validation.ValidationError): + with pytest.raises(ValueError, match="Name must be a valid"): copier.run_copy( str(Path(itx.first(snakebids.__path__), "project_template")), tmp_path / data["app_full_name"], diff --git a/snakebids/utils/containers.py b/snakebids/utils/containers.py index e6fd146a..ec492e66 100644 --- a/snakebids/utils/containers.py +++ b/snakebids/utils/containers.py @@ -62,8 +62,8 @@ def __repr__(self) -> str: return f"{self.__class__.__name__}({list(self._data)})" @override - def __contains__(self, item: object, /) -> bool: - return item in self._data + def __contains__(self, value: object) -> bool: + return value in self._data @override def __hash__(self): diff --git a/typings/importlib_metadata/__init__.pyi b/typings/importlib_metadata/__init__.pyi deleted file mode 100644 index 9fcb412e..00000000 --- a/typings/importlib_metadata/__init__.pyi +++ /dev/null @@ -1,15 +0,0 @@ -def version(distribution_name: str) -> str: - """Get the version string for the named package. - - :param distribution_name: The name of the distribution package to query. - :return: The version string for the package as defined in the package's - "Version" metadata key. - """ - ... - -class PackageNotFoundError(ModuleNotFoundError): - """The package was not found.""" - - def __str__(self) -> str: ... - @property - def name(self) -> str: ... diff --git a/typings/ruamel/yaml/__init__.pyi b/typings/ruamel/yaml/__init__.pyi new file mode 100644 index 00000000..f34fd510 --- /dev/null +++ b/typings/ruamel/yaml/__init__.pyi @@ -0,0 +1,17 @@ +""" +This type stub file was generated by pyright. +""" + +from __future__ import annotations + +from typing import Any + +from ruamel.yaml.main import * + +from .cyaml import * + +if False: ... +_package_data: dict[Any, Any] = ... +version_info = ... +__version__ = ... +__with_libyaml__ = ... diff --git a/typings/ruamel/yaml/anchor.pyi b/typings/ruamel/yaml/anchor.pyi new file mode 100644 index 00000000..e2601510 --- /dev/null +++ b/typings/ruamel/yaml/anchor.pyi @@ -0,0 +1,12 @@ +""" +This type stub file was generated by pyright. +""" + +if False: ... +anchor_attrib = ... + +class Anchor: + __slots__ = ... + attrib = ... + def __init__(self) -> None: ... + def __repr__(self) -> Any: ... diff --git a/typings/ruamel/yaml/comments.pyi b/typings/ruamel/yaml/comments.pyi new file mode 100644 index 00000000..70111d36 --- /dev/null +++ b/typings/ruamel/yaml/comments.pyi @@ -0,0 +1,295 @@ +""" +This type stub file was generated by pyright. +""" + +from ruamel.yaml.compat import MutableSliceableSequence, ordereddict +from ruamel.yaml.tag import Tag +from collections.abc import Mapping, MutableSet, Set, Sized + +if False: ... +__all__ = [ + "CommentedSeq", + "CommentedKeySeq", + "CommentedMap", + "CommentedOrderedMap", + "CommentedSet", + "comment_attrib", + "merge_attrib", + "TaggedScalar", + "C_POST", + "C_PRE", + "C_SPLIT_ON_FIRST_BLANK", + "C_BLANK_LINE_PRESERVE_SPACE", +] +C_POST = ... +C_PRE = ... +C_SPLIT_ON_FIRST_BLANK = ... +C_BLANK_LINE_PRESERVE_SPACE = ... + +class IDX: + def __init__(self) -> None: ... + def __call__(self) -> Any: ... + def __str__(self) -> Any: ... + +cidx = ... +C_ELEM_EOL = ... +C_KEY_EOL = ... +C_ELEM_PRE = ... +C_ELEM_POST = ... +C_VALUE_PRE = ... +C_KEY_POST = ... +C_TAG_EOL = ... +C_TAG_POST = ... +C_TAG_PRE = ... +C_ANCHOR_EOL = ... +C_ANCHOR_POST = ... +C_ANCHOR_PRE = ... +comment_attrib = ... +format_attrib = ... +line_col_attrib = ... +merge_attrib = ... + +class Comment: + __slots__ = ... + attrib = ... + def __init__(self, old: bool = ...) -> None: ... + def __str__(self) -> str: ... + def __repr__(self) -> str: ... + @property + def items(self) -> Any: ... + @property + def end(self) -> Any: ... + @end.setter + def end(self, value: Any) -> None: ... + @property + def pre(self) -> Any: ... + @pre.setter + def pre(self, value: Any) -> None: ... + def get(self, item: Any, pos: Any) -> Any: ... + def set(self, item: Any, pos: Any, value: Any) -> Any: ... + def __contains__(self, x: Any) -> Any: ... + +class NotNone: ... + +class Format: + __slots__ = ... + attrib = ... + def __init__(self) -> None: ... + def set_flow_style(self) -> None: ... + def set_block_style(self) -> None: ... + def flow_style(self, default: Optional[Any] = ...) -> Any: + """if default (the flow_style) is None, the flow style tacked on to + the object explicitly will be taken. If that is None as well the + default flow style rules the format down the line, or the type + of the constituent values (simple -> flow, map/list -> block)""" + ... + + def __repr__(self) -> str: ... + +class LineCol: + """ + line and column information wrt document, values start at zero (0) + """ + + attrib = ... + def __init__(self) -> None: ... + def add_kv_line_col(self, key: Any, data: Any) -> None: ... + def key(self, k: Any) -> Any: ... + def value(self, k: Any) -> Any: ... + def item(self, idx: Any) -> Any: ... + def add_idx_line_col(self, key: Any, data: Any) -> None: ... + def __repr__(self) -> str: ... + +class CommentedBase: + @property + def ca(self) -> Any: ... + def yaml_end_comment_extend(self, comment: Any, clear: bool = ...) -> None: ... + def yaml_key_comment_extend( + self, key: Any, comment: Any, clear: bool = ... + ) -> None: ... + def yaml_value_comment_extend( + self, key: Any, comment: Any, clear: bool = ... + ) -> None: ... + def yaml_set_start_comment(self, comment: Any, indent: Any = ...) -> None: + """overwrites any preceding comment lines on an object + expects comment to be without `#` and possible have multiple lines + """ + ... + + def yaml_set_comment_before_after_key( + self, + key: Any, + before: Any = ..., + indent: Any = ..., + after: Any = ..., + after_indent: Any = ..., + ) -> None: + """ + expects comment (before/after) to be without `#` and possible have multiple lines + """ + ... + + @property + def fa(self) -> Any: + """format attribute + + set_flow_style()/set_block_style()""" + ... + + def yaml_add_eol_comment( + self, comment: Any, key: Optional[Any] = ..., column: Optional[Any] = ... + ) -> None: + """ + there is a problem as eol comments should start with ' #' + (but at the beginning of the line the space doesn't have to be before + the #. The column index is for the # mark + """ + ... + + @property + def lc(self) -> Any: ... + @property + def anchor(self) -> Any: ... + def yaml_anchor(self) -> Any: ... + def yaml_set_anchor(self, value: Any, always_dump: bool = ...) -> None: ... + @property + def tag(self) -> Any: ... + def yaml_set_ctag(self, value: Tag) -> None: ... + def copy_attributes(self, t: Any, memo: Any = ...) -> Any: + """ + copies the YAML related attributes, not e.g. .values + returns target + """ + ... + +class CommentedSeq(MutableSliceableSequence, list, CommentedBase): + __slots__ = ... + def __init__(self, *args: Any, **kw: Any) -> None: ... + def __getsingleitem__(self, idx: Any) -> Any: ... + def __setsingleitem__(self, idx: Any, value: Any) -> None: ... + def __delsingleitem__(self, idx: Any = ...) -> Any: ... + def __len__(self) -> int: ... + def insert(self, idx: Any, val: Any) -> None: + """the comments after the insertion have to move forward""" + ... + + def extend(self, val: Any) -> None: ... + def __eq__(self, other: Any) -> bool: ... + def __deepcopy__(self, memo: Any) -> Any: ... + def __add__(self, other: Any) -> Any: ... + def sort(self, key: Any = ..., reverse: bool = ...) -> None: ... + def __repr__(self) -> Any: ... + +class CommentedKeySeq(tuple, CommentedBase): + """This primarily exists to be able to roundtrip keys that are sequences""" + + ... + +class CommentedMapView(Sized): + __slots__ = ... + def __init__(self, mapping: Any) -> None: ... + def __len__(self) -> int: ... + +class CommentedMapKeysView(CommentedMapView, Set): + __slots__ = ... + def __contains__(self, key: Any) -> Any: ... + def __iter__(self) -> Any: ... + +class CommentedMapItemsView(CommentedMapView, Set): + __slots__ = ... + def __contains__(self, item: Any) -> Any: ... + def __iter__(self) -> Any: ... + +class CommentedMapValuesView(CommentedMapView): + __slots__ = ... + def __contains__(self, value: Any) -> Any: ... + def __iter__(self) -> Any: ... + +class CommentedMap(ordereddict, CommentedBase): + __slots__ = ... + def __init__(self, *args: Any, **kw: Any) -> None: ... + def update(self, *vals: Any, **kw: Any) -> None: ... + def insert( + self, pos: Any, key: Any, value: Any, comment: Optional[Any] = ... + ) -> None: + """insert key value into given position, as defined by source YAML + attach comment if provided + """ + ... + + def mlget(self, key: Any, default: Any = ..., list_ok: Any = ...) -> Any: + """multi-level get that expects dicts within dicts""" + ... + + def __getitem__(self, key: Any) -> Any: ... + def __setitem__(self, key: Any, value: Any) -> None: ... + def __contains__(self, key: Any) -> bool: ... + def get(self, key: Any, default: Any = ...) -> Any: ... + def __repr__(self) -> Any: ... + def non_merged_items(self) -> Any: ... + def __delitem__(self, key: Any) -> None: ... + def __iter__(self) -> Any: ... + def pop(self, key: Any, default: Any = ...) -> Any: ... + def __len__(self) -> int: ... + def __eq__(self, other: Any) -> bool: ... + def keys(self) -> Any: ... + def values(self) -> Any: ... + def items(self) -> Any: ... + @property + def merge(self) -> Any: ... + def copy(self) -> Any: ... + def add_referent(self, cm: Any) -> None: ... + def add_yaml_merge(self, value: Any) -> None: ... + def update_key_value(self, key: Any) -> None: ... + def __deepcopy__(self, memo: Any) -> Any: ... + +@classmethod +def raise_immutable(cls: Any, *args: Any, **kwargs: Any) -> None: ... + +class CommentedKeyMap(CommentedBase, Mapping): + __slots__ = ... + def __init__(self, *args: Any, **kw: Any) -> None: ... + + update = ... + def __getitem__(self, index: Any) -> Any: ... + def __iter__(self) -> Iterator[Any]: ... + def __len__(self) -> int: ... + def __hash__(self) -> Any: ... + def __repr__(self) -> Any: ... + @classmethod + def fromkeys(keys: Any, v: Any = ...) -> Any: ... + +class CommentedOrderedMap(CommentedMap): + __slots__ = ... + +class CommentedSet(MutableSet, CommentedBase): + __slots__ = ... + def __init__(self, values: Any = ...) -> None: ... + def add(self, value: Any) -> None: + """Add an element.""" + ... + + def discard(self, value: Any) -> None: + """Remove an element. Do not raise an exception if absent.""" + ... + + def __contains__(self, x: Any) -> Any: ... + def __iter__(self) -> Any: ... + def __len__(self) -> int: ... + def __repr__(self) -> str: ... + +class TaggedScalar(CommentedBase): + def __init__(self, value: Any = ..., style: Any = ..., tag: Any = ...) -> None: ... + def __str__(self) -> Any: ... + def count( + self, s: str, start: Optional[int] = ..., end: Optional[int] = ... + ) -> Any: ... + def __getitem__(self, pos: int) -> Any: ... + def __repr__(self) -> str: ... + +def dump_comments(d: Any, name: str = ..., sep: str = ..., out: Any = ...) -> None: + """ + recursively dump comments, all but the toplevel preceded by the path + in dotted form x.0.a + """ + ... diff --git a/typings/ruamel/yaml/compat.pyi b/typings/ruamel/yaml/compat.pyi new file mode 100644 index 00000000..7f272466 --- /dev/null +++ b/typings/ruamel/yaml/compat.pyi @@ -0,0 +1,83 @@ +""" +This type stub file was generated by pyright. +""" + +import collections.abc +import io +import os +from abc import abstractmethod +from collections import OrderedDict +from typing import ( + Any, + Optional, + Union, +) + +from ruamel.yaml.docinfo import Version + +try: + from typing import SupportsIndex as SupportsIndex # in order to reexport for mypy +except ImportError: + SupportsIndex = int # type: ignore + +StreamType = Any +StreamTextType = StreamType +VersionType = Union[str, tuple[int, int], list[int], Version, None] +_DEFAULT_YAML_VERSION = ... + +class ordereddict(OrderedDict): + if not hasattr(OrderedDict, "insert"): + def insert(self, pos: int, key: Any, value: Any) -> None: ... + +StringIO = io.StringIO +BytesIO = io.BytesIO +builtins_module = ... + +def with_metaclass(meta: Any, *bases: Any) -> Any: + """Create a base class with a metaclass.""" + ... + +DBG_TOKEN = ... +DBG_EVENT = ... +DBG_NODE = ... +_debug: Optional[int] = ... +if "RUAMELDEBUG" in os.environ: + _debugx = ... +if bool(_debug): + class ObjectCounter: + def __init__(self) -> None: ... + def __call__(self, k: Any) -> None: ... + def dump(self) -> None: ... + + object_counter = ... + +def dbg(val: Any = ...) -> Any: ... + +class Nprint: + def __init__(self, file_name: Any = ...) -> None: ... + def __call__(self, *args: Any, **kw: Any) -> None: ... + def set_max_print(self, i: int) -> None: ... + def fp(self, mode: str = ...) -> Any: ... + +nprint = ... +nprintf = ... + +def check_namespace_char(ch: Any) -> bool: ... +def check_anchorname_char(ch: Any) -> bool: ... +def version_tnf(t1: Any, t2: Any = ...) -> Any: + """ + return True if ruamel.yaml version_info < t1, None if t2 is specified and bigger else False + """ + ... + +class MutableSliceableSequence(collections.abc.MutableSequence): + __slots__ = ... + def __getitem__(self, index: Any) -> Any: ... + def __setitem__(self, index: Any, value: Any) -> None: ... + def __delitem__(self, index: Any) -> None: ... + @abstractmethod + def __getsingleitem__(self, index: Any) -> Any: ... + @abstractmethod + def __setsingleitem__(self, index: Any, value: Any) -> None: ... + @abstractmethod + def __delsingleitem__(self, index: Any) -> None: ... diff --git a/typings/ruamel/yaml/composer.pyi b/typings/ruamel/yaml/composer.pyi new file mode 100644 index 00000000..d53434c8 --- /dev/null +++ b/typings/ruamel/yaml/composer.pyi @@ -0,0 +1,27 @@ +""" +This type stub file was generated by pyright. +""" + +from ruamel.yaml.error import MarkedYAMLError + +if False: ... +__all__ = ["Composer", "ComposerError"] + +class ComposerError(MarkedYAMLError): ... + +class Composer: + def __init__(self, loader: Any = ...) -> None: ... + @property + def parser(self) -> Any: ... + @property + def resolver(self) -> Any: ... + def check_node(self) -> Any: ... + def get_node(self) -> Any: ... + def get_single_node(self) -> Any: ... + def compose_document(self: Any) -> Any: ... + def return_alias(self, a: Any) -> Any: ... + def compose_node(self, parent: Any, index: Any) -> Any: ... + def compose_scalar_node(self, anchor: Any) -> Any: ... + def compose_sequence_node(self, anchor: Any) -> Any: ... + def compose_mapping_node(self, anchor: Any) -> Any: ... + def check_end_doc_comment(self, end_event: Any, node: Any) -> None: ... diff --git a/typings/ruamel/yaml/configobjwalker.pyi b/typings/ruamel/yaml/configobjwalker.pyi new file mode 100644 index 00000000..63de39ed --- /dev/null +++ b/typings/ruamel/yaml/configobjwalker.pyi @@ -0,0 +1,7 @@ +""" +This type stub file was generated by pyright. +""" + +if False: ... + +def configobj_walker(cfg: Any) -> Any: ... diff --git a/typings/ruamel/yaml/constructor.pyi b/typings/ruamel/yaml/constructor.pyi new file mode 100644 index 00000000..65e2eda8 --- /dev/null +++ b/typings/ruamel/yaml/constructor.pyi @@ -0,0 +1,193 @@ +""" +This type stub file was generated by pyright. +""" + +import datetime +from ruamel.yaml.error import MarkedYAMLError, MarkedYAMLFutureWarning +from ruamel.yaml.nodes import * +from ruamel.yaml.comments import * +from ruamel.yaml.comments import ( + CommentedMap, + CommentedOrderedMap, + CommentedSeq, + CommentedSet, + TaggedScalar, +) +from ruamel.yaml.scalarbool import ScalarBoolean +from ruamel.yaml.timestamp import TimeStamp +from ruamel.yaml.util import timestamp_regexp + +if False: ... +__all__ = [ + "BaseConstructor", + "SafeConstructor", + "Constructor", + "ConstructorError", + "RoundTripConstructor", +] + +class ConstructorError(MarkedYAMLError): ... +class DuplicateKeyFutureWarning(MarkedYAMLFutureWarning): ... +class DuplicateKeyError(MarkedYAMLError): ... + +class BaseConstructor: + yaml_constructors: Dict[Any, Any] = ... + yaml_multi_constructors: Dict[Any, Any] = ... + def __init__( + self, preserve_quotes: Optional[bool] = ..., loader: Any = ... + ) -> None: ... + @property + def composer(self) -> Any: ... + @property + def resolver(self) -> Any: ... + @property + def scanner(self) -> Any: ... + def check_data(self) -> Any: ... + def get_data(self) -> Any: ... + def get_single_data(self) -> Any: ... + def construct_document(self, node: Any) -> Any: ... + def construct_object(self, node: Any, deep: bool = ...) -> Any: + """deep is True when creating an object/mapping recursively, + in that case want the underlying elements available during construction + """ + ... + + def construct_non_recursive_object( + self, node: Any, tag: Optional[str] = ... + ) -> Any: ... + def construct_scalar(self, node: Any) -> Any: ... + def construct_sequence(self, node: Any, deep: bool = ...) -> Any: + """deep is True when creating an object/mapping recursively, + in that case want the underlying elements available during construction + """ + ... + + def construct_mapping(self, node: Any, deep: bool = ...) -> Any: + """deep is True when creating an object/mapping recursively, + in that case want the underlying elements available during construction + """ + ... + + def check_mapping_key( + self, node: Any, key_node: Any, mapping: Any, key: Any, value: Any + ) -> bool: + """return True if key is unique""" + ... + + def check_set_key( + self: Any, node: Any, key_node: Any, setting: Any, key: Any + ) -> None: ... + def construct_pairs(self, node: Any, deep: bool = ...) -> Any: ... + @classmethod + def add_constructor(cls, tag: Any, constructor: Any) -> Any: ... + @classmethod + def add_multi_constructor(cls, tag_prefix: Any, multi_constructor: Any) -> None: ... + @classmethod + def add_default_constructor( + cls, tag: str, method: Any = ..., tag_base: str = ... + ) -> None: ... + +class SafeConstructor(BaseConstructor): + def construct_scalar(self, node: Any) -> Any: ... + def flatten_mapping(self, node: Any) -> Any: + """ + This implements the merge key feature http://yaml.org/type/merge.html + by inserting keys from the merge dict/list of dicts if not yet + available in this node + """ + ... + + def construct_mapping(self, node: Any, deep: bool = ...) -> Any: + """deep is True when creating an object/mapping recursively, + in that case want the underlying elements available during construction + """ + ... + + def construct_yaml_null(self, node: Any) -> Any: ... + + bool_values = ... + def construct_yaml_bool(self, node: Any) -> bool: ... + def construct_yaml_int(self, node: Any) -> int: ... + + inf_value = ... + nan_value = ... + def construct_yaml_float(self, node: Any) -> float: ... + def construct_yaml_binary(self, node: Any) -> Any: ... + + timestamp_regexp = ... + def construct_yaml_timestamp(self, node: Any, values: Any = ...) -> Any: ... + def construct_yaml_omap(self, node: Any) -> Any: ... + def construct_yaml_pairs(self, node: Any) -> Any: ... + def construct_yaml_set(self, node: Any) -> Any: ... + def construct_yaml_str(self, node: Any) -> Any: ... + def construct_yaml_seq(self, node: Any) -> Any: ... + def construct_yaml_map(self, node: Any) -> Any: ... + def construct_yaml_object(self, node: Any, cls: Any) -> Any: ... + def construct_undefined(self, node: Any) -> None: ... + +class Constructor(SafeConstructor): + def construct_python_str(self, node: Any) -> Any: ... + def construct_python_unicode(self, node: Any) -> Any: ... + def construct_python_bytes(self, node: Any) -> Any: ... + def construct_python_long(self, node: Any) -> int: ... + def construct_python_complex(self, node: Any) -> Any: ... + def construct_python_tuple(self, node: Any) -> Any: ... + def find_python_module(self, name: Any, mark: Any) -> Any: ... + def find_python_name(self, name: Any, mark: Any) -> Any: ... + def construct_python_name(self, suffix: Any, node: Any) -> Any: ... + def construct_python_module(self, suffix: Any, node: Any) -> Any: ... + def make_python_instance( + self, + suffix: Any, + node: Any, + args: Any = ..., + kwds: Any = ..., + newobj: bool = ..., + ) -> Any: ... + def set_python_instance_state(self, instance: Any, state: Any) -> None: ... + def construct_python_object(self, suffix: Any, node: Any) -> Any: ... + def construct_python_object_apply( + self, suffix: Any, node: Any, newobj: bool = ... + ) -> Any: ... + def construct_python_object_new(self, suffix: Any, node: Any) -> Any: ... + @classmethod + def add_default_constructor( + cls, tag: str, method: Any = ..., tag_base: str = ... + ) -> None: ... + +class RoundTripConstructor(SafeConstructor): + """need to store the comments on the node itself, + as well as on the items + """ + def comment(self, idx: Any) -> Any: ... + def comments(self, list_of_comments: Any, idx: Optional[Any] = ...) -> Any: ... + def construct_scalar(self, node: Any) -> Any: ... + def construct_yaml_int(self, node: Any) -> Any: ... + def construct_yaml_float(self, node: Any) -> Any: ... + def construct_yaml_str(self, node: Any) -> Any: ... + def construct_rt_sequence( + self, node: Any, seqtyp: Any, deep: bool = ... + ) -> Any: ... + def flatten_mapping(self, node: Any) -> Any: + """ + This implements the merge key feature http://yaml.org/type/merge.html + by inserting keys from the merge dict/list of dicts if not yet + available in this node + """ + ... + + def construct_mapping(self, node: Any, maptyp: Any, deep: bool = ...) -> Any: ... + def construct_setting(self, node: Any, typ: Any, deep: bool = ...) -> Any: ... + def construct_yaml_seq(self, node: Any) -> Iterator[CommentedSeq]: ... + def construct_yaml_map(self, node: Any) -> Iterator[CommentedMap]: ... + def set_collection_style(self, data: Any, node: Any) -> None: ... + def construct_yaml_object(self, node: Any, cls: Any) -> Any: ... + def construct_yaml_omap(self, node: Any) -> Iterator[CommentedOrderedMap]: ... + def construct_yaml_set(self, node: Any) -> Iterator[CommentedSet]: ... + def construct_unknown( + self, node: Any + ) -> Iterator[Union[CommentedMap, TaggedScalar, CommentedSeq]]: ... + def construct_yaml_timestamp( + self, node: Any, values: Any = ... + ) -> Union[datetime.date, datetime.datetime, TimeStamp]: ... + def construct_yaml_sbool(self, node: Any) -> Union[bool, ScalarBoolean]: ... diff --git a/typings/ruamel/yaml/cyaml.pyi b/typings/ruamel/yaml/cyaml.pyi new file mode 100644 index 00000000..7d8f1455 --- /dev/null +++ b/typings/ruamel/yaml/cyaml.pyi @@ -0,0 +1,105 @@ +""" +This type stub file was generated by pyright. +""" + +from _ruamel_yaml import CEmitter, CParser +from ruamel.yaml.constructor import BaseConstructor, Constructor, SafeConstructor +from ruamel.yaml.representer import BaseRepresenter, Representer, SafeRepresenter +from ruamel.yaml.resolver import BaseResolver, Resolver + +if False: ... +__all__ = [ + "CBaseLoader", + "CSafeLoader", + "CLoader", + "CBaseDumper", + "CSafeDumper", + "CDumper", +] + +class CBaseLoader(CParser, BaseConstructor, BaseResolver): + def __init__( + self, + stream: StreamTextType, + version: Optional[VersionType] = ..., + preserve_quotes: Optional[bool] = ..., + ) -> None: ... + +class CSafeLoader(CParser, SafeConstructor, Resolver): + def __init__( + self, + stream: StreamTextType, + version: Optional[VersionType] = ..., + preserve_quotes: Optional[bool] = ..., + ) -> None: ... + +class CLoader(CParser, Constructor, Resolver): + def __init__( + self, + stream: StreamTextType, + version: Optional[VersionType] = ..., + preserve_quotes: Optional[bool] = ..., + ) -> None: ... + +class CBaseDumper(CEmitter, BaseRepresenter, BaseResolver): + def __init__( + self: StreamType, + stream: Any, + default_style: Any = ..., + default_flow_style: Any = ..., + canonical: Optional[bool] = ..., + indent: Optional[int] = ..., + width: Optional[int] = ..., + allow_unicode: Optional[bool] = ..., + line_break: Any = ..., + encoding: Any = ..., + explicit_start: Optional[bool] = ..., + explicit_end: Optional[bool] = ..., + version: Any = ..., + tags: Any = ..., + block_seq_indent: Any = ..., + top_level_colon_align: Any = ..., + prefix_colon: Any = ..., + ) -> None: ... + +class CSafeDumper(CEmitter, SafeRepresenter, Resolver): + def __init__( + self: StreamType, + stream: Any, + default_style: Any = ..., + default_flow_style: Any = ..., + canonical: Optional[bool] = ..., + indent: Optional[int] = ..., + width: Optional[int] = ..., + allow_unicode: Optional[bool] = ..., + line_break: Any = ..., + encoding: Any = ..., + explicit_start: Optional[bool] = ..., + explicit_end: Optional[bool] = ..., + version: Any = ..., + tags: Any = ..., + block_seq_indent: Any = ..., + top_level_colon_align: Any = ..., + prefix_colon: Any = ..., + ) -> None: ... + +class CDumper(CEmitter, Representer, Resolver): + def __init__( + self: StreamType, + stream: Any, + default_style: Any = ..., + default_flow_style: Any = ..., + canonical: Optional[bool] = ..., + indent: Optional[int] = ..., + width: Optional[int] = ..., + allow_unicode: Optional[bool] = ..., + line_break: Any = ..., + encoding: Any = ..., + explicit_start: Optional[bool] = ..., + explicit_end: Optional[bool] = ..., + version: Any = ..., + tags: Any = ..., + block_seq_indent: Any = ..., + top_level_colon_align: Any = ..., + prefix_colon: Any = ..., + ) -> None: ... diff --git a/typings/ruamel/yaml/docinfo.pyi b/typings/ruamel/yaml/docinfo.pyi new file mode 100644 index 00000000..8701e0ad --- /dev/null +++ b/typings/ruamel/yaml/docinfo.pyi @@ -0,0 +1,42 @@ +""" +This type stub file was generated by pyright. +""" + +if False: ... + +class Version: + def __init__(self, major: int, minor: int) -> None: ... + @property + def major(self) -> int: ... + @property + def minor(self) -> int: ... + def __eq__(self, v: Any) -> bool: ... + def __lt__(self, v: Version) -> bool: ... + def __le__(self, v: Version) -> bool: ... + def __gt__(self, v: Version) -> bool: ... + def __ge__(self, v: Version) -> bool: ... + +def version( + major: int | str | Tuple[int, int] | None, minor: Optional[int] = ... +) -> Optional[Version]: ... + +class Tag: + def __init__(self, handle: str, prefix: str) -> None: ... + @property + def handle(self) -> str: ... + @property + def prefix(self) -> str: ... + +class DocInfo: + """ + Store document information, can be used for analysis of a loaded YAML document + requested_version: if explicitly set before load + doc_version: from %YAML directive + tags: from %TAG directives in scanned order + """ + def __init__( + self, + requested_version: Optional[Version] = ..., + doc_version: Optional[Version] = ..., + tags: Optional[list[Tag]] = ..., + ) -> None: ... diff --git a/typings/ruamel/yaml/dumper.pyi b/typings/ruamel/yaml/dumper.pyi new file mode 100644 index 00000000..fcecf4a6 --- /dev/null +++ b/typings/ruamel/yaml/dumper.pyi @@ -0,0 +1,102 @@ +""" +This type stub file was generated by pyright. +""" + +from typing import Any, Optional + +from ruamel.yaml.emitter import Emitter +from ruamel.yaml.representer import ( + BaseRepresenter, + Representer, + RoundTripRepresenter, + SafeRepresenter, +) +from ruamel.yaml.resolver import BaseResolver, Resolver, VersionedResolver +from ruamel.yaml.serializer import Serializer + +if False: ... +__all__ = ["BaseDumper", "SafeDumper", "Dumper", "RoundTripDumper"] + +class BaseDumper(Emitter, Serializer, BaseRepresenter, BaseResolver): + def __init__( + self: Any, + stream: StreamType, + default_style: Any = ..., + default_flow_style: Any = ..., + canonical: Optional[bool] = ..., + indent: Optional[int] = ..., + width: Optional[int] = ..., + allow_unicode: Optional[bool] = ..., + line_break: Any = ..., + encoding: Any = ..., + explicit_start: Optional[bool] = ..., + explicit_end: Optional[bool] = ..., + version: Any = ..., + tags: Any = ..., + block_seq_indent: Any = ..., + top_level_colon_align: Any = ..., + prefix_colon: Any = ..., + ) -> None: ... + +class SafeDumper(Emitter, Serializer, SafeRepresenter, Resolver): + def __init__( + self, + stream: StreamType, + default_style: Any = ..., + default_flow_style: Any = ..., + canonical: Optional[bool] = ..., + indent: Optional[int] = ..., + width: Optional[int] = ..., + allow_unicode: Optional[bool] = ..., + line_break: Any = ..., + encoding: Any = ..., + explicit_start: Optional[bool] = ..., + explicit_end: Optional[bool] = ..., + version: Any = ..., + tags: Any = ..., + block_seq_indent: Any = ..., + top_level_colon_align: Any = ..., + prefix_colon: Any = ..., + ) -> None: ... + +class Dumper(Emitter, Serializer, Representer, Resolver): + def __init__( + self, + stream: StreamType, + default_style: Any = ..., + default_flow_style: Any = ..., + canonical: Optional[bool] = ..., + indent: Optional[int] = ..., + width: Optional[int] = ..., + allow_unicode: Optional[bool] = ..., + line_break: Any = ..., + encoding: Any = ..., + explicit_start: Optional[bool] = ..., + explicit_end: Optional[bool] = ..., + version: Any = ..., + tags: Any = ..., + block_seq_indent: Any = ..., + top_level_colon_align: Any = ..., + prefix_colon: Any = ..., + ) -> None: ... + +class RoundTripDumper(Emitter, Serializer, RoundTripRepresenter, VersionedResolver): + def __init__( + self, + stream: StreamType, + default_style: Any = ..., + default_flow_style: Optional[bool] = ..., + canonical: Optional[int] = ..., + indent: Optional[int] = ..., + width: Optional[int] = ..., + allow_unicode: Optional[bool] = ..., + line_break: Any = ..., + encoding: Any = ..., + explicit_start: Optional[bool] = ..., + explicit_end: Optional[bool] = ..., + version: Any = ..., + tags: Any = ..., + block_seq_indent: Any = ..., + top_level_colon_align: Any = ..., + prefix_colon: Any = ..., + ) -> None: ... diff --git a/typings/ruamel/yaml/emitter.pyi b/typings/ruamel/yaml/emitter.pyi new file mode 100644 index 00000000..cedcd8c0 --- /dev/null +++ b/typings/ruamel/yaml/emitter.pyi @@ -0,0 +1,150 @@ +""" +This type stub file was generated by pyright. +""" + +from ruamel.yaml.error import YAMLError +from ruamel.yaml.events import * + +if False: ... +__all__ = ["Emitter", "EmitterError"] + +class EmitterError(YAMLError): ... + +class ScalarAnalysis: + def __init__( + self, + scalar: Any, + empty: Any, + multiline: Any, + allow_flow_plain: bool, + allow_block_plain: bool, + allow_single_quoted: bool, + allow_double_quoted: bool, + allow_block: bool, + ) -> None: ... + def __repr__(self) -> str: ... + +class Indents: + def __init__(self) -> None: ... + def append(self, val: Any, seq: Any) -> None: ... + def pop(self) -> Any: ... + def seq_seq(self) -> bool: ... + def last_seq(self) -> bool: ... + def seq_flow_align( + self, seq_indent: int, column: int, pre_comment: Optional[bool] = ... + ) -> int: ... + def __len__(self) -> int: ... + +class Emitter: + DEFAULT_TAG_PREFIXES = ... + MAX_SIMPLE_KEY_LENGTH = ... + flow_seq_start = ... + flow_seq_end = ... + flow_seq_separator = ... + flow_map_start = ... + flow_map_end = ... + flow_map_separator = ... + def __init__( + self, + stream: StreamType, + canonical: Any = ..., + indent: Optional[int] = ..., + width: Optional[int] = ..., + allow_unicode: Optional[bool] = ..., + line_break: Any = ..., + block_seq_indent: Optional[int] = ..., + top_level_colon_align: Optional[bool] = ..., + prefix_colon: Any = ..., + brace_single_entry_mapping_in_flow_sequence: Optional[bool] = ..., + dumper: Any = ..., + ) -> None: ... + @property + def stream(self) -> Any: ... + @stream.setter + def stream(self, val: Any) -> None: ... + @property + def serializer(self) -> Any: ... + @property + def flow_level(self) -> int: ... + def dispose(self) -> None: ... + def emit(self, event: Any) -> None: ... + def need_more_events(self) -> bool: ... + def need_events(self, count: int) -> bool: ... + def increase_indent( + self, flow: bool = ..., sequence: Optional[bool] = ..., indentless: bool = ... + ) -> None: ... + def expect_stream_start(self) -> None: ... + def expect_nothing(self) -> None: ... + def expect_first_document_start(self) -> Any: ... + def expect_document_start(self, first: bool = ...) -> None: ... + def expect_document_end(self) -> None: ... + def expect_document_root(self) -> None: ... + def expect_node( + self, + root: bool = ..., + sequence: bool = ..., + mapping: bool = ..., + simple_key: bool = ..., + ) -> None: ... + def expect_alias(self) -> None: ... + def expect_scalar(self) -> None: ... + def expect_flow_sequence(self, force_flow_indent: Optional[bool] = ...) -> None: ... + def expect_first_flow_sequence_item(self) -> None: ... + def expect_flow_sequence_item(self) -> None: ... + def expect_flow_mapping( + self, single: Optional[bool] = ..., force_flow_indent: Optional[bool] = ... + ) -> None: ... + def expect_first_flow_mapping_key(self) -> None: ... + def expect_flow_mapping_key(self) -> None: ... + def expect_flow_mapping_simple_value(self) -> None: ... + def expect_flow_mapping_value(self) -> None: ... + def expect_block_sequence(self) -> None: ... + def expect_first_block_sequence_item(self) -> Any: ... + def expect_block_sequence_item(self, first: bool = ...) -> None: ... + def expect_block_mapping(self) -> None: ... + def expect_first_block_mapping_key(self) -> None: ... + def expect_block_mapping_key(self, first: Any = ...) -> None: ... + def expect_block_mapping_simple_value(self) -> None: ... + def expect_block_mapping_value(self) -> None: ... + def check_empty_sequence(self) -> bool: ... + def check_empty_mapping(self) -> bool: ... + def check_empty_document(self) -> bool: ... + def check_simple_key(self) -> bool: ... + def process_anchor(self, indicator: Any) -> bool: ... + def process_tag(self) -> None: ... + def choose_scalar_style(self) -> Any: ... + def process_scalar(self) -> None: ... + def prepare_version(self, version: Any) -> Any: ... + def prepare_tag_handle(self, handle: Any) -> Any: ... + def prepare_tag_prefix(self, prefix: Any) -> Any: ... + def prepare_tag(self, tag: Any) -> Any: ... + def prepare_anchor(self, anchor: Any) -> Any: ... + def analyze_scalar(self, scalar: Any) -> Any: ... + def flush_stream(self) -> None: ... + def write_stream_start(self) -> None: ... + def write_stream_end(self) -> None: ... + def write_indicator( + self, + indicator: Any, + need_whitespace: Any, + whitespace: bool = ..., + indention: bool = ..., + ) -> None: ... + def write_indent(self) -> None: ... + def write_line_break(self, data: Any = ...) -> None: ... + def write_version_directive(self, version_text: Any) -> None: ... + def write_tag_directive(self, handle_text: Any, prefix_text: Any) -> None: ... + def write_single_quoted(self, text: Any, split: Any = ...) -> None: ... + + ESCAPE_REPLACEMENTS = ... + def write_double_quoted(self, text: Any, split: Any = ...) -> None: ... + def determine_block_hints(self, text: Any) -> Any: ... + def write_folded(self, text: Any, comment: Any) -> None: ... + def write_literal(self, text: Any, comment: Any = ...) -> None: ... + def write_plain(self, text: Any, split: Any = ...) -> None: ... + def write_comment(self, comment: Any, pre: bool = ...) -> None: ... + def write_pre_comment(self, event: Any) -> bool: ... + def write_post_comment(self, event: Any) -> bool: ... + +class RoundTripEmitter(Emitter): + def prepare_tag(self, ctag: Any) -> Any: ... diff --git a/typings/ruamel/yaml/error.pyi b/typings/ruamel/yaml/error.pyi new file mode 100644 index 00000000..59805b7b --- /dev/null +++ b/typings/ruamel/yaml/error.pyi @@ -0,0 +1,94 @@ +""" +This type stub file was generated by pyright. +""" + +if False: ... +__all__ = [ + "FileMark", + "StringMark", + "CommentMark", + "YAMLError", + "MarkedYAMLError", + "ReusedAnchorWarning", + "UnsafeLoaderWarning", + "MarkedYAMLWarning", + "MarkedYAMLFutureWarning", +] + +class StreamMark: + __slots__ = ... + def __init__(self, name: Any, index: int, line: int, column: int) -> None: ... + def __str__(self) -> Any: ... + def __eq__(self, other: Any) -> bool: ... + def __ne__(self, other: Any) -> bool: ... + +class FileMark(StreamMark): + __slots__ = ... + +class StringMark(StreamMark): + __slots__ = ... + def __init__( + self, name: Any, index: int, line: int, column: int, buffer: Any, pointer: Any + ) -> None: ... + def get_snippet(self, indent: int = ..., max_length: int = ...) -> Any: ... + def __str__(self) -> Any: ... + def __repr__(self) -> Any: ... + +class CommentMark: + __slots__ = ... + def __init__(self, column: Any) -> None: ... + +class YAMLError(Exception): ... + +class MarkedYAMLError(YAMLError): + def __init__( + self, + context: Any = ..., + context_mark: Any = ..., + problem: Any = ..., + problem_mark: Any = ..., + note: Any = ..., + warn: Any = ..., + ) -> None: ... + def __str__(self) -> Any: ... + def check_append(self, lines: list[str], val: Optional[str]) -> None: ... + +class YAMLStreamError(Exception): ... +class YAMLWarning(Warning): ... + +class MarkedYAMLWarning(YAMLWarning): + def __init__( + self, + context: Any = ..., + context_mark: Any = ..., + problem: Any = ..., + problem_mark: Any = ..., + note: Any = ..., + warn: Any = ..., + ) -> None: ... + def __str__(self) -> Any: ... + def check_append(self, lines: list[str], val: Optional[str]) -> None: ... + +class ReusedAnchorWarning(YAMLWarning): ... + +class UnsafeLoaderWarning(YAMLWarning): + text = ... + +class MantissaNoDotYAML1_1Warning(YAMLWarning): + def __init__(self, node: Any, flt_str: Any) -> None: ... + def __str__(self) -> Any: ... + +class YAMLFutureWarning(Warning): ... + +class MarkedYAMLFutureWarning(YAMLFutureWarning): + def __init__( + self, + context: Any = ..., + context_mark: Any = ..., + problem: Any = ..., + problem_mark: Any = ..., + note: Any = ..., + warn: Any = ..., + ) -> None: ... + def __str__(self) -> Any: ... + def check_append(self, lines: list[str], val: Optional[str]) -> None: ... diff --git a/typings/ruamel/yaml/events.pyi b/typings/ruamel/yaml/events.pyi new file mode 100644 index 00000000..b6924ae1 --- /dev/null +++ b/typings/ruamel/yaml/events.pyi @@ -0,0 +1,138 @@ +""" +This type stub file was generated by pyright. +""" + +if False: ... +SHOW_LINES = ... + +def CommentCheck() -> None: ... + +class Event: + __slots__ = ... + crepr = ... + def __init__( + self, start_mark: Any = ..., end_mark: Any = ..., comment: Any = ... + ) -> None: ... + def __repr__(self) -> Any: ... + def compact_repr(self) -> str: ... + +class NodeEvent(Event): + __slots__ = ... + def __init__( + self, + anchor: Any, + start_mark: Any = ..., + end_mark: Any = ..., + comment: Any = ..., + ) -> None: ... + +class CollectionStartEvent(NodeEvent): + __slots__ = ... + def __init__( + self, + anchor: Any, + tag: Any, + implicit: Any, + start_mark: Any = ..., + end_mark: Any = ..., + flow_style: Any = ..., + comment: Any = ..., + nr_items: Optional[int] = ..., + ) -> None: ... + @property + def tag(self) -> Optional[str]: ... + +class CollectionEndEvent(Event): + __slots__ = ... + +class StreamStartEvent(Event): + __slots__ = ... + crepr = ... + def __init__( + self, + start_mark: Any = ..., + end_mark: Any = ..., + encoding: Any = ..., + comment: Any = ..., + ) -> None: ... + +class StreamEndEvent(Event): + __slots__ = ... + crepr = ... + +class DocumentStartEvent(Event): + __slots__ = ... + crepr = ... + def __init__( + self, + start_mark: Any = ..., + end_mark: Any = ..., + explicit: Any = ..., + version: Any = ..., + tags: Any = ..., + comment: Any = ..., + ) -> None: ... + def compact_repr(self) -> str: ... + +class DocumentEndEvent(Event): + __slots__ = ... + crepr = ... + def __init__( + self, + start_mark: Any = ..., + end_mark: Any = ..., + explicit: Any = ..., + comment: Any = ..., + ) -> None: ... + def compact_repr(self) -> str: ... + +class AliasEvent(NodeEvent): + __slots__ = ... + crepr = ... + def __init__( + self, + anchor: Any, + start_mark: Any = ..., + end_mark: Any = ..., + style: Any = ..., + comment: Any = ..., + ) -> None: ... + def compact_repr(self) -> str: ... + +class ScalarEvent(NodeEvent): + __slots__ = ... + crepr = ... + def __init__( + self, + anchor: Any, + tag: Any, + implicit: Any, + value: Any, + start_mark: Any = ..., + end_mark: Any = ..., + style: Any = ..., + comment: Any = ..., + ) -> None: ... + @property + def tag(self) -> Optional[str]: ... + @tag.setter + def tag(self, val: Any) -> None: ... + def compact_repr(self) -> str: ... + +class SequenceStartEvent(CollectionStartEvent): + __slots__ = ... + crepr = ... + def compact_repr(self) -> str: ... + +class SequenceEndEvent(CollectionEndEvent): + __slots__ = ... + crepr = ... + +class MappingStartEvent(CollectionStartEvent): + __slots__ = ... + crepr = ... + def compact_repr(self) -> str: ... + +class MappingEndEvent(CollectionEndEvent): + __slots__ = ... + crepr = ... diff --git a/typings/ruamel/yaml/loader.pyi b/typings/ruamel/yaml/loader.pyi new file mode 100644 index 00000000..bc8fc08a --- /dev/null +++ b/typings/ruamel/yaml/loader.pyi @@ -0,0 +1,57 @@ +""" +This type stub file was generated by pyright. +""" + +from ruamel.yaml.reader import Reader +from ruamel.yaml.scanner import RoundTripScanner, Scanner +from ruamel.yaml.parser import Parser, RoundTripParser +from ruamel.yaml.composer import Composer +from ruamel.yaml.constructor import ( + BaseConstructor, + Constructor, + RoundTripConstructor, + SafeConstructor, +) +from ruamel.yaml.resolver import VersionedResolver + +if False: ... +__all__ = ["BaseLoader", "SafeLoader", "Loader", "RoundTripLoader"] + +class BaseLoader(Reader, Scanner, Parser, Composer, BaseConstructor, VersionedResolver): + def __init__( + self, + stream: StreamTextType, + version: Optional[VersionType] = ..., + preserve_quotes: Optional[bool] = ..., + ) -> None: ... + +class SafeLoader(Reader, Scanner, Parser, Composer, SafeConstructor, VersionedResolver): + def __init__( + self, + stream: StreamTextType, + version: Optional[VersionType] = ..., + preserve_quotes: Optional[bool] = ..., + ) -> None: ... + +class Loader(Reader, Scanner, Parser, Composer, Constructor, VersionedResolver): + def __init__( + self, + stream: StreamTextType, + version: Optional[VersionType] = ..., + preserve_quotes: Optional[bool] = ..., + ) -> None: ... + +class RoundTripLoader( + Reader, + RoundTripScanner, + RoundTripParser, + Composer, + RoundTripConstructor, + VersionedResolver, +): + def __init__( + self, + stream: StreamTextType, + version: Optional[VersionType] = ..., + preserve_quotes: Optional[bool] = ..., + ) -> None: ... diff --git a/typings/ruamel/yaml/main.pyi b/typings/ruamel/yaml/main.pyi new file mode 100644 index 00000000..b642d4bd --- /dev/null +++ b/typings/ruamel/yaml/main.pyi @@ -0,0 +1,529 @@ +""" +This type stub file was generated by pyright. +""" + +from pathlib import Path +from types import TracebackType +from typing import Any, Optional, Union + +from _ruamel_yaml import CEmitter +from ruamel.yaml.compat import StreamTextType, StreamType, VersionType, with_metaclass +from ruamel.yaml.constructor import Constructor +from ruamel.yaml.dumper import * +from ruamel.yaml.events import * +from ruamel.yaml.nodes import * +from ruamel.yaml.representer import Representer +from ruamel.yaml.tokens import * + +if False: ... + +class YAML: + def __init__( + self: Any, + *, + typ: Optional[Union[list[str], str]] = ..., + pure: Any = ..., + output: Any = ..., + plug_ins: Any = ..., + ) -> None: + """ + typ: 'rt'/None -> RoundTripLoader/RoundTripDumper, (default) + 'safe' -> SafeLoader/SafeDumper, + 'unsafe' -> normal/unsafe Loader/Dumper (pending deprecation) + 'full' -> full Dumper only, including python built-ins that are + potentially unsafe to load + 'base' -> baseloader + pure: if True only use Python modules + input/output: needed to work as context manager + plug_ins: a list of plug-in files + """ + ... + + @property + def reader(self) -> Any: ... + @property + def scanner(self) -> Any: ... + @property + def parser(self) -> Any: ... + @property + def composer(self) -> Any: ... + @property + def constructor(self) -> Any: ... + @property + def resolver(self) -> Any: ... + @property + def emitter(self) -> Any: ... + @property + def serializer(self) -> Any: ... + @property + def representer(self) -> Any: ... + def scan(self, stream: StreamTextType) -> Any: + """ + Scan a YAML stream and produce scanning tokens. + """ + ... + + def parse(self, stream: StreamTextType) -> Any: + """ + Parse a YAML stream and produce parsing events. + """ + ... + + def compose(self, stream: Union[Path, StreamTextType]) -> Any: + """ + Parse the first YAML document in a stream + and produce the corresponding representation tree. + """ + ... + + def compose_all(self, stream: Union[Path, StreamTextType]) -> Any: + """ + Parse all YAML documents in a stream + and produce corresponding representation trees. + """ + ... + + def load(self, stream: Union[Path, StreamTextType]) -> Any: + """ + at this point you either have the non-pure Parser (which has its own reader and + scanner) or you have the pure Parser. + If the pure Parser is set, then set the Reader and Scanner, if not already set. + If either the Scanner or Reader are set, you cannot use the non-pure Parser, + so reset it to the pure parser and set the Reader resp. Scanner if necessary + """ + ... + + def load_all(self, stream: Union[Path, StreamTextType]) -> Any: ... + def get_constructor_parser(self, stream: StreamTextType) -> Any: + """ + the old cyaml needs special setup, and therefore the stream + """ + ... + + def emit(self, events: Any, stream: Any) -> None: + """ + Emit YAML parsing events into a stream. + If stream is None, return the produced string instead. + """ + ... + + def serialize(self, node: Any, stream: Optional[StreamType]) -> Any: + """ + Serialize a representation tree into a YAML stream. + If stream is None, return the produced string instead. + """ + ... + + def serialize_all(self, nodes: Any, stream: Optional[StreamType]) -> Any: + """ + Serialize a sequence of representation trees into a YAML stream. + If stream is None, return the produced string instead. + """ + ... + + def dump( + self: Any, + data: Union[Path, StreamType], + stream: Any = ..., + *, + transform: Any = ..., + ) -> Any: ... + def dump_all( + self, documents: Any, stream: Union[Path, StreamType], *, transform: Any = ... + ) -> Any: ... + def Xdump_all(self, documents: Any, stream: Any, *, transform: Any = ...) -> Any: + """ + Serialize a sequence of Python objects into a YAML stream. + """ + ... + + def get_serializer_representer_emitter(self, stream: StreamType, tlca: Any) -> Any: + class XDumper(CEmitter, self.Representer, rslvr): ... + + def map(self, **kw: Any) -> Any: ... + def seq(self, *args: Any) -> Any: ... + def official_plug_ins(self) -> Any: + """Search for list of subdirs that are plug-ins, if __file__ is not available, e.g. + single file installers that are not properly emulating a file-system (issue 324) + no plug-ins will be found. If any are packaged, you know which file that are + and you can explicitly provide it during instantiation: + yaml = ruamel.yaml.YAML(plug_ins=['ruamel/yaml/jinja2/__plug_in__']) + """ + ... + + def register_class(self, cls: Any) -> Any: + """ + register a class for dumping/loading + - if it has attribute yaml_tag use that to register, else use class name + - if it has methods to_yaml/from_yaml use those to dump/load else dump attributes + as mapping + """ + ... + + def __enter__(self) -> Any: ... + def __exit__( + self, + typ: Optional[type[BaseException]], + value: Optional[BaseException], + traceback: Optional[TracebackType], + ) -> None: ... + @property + def version(self) -> Optional[tuple[int, int]]: ... + @version.setter + def version(self, val: VersionType) -> None: ... + @property + def tags(self) -> Any: ... + @tags.setter + def tags(self, val: Any) -> None: ... + @property + def indent(self) -> Any: ... + @indent.setter + def indent(self, val: Any) -> None: ... + @property + def block_seq_indent(self) -> Any: ... + @block_seq_indent.setter + def block_seq_indent(self, val: Any) -> None: ... + def compact(self, seq_seq: Any = ..., seq_map: Any = ...) -> None: ... + +class YAMLContextManager: + def __init__(self, yaml: Any, transform: Any = ...) -> None: ... + def teardown_output(self) -> None: ... + def init_output(self, first_data: Any) -> None: ... + def dump(self, data: Any) -> None: ... + +def yaml_object(yml: Any) -> Any: + """Decorator for classes that needs to dump/load objects + The tag for such objects is taken from the class attribute yaml_tag (or the + class name in lowercase in case unavailable) + If methods to_yaml and/or from_yaml are available, these are called for dumping resp. + loading, default routines (dumping a mapping of the attributes) used otherwise. + """ + ... + +def warn_deprecation(fun: Any, method: Any, arg: str = ...) -> None: ... +def error_deprecation( + fun: Any, method: Any, arg: str = ..., comment: str = ... +) -> None: ... + +_error_dep_arg = ... +_error_dep_comment = ... + +def scan(stream: StreamTextType, Loader: Any = ...) -> Any: + """ + Scan a YAML stream and produce scanning tokens. + """ + ... + +def parse(stream: StreamTextType, Loader: Any = ...) -> Any: + """ + Parse a YAML stream and produce parsing events. + """ + ... + +def compose(stream: StreamTextType, Loader: Any = ...) -> Any: + """ + Parse the first YAML document in a stream + and produce the corresponding representation tree. + """ + ... + +def compose_all(stream: StreamTextType, Loader: Any = ...) -> Any: + """ + Parse all YAML documents in a stream + and produce corresponding representation trees. + """ + ... + +def load( + stream: Any, Loader: Any = ..., version: Any = ..., preserve_quotes: Any = ... +) -> Any: + """ + Parse the first YAML document in a stream + and produce the corresponding Python object. + """ + ... + +def load_all( + stream: Any, Loader: Any = ..., version: Any = ..., preserve_quotes: Any = ... +) -> Any: + """ + Parse all YAML documents in a stream + and produce corresponding Python objects. + """ + ... + +def safe_load(stream: StreamTextType, version: Optional[VersionType] = ...) -> Any: + """ + Parse the first YAML document in a stream + and produce the corresponding Python object. + Resolve only basic YAML tags. + """ + ... + +def safe_load_all(stream: StreamTextType, version: Optional[VersionType] = ...) -> Any: + """ + Parse all YAML documents in a stream + and produce corresponding Python objects. + Resolve only basic YAML tags. + """ + ... + +def round_trip_load( + stream: StreamTextType, + version: Optional[VersionType] = ..., + preserve_quotes: Optional[bool] = ..., +) -> Any: + """ + Parse the first YAML document in a stream + and produce the corresponding Python object. + Resolve only basic YAML tags. + """ + ... + +def round_trip_load_all( + stream: StreamTextType, + version: Optional[VersionType] = ..., + preserve_quotes: Optional[bool] = ..., +) -> Any: + """ + Parse all YAML documents in a stream + and produce corresponding Python objects. + Resolve only basic YAML tags. + """ + ... + +def emit( + events: Any, + stream: Optional[StreamType] = ..., + Dumper: Any = ..., + canonical: Optional[bool] = ..., + indent: Union[int, None] = ..., + width: Optional[int] = ..., + allow_unicode: Optional[bool] = ..., + line_break: Any = ..., +) -> Any: + """ + Emit YAML parsing events into a stream. + If stream is None, return the produced string instead. + """ + ... + +enc = ... + +def serialize_all( + nodes: Any, + stream: Optional[StreamType] = ..., + Dumper: Any = ..., + canonical: Any = ..., + indent: Optional[int] = ..., + width: Optional[int] = ..., + allow_unicode: Optional[bool] = ..., + line_break: Any = ..., + encoding: Any = ..., + explicit_start: Optional[bool] = ..., + explicit_end: Optional[bool] = ..., + version: Optional[VersionType] = ..., + tags: Any = ..., +) -> Any: + """ + Serialize a sequence of representation trees into a YAML stream. + If stream is None, return the produced string instead. + """ + ... + +def serialize( + node: Any, stream: Optional[StreamType] = ..., Dumper: Any = ..., **kwds: Any +) -> Any: + """ + Serialize a representation tree into a YAML stream. + If stream is None, return the produced string instead. + """ + ... + +def dump_all( + documents: Any, + stream: Optional[StreamType] = ..., + Dumper: Any = ..., + default_style: Any = ..., + default_flow_style: Any = ..., + canonical: Optional[bool] = ..., + indent: Optional[int] = ..., + width: Optional[int] = ..., + allow_unicode: Optional[bool] = ..., + line_break: Any = ..., + encoding: Any = ..., + explicit_start: Optional[bool] = ..., + explicit_end: Optional[bool] = ..., + version: Any = ..., + tags: Any = ..., + block_seq_indent: Any = ..., + top_level_colon_align: Any = ..., + prefix_colon: Any = ..., +) -> Any: + """ + Serialize a sequence of Python objects into a YAML stream. + If stream is None, return the produced string instead. + """ + ... + +def dump( + data: Any, + stream: Optional[StreamType] = ..., + Dumper: Any = ..., + default_style: Any = ..., + default_flow_style: Any = ..., + canonical: Optional[bool] = ..., + indent: Optional[int] = ..., + width: Optional[int] = ..., + allow_unicode: Optional[bool] = ..., + line_break: Any = ..., + encoding: Any = ..., + explicit_start: Optional[bool] = ..., + explicit_end: Optional[bool] = ..., + version: Optional[VersionType] = ..., + tags: Any = ..., + block_seq_indent: Any = ..., +) -> Any: + """ + Serialize a Python object into a YAML stream. + If stream is None, return the produced string instead. + + default_style ∈ None, '', '"', "'", '|', '>' + + """ + ... + +def safe_dump(data: Any, stream: Optional[StreamType] = ..., **kwds: Any) -> Any: + """ + Serialize a Python object into a YAML stream. + Produce only basic YAML tags. + If stream is None, return the produced string instead. + """ + ... + +def round_trip_dump( + data: Any, + stream: Optional[StreamType] = ..., + Dumper: Any = ..., + default_style: Any = ..., + default_flow_style: Any = ..., + canonical: Optional[bool] = ..., + indent: Optional[int] = ..., + width: Optional[int] = ..., + allow_unicode: Optional[bool] = ..., + line_break: Any = ..., + encoding: Any = ..., + explicit_start: Optional[bool] = ..., + explicit_end: Optional[bool] = ..., + version: Optional[VersionType] = ..., + tags: Any = ..., + block_seq_indent: Any = ..., + top_level_colon_align: Any = ..., + prefix_colon: Any = ..., +) -> Any: ... +def add_implicit_resolver( + tag: Any, + regexp: Any, + first: Any = ..., + Loader: Any = ..., + Dumper: Any = ..., + resolver: Any = ..., +) -> None: + """ + Add an implicit scalar detector. + If an implicit scalar value matches the given regexp, + the corresponding tag is assigned to the scalar. + first is a sequence of possible initial characters or None. + """ + ... + +def add_path_resolver( + tag: Any, + path: Any, + kind: Any = ..., + Loader: Any = ..., + Dumper: Any = ..., + resolver: Any = ..., +) -> None: + """ + Add a path based resolver for the given tag. + A path is a list of keys that forms a path + to a node in the representation tree. + Keys can be string values, integers, or None. + """ + ... + +def add_constructor( + tag: Any, object_constructor: Any, Loader: Any = ..., constructor: Any = ... +) -> None: + """ + Add an object constructor for the given tag. + object_onstructor is a function that accepts a Loader instance + and a node object and produces the corresponding Python object. + """ + ... + +def add_multi_constructor( + tag_prefix: Any, multi_constructor: Any, Loader: Any = ..., constructor: Any = ... +) -> None: + """ + Add a multi-constructor for the given tag prefix. + Multi-constructor is called for a node if its tag starts with tag_prefix. + Multi-constructor accepts a Loader instance, a tag suffix, + and a node object and produces the corresponding Python object. + """ + ... + +def add_representer( + data_type: Any, object_representer: Any, Dumper: Any = ..., representer: Any = ... +) -> None: + """ + Add a representer for the given type. + object_representer is a function accepting a Dumper instance + and an instance of the given data type + and producing the corresponding representation node. + """ + ... + +def add_multi_representer( + data_type: Any, multi_representer: Any, Dumper: Any = ..., representer: Any = ... +) -> None: + """ + Add a representer for the given type. + multi_representer is a function accepting a Dumper instance + and an instance of the given data type or subtype + and producing the corresponding representation node. + """ + ... + +class YAMLObjectMetaclass(type): + """ + The metaclass for YAMLObject. + """ + + def __init__(cls, name: Any, bases: Any, kwds: Any) -> None: ... + +class YAMLObject(with_metaclass(YAMLObjectMetaclass)): + """ + An object that can dump itself to a YAML stream + and load itself from a YAML stream. + """ + + __slots__ = ... + yaml_constructor = Constructor + yaml_representer = Representer + yaml_tag: Any = ... + yaml_flow_style: Any = ... + @classmethod + def from_yaml(cls, constructor: Any, node: Any) -> Any: + """ + Convert a representation node to a Python object. + """ + ... + + @classmethod + def to_yaml(cls, representer: Any, data: Any) -> Any: + """ + Convert a Python object to a representation node. + """ + ... diff --git a/typings/ruamel/yaml/nodes.pyi b/typings/ruamel/yaml/nodes.pyi new file mode 100644 index 00000000..38d1758c --- /dev/null +++ b/typings/ruamel/yaml/nodes.pyi @@ -0,0 +1,78 @@ +""" +This type stub file was generated by pyright. +""" + +if False: ... + +class Node: + __slots__ = ... + def __init__( + self, + tag: Any, + value: Any, + start_mark: Any, + end_mark: Any, + comment: Any = ..., + anchor: Any = ..., + ) -> None: ... + @property + def tag(self) -> Optional[str]: ... + @tag.setter + def tag(self, val: Any) -> None: ... + def __repr__(self) -> Any: ... + def dump(self, indent: int = ...) -> None: ... + +class ScalarNode(Node): + """ + styles: + ? -> set() ? key, no value + - -> suppressable null value in set + " -> double quoted + ' -> single quoted + | -> literal style + > -> folding style + """ + + __slots__ = ... + id = ... + def __init__( + self, + tag: Any, + value: Any, + start_mark: Any = ..., + end_mark: Any = ..., + style: Any = ..., + comment: Any = ..., + anchor: Any = ..., + ) -> None: ... + +class CollectionNode(Node): + __slots__ = ... + def __init__( + self, + tag: Any, + value: Any, + start_mark: Any = ..., + end_mark: Any = ..., + flow_style: Any = ..., + comment: Any = ..., + anchor: Any = ..., + ) -> None: ... + +class SequenceNode(CollectionNode): + __slots__ = ... + id = ... + +class MappingNode(CollectionNode): + __slots__ = ... + id = ... + def __init__( + self, + tag: Any, + value: Any, + start_mark: Any = ..., + end_mark: Any = ..., + flow_style: Any = ..., + comment: Any = ..., + anchor: Any = ..., + ) -> None: ... diff --git a/typings/ruamel/yaml/parser.pyi b/typings/ruamel/yaml/parser.pyi new file mode 100644 index 00000000..038b58bc --- /dev/null +++ b/typings/ruamel/yaml/parser.pyi @@ -0,0 +1,72 @@ +""" +This type stub file was generated by pyright. +""" + +from ruamel.yaml.error import MarkedYAMLError +from ruamel.yaml.tokens import * +from ruamel.yaml.events import * +from ruamel.yaml.tag import Tag + +if False: ... +__all__ = ["Parser", "RoundTripParser", "ParserError"] + +def xprintf(*args: Any, **kw: Any) -> Any: ... + +class ParserError(MarkedYAMLError): ... + +class Parser: + DEFAULT_TAGS = ... + def __init__(self, loader: Any) -> None: ... + def reset_parser(self) -> None: ... + def dispose(self) -> None: ... + @property + def scanner(self) -> Any: ... + @property + def resolver(self) -> Any: ... + def check_event(self, *choices: Any) -> bool: ... + def peek_event(self) -> Any: ... + def get_event(self) -> Any: ... + def parse_stream_start(self) -> Any: ... + def parse_implicit_document_start(self) -> Any: ... + def parse_document_start(self) -> Any: ... + def parse_document_end(self) -> Any: ... + def parse_document_content(self) -> Any: ... + def process_directives(self) -> Any: ... + def parse_block_node(self) -> Any: ... + def parse_flow_node(self) -> Any: ... + def parse_block_node_or_indentless_sequence(self) -> Any: ... + def select_tag_transform(self, tag: Tag) -> None: ... + def parse_node(self, block: bool = ..., indentless_sequence: bool = ...) -> Any: ... + def parse_block_sequence_first_entry(self) -> Any: ... + def parse_block_sequence_entry(self) -> Any: ... + def parse_indentless_sequence_entry(self) -> Any: ... + def parse_block_mapping_first_key(self) -> Any: ... + def parse_block_mapping_key(self) -> Any: ... + def parse_block_mapping_value(self) -> Any: ... + def parse_flow_sequence_first_entry(self) -> Any: ... + def parse_flow_sequence_entry(self, first: bool = ...) -> Any: ... + def parse_flow_sequence_entry_mapping_key(self) -> Any: ... + def parse_flow_sequence_entry_mapping_value(self) -> Any: ... + def parse_flow_sequence_entry_mapping_end(self) -> Any: ... + def parse_flow_mapping_first_key(self) -> Any: ... + def parse_flow_mapping_key(self, first: Any = ...) -> Any: ... + def parse_flow_mapping_value(self) -> Any: ... + def parse_flow_mapping_empty_value(self) -> Any: ... + def process_empty_scalar(self, mark: Any, comment: Any = ...) -> Any: ... + def move_token_comment( + self, token: Any, nt: Optional[Any] = ..., empty: Optional[bool] = ... + ) -> Any: ... + +class RoundTripParser(Parser): + """roundtrip is a safe loader, that wants to see the unmangled tag""" + def select_tag_transform(self, tag: Tag) -> None: ... + def move_token_comment( + self, token: Any, nt: Optional[Any] = ..., empty: Optional[bool] = ... + ) -> Any: ... + +class RoundTripParserSC(RoundTripParser): + """roundtrip is a safe loader, that wants to see the unmangled tag""" + def move_token_comment( + self: Any, token: Any, nt: Any = ..., empty: Optional[bool] = ... + ) -> None: ... + def distribute_comment(self, comment: Any, line: Any) -> Any: ... diff --git a/typings/ruamel/yaml/reader.pyi b/typings/ruamel/yaml/reader.pyi new file mode 100644 index 00000000..5db46787 --- /dev/null +++ b/typings/ruamel/yaml/reader.pyi @@ -0,0 +1,34 @@ +""" +This type stub file was generated by pyright. +""" + +from ruamel.yaml.error import YAMLError + +if False: ... +__all__ = ["Reader", "ReaderError"] + +class ReaderError(YAMLError): + def __init__( + self, name: Any, position: Any, character: Any, encoding: Any, reason: Any + ) -> None: ... + def __str__(self) -> Any: ... + +class Reader: + def __init__(self, stream: Any, loader: Any = ...) -> None: ... + def reset_reader(self) -> None: ... + @property + def stream(self) -> Any: ... + @stream.setter + def stream(self, val: Any) -> None: ... + def peek(self, index: int = ...) -> Text: ... + def prefix(self, length: int = ...) -> Any: ... + def forward_1_1(self, length: int = ...) -> None: ... + def forward(self, length: int = ...) -> None: ... + def get_mark(self) -> Any: ... + def determine_encoding(self) -> None: ... + + NON_PRINTABLE = ... + _printable_ascii = ... + def check_printable(self, data: Any) -> None: ... + def update(self, length: int) -> None: ... + def update_raw(self, size: Optional[int] = ...) -> None: ... diff --git a/typings/ruamel/yaml/representer.pyi b/typings/ruamel/yaml/representer.pyi new file mode 100644 index 00000000..9b43032e --- /dev/null +++ b/typings/ruamel/yaml/representer.pyi @@ -0,0 +1,136 @@ +""" +This type stub file was generated by pyright. +""" + +from typing import Any, Dict, Optional, Union + +from ruamel.yaml.error import * +from ruamel.yaml.nodes import * + +if False: ... +__all__ = [ + "BaseRepresenter", + "SafeRepresenter", + "Representer", + "RepresenterError", + "RoundTripRepresenter", +] + +class RepresenterError(YAMLError): ... + +class BaseRepresenter: + yaml_representers: Dict[Any, Any] = ... + yaml_multi_representers: Dict[Any, Any] = ... + def __init__( + self: Any, + default_style: Any = ..., + default_flow_style: Any = ..., + dumper: Any = ..., + ) -> None: ... + @property + def serializer(self) -> Any: ... + def represent(self, data: Any) -> None: ... + def represent_data(self, data: Any) -> Any: ... + def represent_key(self, data: Any) -> Any: + """ + David Fraser: Extract a method to represent keys in mappings, so that + a subclass can choose not to quote them (for example) + used in represent_mapping + https://bitbucket.org/davidfraser/pyyaml/commits/d81df6eb95f20cac4a79eed95ae553b5c6f77b8c + """ + ... + + @classmethod + def add_representer(cls, data_type: Any, representer: Any) -> None: ... + @classmethod + def add_multi_representer(cls, data_type: Any, representer: Any) -> None: ... + def represent_scalar( + self, tag: Any, value: Any, style: Any = ..., anchor: Any = ... + ) -> ScalarNode: ... + def represent_sequence( + self, tag: Any, sequence: Any, flow_style: Any = ... + ) -> SequenceNode: ... + def represent_omap( + self, tag: Any, omap: Any, flow_style: Any = ... + ) -> SequenceNode: ... + def represent_mapping( + self, tag: Any, mapping: Any, flow_style: Any = ... + ) -> MappingNode: ... + def ignore_aliases(self, data: Any) -> bool: ... + +class SafeRepresenter(BaseRepresenter): + def ignore_aliases(self, data: Any) -> bool: ... + def represent_none(self, data: Any) -> ScalarNode: ... + def represent_str(self, data: Any) -> Any: ... + def represent_binary(self, data: Any) -> ScalarNode: ... + def represent_bool(self, data: Any, anchor: Optional[Any] = ...) -> ScalarNode: ... + def represent_int(self, data: Any) -> ScalarNode: ... + + inf_value = ... + def represent_float(self, data: Any) -> ScalarNode: ... + def represent_list(self, data: Any) -> SequenceNode: ... + def represent_dict(self, data: Any) -> MappingNode: ... + def represent_ordereddict(self, data: Any) -> SequenceNode: ... + def represent_set(self, data: Any) -> MappingNode: ... + def represent_date(self, data: Any) -> ScalarNode: ... + def represent_datetime(self, data: Any) -> ScalarNode: ... + def represent_yaml_object( + self, tag: Any, data: Any, cls: Any, flow_style: Any = ... + ) -> MappingNode: ... + def represent_undefined(self, data: Any) -> None: ... + +class Representer(SafeRepresenter): + def represent_complex(self, data: Any) -> Any: ... + def represent_tuple(self, data: Any) -> SequenceNode: ... + def represent_name(self, data: Any) -> ScalarNode: ... + def represent_module(self, data: Any) -> ScalarNode: ... + def represent_object(self, data: Any) -> Union[SequenceNode, MappingNode]: ... + +class RoundTripRepresenter(SafeRepresenter): + def __init__( + self, default_style: Any = ..., default_flow_style: Any = ..., dumper: Any = ... + ) -> None: ... + def ignore_aliases(self, data: Any) -> bool: ... + def represent_none(self, data: Any) -> ScalarNode: ... + def represent_literal_scalarstring(self, data: Any) -> ScalarNode: ... + + represent_preserved_scalarstring = ... + def represent_folded_scalarstring(self, data: Any) -> ScalarNode: ... + def represent_single_quoted_scalarstring(self, data: Any) -> ScalarNode: ... + def represent_double_quoted_scalarstring(self, data: Any) -> ScalarNode: ... + def represent_plain_scalarstring(self, data: Any) -> ScalarNode: ... + def insert_underscore( + self, prefix: Any, s: Any, underscore: Any, anchor: Any = ... + ) -> ScalarNode: ... + def represent_scalar_int(self, data: Any) -> ScalarNode: ... + def represent_binary_int(self, data: Any) -> ScalarNode: ... + def represent_octal_int(self, data: Any) -> ScalarNode: ... + def represent_hex_int(self, data: Any) -> ScalarNode: ... + def represent_hex_caps_int(self, data: Any) -> ScalarNode: ... + def represent_scalar_float(self, data: Any) -> ScalarNode: + """This is way more complicated""" + ... + + def represent_sequence( + self, tag: Any, sequence: Any, flow_style: Any = ... + ) -> SequenceNode: ... + def merge_comments(self, node: Any, comments: Any) -> Any: ... + def represent_key(self, data: Any) -> Any: ... + def represent_mapping( + self, tag: Any, mapping: Any, flow_style: Any = ... + ) -> MappingNode: ... + def represent_omap( + self, tag: Any, omap: Any, flow_style: Any = ... + ) -> SequenceNode: ... + def represent_set(self, setting: Any) -> MappingNode: ... + def represent_dict(self, data: Any) -> MappingNode: + """Write out tag if saved on loading""" + ... + + def represent_list(self, data: Any) -> SequenceNode: ... + def represent_datetime(self, data: Any) -> ScalarNode: ... + def represent_tagged_scalar(self, data: Any) -> ScalarNode: ... + def represent_scalar_bool(self, data: Any) -> ScalarNode: ... + def represent_yaml_object( + self, tag: Any, data: Any, cls: Any, flow_style: Optional[Any] = ... + ) -> MappingNode: ... diff --git a/typings/ruamel/yaml/resolver.pyi b/typings/ruamel/yaml/resolver.pyi new file mode 100644 index 00000000..ed379ea8 --- /dev/null +++ b/typings/ruamel/yaml/resolver.pyi @@ -0,0 +1,65 @@ +""" +This type stub file was generated by pyright. +""" + +from ruamel.yaml.error import * + +if False: ... +__all__ = ["BaseResolver", "Resolver", "VersionedResolver"] +implicit_resolvers = ... + +class ResolverError(YAMLError): ... + +class BaseResolver: + DEFAULT_SCALAR_TAG = ... + DEFAULT_SEQUENCE_TAG = ... + DEFAULT_MAPPING_TAG = ... + yaml_implicit_resolvers: Dict[Any, Any] = ... + yaml_path_resolvers: Dict[Any, Any] = ... + def __init__(self: Any, loadumper: Any = ...) -> None: ... + @property + def parser(self) -> Any: ... + @classmethod + def add_implicit_resolver_base(cls, tag: Any, regexp: Any, first: Any) -> None: ... + @classmethod + def add_implicit_resolver(cls, tag: Any, regexp: Any, first: Any) -> None: ... + @classmethod + def add_path_resolver(cls, tag: Any, path: Any, kind: Any = ...) -> None: ... + def descend_resolver(self, current_node: Any, current_index: Any) -> None: ... + def ascend_resolver(self) -> None: ... + def check_resolver_prefix( + self, depth: int, path: Any, kind: Any, current_node: Any, current_index: Any + ) -> bool: ... + def resolve(self, kind: Any, value: Any, implicit: Any) -> Any: ... + @property + def processing_version(self) -> Any: ... + +class Resolver(BaseResolver): ... + +class VersionedResolver(BaseResolver): + """ + contrary to the "normal" resolver, the smart resolver delays loading + the pattern matching rules. That way it can decide to load 1.1 rules + or the (default) 1.2 rules, that no longer support octal without 0o, sexagesimals + and Yes/No/On/Off booleans. + """ + def __init__( + self, + version: Optional[VersionType] = ..., + loader: Any = ..., + loadumper: Any = ..., + ) -> None: ... + def add_version_implicit_resolver( + self, version: VersionType, tag: Any, regexp: Any, first: Any + ) -> None: ... + def get_loader_version(self, version: Optional[VersionType]) -> Any: ... + @property + def versioned_resolver(self) -> Any: + """ + select the resolver based on the version we are parsing + """ + ... + + def resolve(self, kind: Any, value: Any, implicit: Any) -> Any: ... + @property + def processing_version(self) -> Any: ... diff --git a/typings/ruamel/yaml/scalarbool.pyi b/typings/ruamel/yaml/scalarbool.pyi new file mode 100644 index 00000000..d4be29d1 --- /dev/null +++ b/typings/ruamel/yaml/scalarbool.pyi @@ -0,0 +1,13 @@ +""" +This type stub file was generated by pyright. +""" + +if False: ... +__all__ = ["ScalarBoolean"] + +class ScalarBoolean(int): + def __new__(cls: Any, *args: Any, **kw: Any) -> Any: ... + @property + def anchor(self) -> Any: ... + def yaml_anchor(self, any: bool = ...) -> Any: ... + def yaml_set_anchor(self, value: Any, always_dump: bool = ...) -> None: ... diff --git a/typings/ruamel/yaml/scalarfloat.pyi b/typings/ruamel/yaml/scalarfloat.pyi new file mode 100644 index 00000000..19ad7534 --- /dev/null +++ b/typings/ruamel/yaml/scalarfloat.pyi @@ -0,0 +1,25 @@ +""" +This type stub file was generated by pyright. +""" + +if False: ... +__all__ = ["ScalarFloat", "ExponentialFloat", "ExponentialCapsFloat"] + +class ScalarFloat(float): + def __new__(cls: Any, *args: Any, **kw: Any) -> Any: ... + def __iadd__(self, a: Any) -> Any: ... + def __ifloordiv__(self, a: Any) -> Any: ... + def __imul__(self, a: Any) -> Any: ... + def __ipow__(self, a: Any) -> Any: ... + def __isub__(self, a: Any) -> Any: ... + @property + def anchor(self) -> Any: ... + def yaml_anchor(self, any: bool = ...) -> Any: ... + def yaml_set_anchor(self, value: Any, always_dump: bool = ...) -> None: ... + def dump(self, out: Any = ...) -> None: ... + +class ExponentialFloat(ScalarFloat): + def __new__(cls, value: Any, width: Any = ..., underscore: Any = ...) -> Any: ... + +class ExponentialCapsFloat(ScalarFloat): + def __new__(cls, value: Any, width: Any = ..., underscore: Any = ...) -> Any: ... diff --git a/typings/ruamel/yaml/scalarint.pyi b/typings/ruamel/yaml/scalarint.pyi new file mode 100644 index 00000000..af0f98ff --- /dev/null +++ b/typings/ruamel/yaml/scalarint.pyi @@ -0,0 +1,46 @@ +""" +This type stub file was generated by pyright. +""" + +if False: ... +__all__ = ["ScalarInt", "BinaryInt", "OctalInt", "HexInt", "HexCapsInt", "DecimalInt"] + +class ScalarInt(int): + def __new__(cls: Any, *args: Any, **kw: Any) -> Any: ... + def __iadd__(self, a: Any) -> Any: ... + def __ifloordiv__(self, a: Any) -> Any: ... + def __imul__(self, a: Any) -> Any: ... + def __ipow__(self, a: Any) -> Any: ... + def __isub__(self, a: Any) -> Any: ... + @property + def anchor(self) -> Any: ... + def yaml_anchor(self, any: bool = ...) -> Any: ... + def yaml_set_anchor(self, value: Any, always_dump: bool = ...) -> None: ... + +class BinaryInt(ScalarInt): + def __new__( + cls, value: Any, width: Any = ..., underscore: Any = ..., anchor: Any = ... + ) -> Any: ... + +class OctalInt(ScalarInt): + def __new__( + cls, value: Any, width: Any = ..., underscore: Any = ..., anchor: Any = ... + ) -> Any: ... + +class HexInt(ScalarInt): + """uses lower case (a-f)""" + def __new__( + cls, value: Any, width: Any = ..., underscore: Any = ..., anchor: Any = ... + ) -> Any: ... + +class HexCapsInt(ScalarInt): + """uses upper case (A-F)""" + def __new__( + cls, value: Any, width: Any = ..., underscore: Any = ..., anchor: Any = ... + ) -> Any: ... + +class DecimalInt(ScalarInt): + """needed if anchor""" + def __new__( + cls, value: Any, width: Any = ..., underscore: Any = ..., anchor: Any = ... + ) -> Any: ... diff --git a/typings/ruamel/yaml/scalarstring.pyi b/typings/ruamel/yaml/scalarstring.pyi new file mode 100644 index 00000000..7e117128 --- /dev/null +++ b/typings/ruamel/yaml/scalarstring.pyi @@ -0,0 +1,66 @@ +""" +This type stub file was generated by pyright. +""" + +if False: ... +__all__ = [ + "ScalarString", + "LiteralScalarString", + "FoldedScalarString", + "SingleQuotedScalarString", + "DoubleQuotedScalarString", + "PlainScalarString", + "PreservedScalarString", +] + +class ScalarString(str): + __slots__ = ... + def __new__(cls, *args: Any, **kw: Any) -> Any: ... + def replace(self, old: Any, new: Any, maxreplace: SupportsIndex = ...) -> Any: ... + @property + def anchor(self) -> Any: ... + def yaml_anchor(self, any: bool = ...) -> Any: ... + def yaml_set_anchor(self, value: Any, always_dump: bool = ...) -> None: ... + +class LiteralScalarString(ScalarString): + __slots__ = ... + style = ... + def __new__(cls, value: Text, anchor: Any = ...) -> Any: ... + +PreservedScalarString = LiteralScalarString + +class FoldedScalarString(ScalarString): + __slots__ = ... + style = ... + def __new__(cls, value: Text, anchor: Any = ...) -> Any: ... + +class SingleQuotedScalarString(ScalarString): + __slots__ = ... + style = ... + def __new__(cls, value: Text, anchor: Any = ...) -> Any: ... + +class DoubleQuotedScalarString(ScalarString): + __slots__ = ... + style = ... + def __new__(cls, value: Text, anchor: Any = ...) -> Any: ... + +class PlainScalarString(ScalarString): + __slots__ = ... + style = ... + def __new__(cls, value: Text, anchor: Any = ...) -> Any: ... + +def preserve_literal(s: Text) -> Text: ... +def walk_tree(base: Any, map: Any = ...) -> None: + """ + the routine here walks over a simple yaml tree (recursing in + dict values and list items) and converts strings that + have multiple lines to literal scalars + + You can also provide an explicit (ordered) mapping for multiple transforms + (first of which is executed): + map = ruamel.yaml.compat.ordereddict + map['\n'] = preserve_literal + map[':'] = SingleQuotedScalarString + walk_tree(data, map=map) + """ + ... diff --git a/typings/ruamel/yaml/scanner.pyi b/typings/ruamel/yaml/scanner.pyi new file mode 100644 index 00000000..e78462eb --- /dev/null +++ b/typings/ruamel/yaml/scanner.pyi @@ -0,0 +1,176 @@ +""" +This type stub file was generated by pyright. +""" + +from ruamel.yaml.error import MarkedYAMLError +from ruamel.yaml.tokens import * +from ruamel.yaml.compat import _debug + +if False: ... +__all__ = ["Scanner", "RoundTripScanner", "ScannerError"] +_THE_END = ... +_THE_END_SPACE_TAB = ... +_SPACE_TAB = ... +if _debug != 0: + def xprintf(*args: Any, **kw: Any) -> Any: ... + +class ScannerError(MarkedYAMLError): ... + +class SimpleKey: + def __init__( + self, + token_number: Any, + required: Any, + index: int, + line: int, + column: int, + mark: Any, + ) -> None: ... + +class Scanner: + def __init__(self, loader: Any = ...) -> None: + """Initialize the scanner.""" + ... + + @property + def flow_level(self) -> int: ... + def reset_scanner(self) -> None: ... + @property + def reader(self) -> Any: ... + @property + def scanner_processing_version(self) -> Any: ... + def check_token(self, *choices: Any) -> bool: ... + def peek_token(self) -> Any: ... + def get_token(self) -> Any: ... + def need_more_tokens(self) -> bool: ... + def fetch_comment(self, comment: Any) -> None: ... + def fetch_more_tokens(self) -> Any: ... + def next_possible_simple_key(self) -> Any: ... + def stale_possible_simple_keys(self) -> None: ... + def save_possible_simple_key(self) -> None: ... + def remove_possible_simple_key(self) -> None: ... + def unwind_indent(self, column: Any) -> None: ... + def add_indent(self, column: int) -> bool: ... + def fetch_stream_start(self) -> None: ... + def fetch_stream_end(self) -> None: ... + def fetch_directive(self) -> None: ... + def fetch_document_start(self) -> None: ... + def fetch_document_end(self) -> None: ... + def fetch_document_indicator(self, TokenClass: Any) -> None: ... + def fetch_flow_sequence_start(self) -> None: ... + def fetch_flow_mapping_start(self) -> None: ... + def fetch_flow_collection_start(self, TokenClass: Any, to_push: Text) -> None: ... + def fetch_flow_sequence_end(self) -> None: ... + def fetch_flow_mapping_end(self) -> None: ... + def fetch_flow_collection_end(self, TokenClass: Any) -> None: ... + def fetch_flow_entry(self) -> None: ... + def fetch_block_entry(self) -> None: ... + def fetch_key(self) -> None: ... + def fetch_value(self) -> None: ... + def fetch_alias(self) -> None: ... + def fetch_anchor(self) -> None: ... + def fetch_tag(self) -> None: ... + def fetch_literal(self) -> None: ... + def fetch_folded(self) -> None: ... + def fetch_block_scalar(self, style: Any) -> None: ... + def fetch_single(self) -> None: ... + def fetch_double(self) -> None: ... + def fetch_flow_scalar(self, style: Any) -> None: ... + def fetch_plain(self) -> None: ... + def check_directive(self) -> Any: ... + def check_document_start(self) -> Any: ... + def check_document_end(self) -> Any: ... + def check_block_entry(self) -> Any: ... + def check_key(self) -> Any: ... + def check_value(self) -> Any: ... + def check_plain(self) -> Any: ... + def scan_to_next_token(self) -> Any: ... + def scan_directive(self) -> Any: ... + def scan_directive_name(self, start_mark: Any) -> Any: ... + def scan_yaml_directive_value(self, start_mark: Any) -> Any: ... + def scan_yaml_directive_number(self, start_mark: Any) -> Any: ... + def scan_tag_directive_value(self, start_mark: Any) -> Any: ... + def scan_tag_directive_handle(self, start_mark: Any) -> Any: ... + def scan_tag_directive_prefix(self, start_mark: Any) -> Any: ... + def scan_directive_ignored_line(self, start_mark: Any) -> None: ... + def scan_anchor(self, TokenClass: Any) -> Any: ... + def scan_tag(self) -> Any: ... + def scan_block_scalar(self, style: Any, rt: Optional[bool] = ...) -> Any: ... + def scan_block_scalar_indicators(self, start_mark: Any) -> Any: ... + def scan_block_scalar_ignored_line(self, start_mark: Any) -> Any: ... + def scan_block_scalar_indentation(self) -> Any: ... + def scan_block_scalar_breaks(self, indent: int) -> Any: ... + def scan_flow_scalar(self, style: Any) -> Any: ... + + ESCAPE_REPLACEMENTS = ... + ESCAPE_CODES = ... + def scan_flow_scalar_non_spaces(self, double: Any, start_mark: Any) -> Any: ... + def scan_flow_scalar_spaces(self, double: Any, start_mark: Any) -> Any: ... + def scan_flow_scalar_breaks(self, double: Any, start_mark: Any) -> Any: ... + def scan_plain(self) -> Any: ... + def scan_plain_spaces(self, indent: Any, start_mark: Any) -> Any: ... + def scan_tag_handle(self, name: Any, start_mark: Any) -> Any: ... + def scan_tag_uri(self, name: Any, start_mark: Any) -> Any: ... + def scan_uri_escapes(self, name: Any, start_mark: Any) -> Any: ... + def scan_line_break(self) -> Any: ... + +class RoundTripScanner(Scanner): + def check_token(self, *choices: Any) -> bool: ... + def peek_token(self) -> Any: ... + def get_token(self) -> Any: ... + def fetch_comment(self, comment: Any) -> None: ... + def scan_to_next_token(self) -> Any: ... + def scan_line_break(self, empty_line: bool = ...) -> Text: ... + def scan_block_scalar(self, style: Any, rt: Optional[bool] = ...) -> Any: ... + def scan_uri_escapes(self, name: Any, start_mark: Any) -> Any: + """ + The roundtripscanner doesn't do URI escaping + """ + ... + +VALUECMNT = ... +KEYCMNT = ... + +class CommentBase: + __slots__ = ... + def __init__(self, value: Any, line: Any, column: Any) -> None: ... + def set_used(self, v: Any = ...) -> None: ... + def set_assigned(self) -> None: ... + def __str__(self) -> str: ... + def __repr__(self) -> str: ... + def info(self) -> str: ... + +class EOLComment(CommentBase): + name = ... + def __init__(self, value: Any, line: Any, column: Any) -> None: ... + +class FullLineComment(CommentBase): + name = ... + def __init__(self, value: Any, line: Any, column: Any) -> None: ... + +class BlankLineComment(CommentBase): + name = ... + def __init__(self, value: Any, line: Any, column: Any) -> None: ... + +class ScannedComments: + def __init__(self: Any) -> None: ... + def add_eol_comment(self, comment: Any, column: Any, line: Any) -> Any: ... + def add_blank_line(self, comment: Any, column: Any, line: Any) -> Any: ... + def add_full_line_comment(self, comment: Any, column: Any, line: Any) -> Any: ... + def __getitem__(self, idx: Any) -> Any: ... + def __str__(self) -> Any: ... + def last(self) -> str: ... + def any_unprocessed(self) -> bool: ... + def unprocessed(self, use: Any = ...) -> Any: ... + def assign_pre(self, token: Any) -> Any: ... + def assign_eol(self, tokens: Any) -> Any: ... + def assign_post(self, token: Any) -> Any: ... + def str_unprocessed(self) -> Any: ... + +class RoundTripScannerSC(Scanner): + def __init__(self, *arg: Any, **kw: Any) -> None: ... + def get_token(self) -> Any: ... + def need_more_tokens(self) -> bool: ... + def scan_to_next_token(self) -> None: ... + def scan_empty_or_full_line_comments(self) -> None: ... + def scan_block_scalar_ignored_line(self, start_mark: Any) -> Any: ... diff --git a/typings/ruamel/yaml/serializer.pyi b/typings/ruamel/yaml/serializer.pyi new file mode 100644 index 00000000..88e47ca4 --- /dev/null +++ b/typings/ruamel/yaml/serializer.pyi @@ -0,0 +1,35 @@ +""" +This type stub file was generated by pyright. +""" + +from ruamel.yaml.error import YAMLError + +if False: ... +__all__ = ["Serializer", "SerializerError"] + +class SerializerError(YAMLError): ... + +class Serializer: + ANCHOR_TEMPLATE = ... + ANCHOR_RE = ... + def __init__( + self, + encoding: Any = ..., + explicit_start: Optional[bool] = ..., + explicit_end: Optional[bool] = ..., + version: Optional[VersionType] = ..., + tags: Any = ..., + dumper: Any = ..., + ) -> None: ... + @property + def emitter(self) -> Any: ... + @property + def resolver(self) -> Any: ... + def open(self) -> None: ... + def close(self) -> None: ... + def serialize(self, node: Any) -> None: ... + def anchor_node(self, node: Any) -> None: ... + def generate_anchor(self, node: Any) -> Any: ... + def serialize_node(self, node: Any, parent: Any, index: Any) -> None: ... + +def templated_id(s: Text) -> Any: ... diff --git a/typings/ruamel/yaml/tag.pyi b/typings/ruamel/yaml/tag.pyi new file mode 100644 index 00000000..58f48bc5 --- /dev/null +++ b/typings/ruamel/yaml/tag.pyi @@ -0,0 +1,33 @@ +""" +This type stub file was generated by pyright. +""" + +if False: ... +tag_attrib = ... + +class Tag: + """store original tag information for roundtripping""" + + attrib = ... + def __init__( + self, handle: Any = ..., suffix: Any = ..., handles: Any = ... + ) -> None: ... + def __repr__(self) -> str: ... + def __str__(self) -> str: ... + def __hash__(self) -> int: ... + def __eq__(self, other: Any) -> bool: ... + def startswith(self, x: str) -> bool: ... + @property + def trval(self) -> Optional[str]: ... + + value = ... + @property + def uri_decoded_suffix(self) -> Optional[str]: ... + def select_transform(self, val: bool) -> None: + """ + val: False -> non-round-trip + True -> round-trip + """ + ... + + def check_handle(self) -> bool: ... diff --git a/typings/ruamel/yaml/timestamp.pyi b/typings/ruamel/yaml/timestamp.pyi new file mode 100644 index 00000000..b283d6e7 --- /dev/null +++ b/typings/ruamel/yaml/timestamp.pyi @@ -0,0 +1,24 @@ +""" +This type stub file was generated by pyright. +""" + +import datetime + +if False: ... + +class TimeStamp(datetime.datetime): + def __init__(self, *args: Any, **kw: Any) -> None: ... + def __new__(cls, *args: Any, **kw: Any) -> Any: ... + def __deepcopy__(self, memo: Any) -> Any: ... + def replace( + self, + year: Any = ..., + month: Any = ..., + day: Any = ..., + hour: Any = ..., + minute: Any = ..., + second: Any = ..., + microsecond: Any = ..., + tzinfo: Any = ..., + fold: Any = ..., + ) -> Any: ... diff --git a/typings/ruamel/yaml/tokens.pyi b/typings/ruamel/yaml/tokens.pyi new file mode 100644 index 00000000..e0ce8174 --- /dev/null +++ b/typings/ruamel/yaml/tokens.pyi @@ -0,0 +1,155 @@ +""" +This type stub file was generated by pyright. +""" + +from .error import StreamMark + +if False: ... +SHOW_LINES = ... + +class Token: + __slots__ = ... + def __init__(self, start_mark: StreamMark, end_mark: StreamMark) -> None: ... + def __repr__(self) -> Any: ... + @property + def column(self) -> int: ... + @column.setter + def column(self, pos: Any) -> None: ... + def add_post_comment(self, comment: Any) -> None: ... + def add_pre_comments(self, comments: Any) -> None: ... + def add_comment_pre(self, comment: Any) -> None: ... + def add_comment_eol(self, comment: Any, comment_type: Any) -> None: ... + def add_comment_post(self, comment: Any) -> None: ... + @property + def comment(self) -> Any: ... + def move_old_comment(self, target: Any, empty: bool = ...) -> Any: + """move a comment from this token to target (normally next token) + used to combine e.g. comments before a BlockEntryToken to the + ScalarToken that follows it + empty is a special for empty values -> comment after key + """ + ... + + def split_old_comment(self) -> Any: + """split the post part of a comment, and return it + as comment to be added. Delete second part if [None, None] + abc: # this goes to sequence + # this goes to first element + - first element + """ + ... + + def move_new_comment(self, target: Any, empty: bool = ...) -> Any: + """move a comment from this token to target (normally next token) + used to combine e.g. comments before a BlockEntryToken to the + ScalarToken that follows it + empty is a special for empty values -> comment after key + """ + ... + +class DirectiveToken(Token): + __slots__ = ... + id = ... + def __init__( + self, name: Any, value: Any, start_mark: Any, end_mark: Any + ) -> None: ... + +class DocumentStartToken(Token): + __slots__ = ... + id = ... + +class DocumentEndToken(Token): + __slots__ = ... + id = ... + +class StreamStartToken(Token): + __slots__ = ... + id = ... + def __init__( + self, start_mark: Any = ..., end_mark: Any = ..., encoding: Any = ... + ) -> None: ... + +class StreamEndToken(Token): + __slots__ = ... + id = ... + +class BlockSequenceStartToken(Token): + __slots__ = ... + id = ... + +class BlockMappingStartToken(Token): + __slots__ = ... + id = ... + +class BlockEndToken(Token): + __slots__ = ... + id = ... + +class FlowSequenceStartToken(Token): + __slots__ = ... + id = ... + +class FlowMappingStartToken(Token): + __slots__ = ... + id = ... + +class FlowSequenceEndToken(Token): + __slots__ = ... + id = ... + +class FlowMappingEndToken(Token): + __slots__ = ... + id = ... + +class KeyToken(Token): + __slots__ = ... + id = ... + +class ValueToken(Token): + __slots__ = ... + id = ... + +class BlockEntryToken(Token): + __slots__ = ... + id = ... + +class FlowEntryToken(Token): + __slots__ = ... + id = ... + +class AliasToken(Token): + __slots__ = ... + id = ... + def __init__(self, value: Any, start_mark: Any, end_mark: Any) -> None: ... + +class AnchorToken(Token): + __slots__ = ... + id = ... + def __init__(self, value: Any, start_mark: Any, end_mark: Any) -> None: ... + +class TagToken(Token): + __slots__ = ... + id = ... + def __init__(self, value: Any, start_mark: Any, end_mark: Any) -> None: ... + +class ScalarToken(Token): + __slots__ = ... + id = ... + def __init__( + self, value: Any, plain: Any, start_mark: Any, end_mark: Any, style: Any = ... + ) -> None: ... + +class CommentToken(Token): + __slots__ = ... + id = ... + def __init__( + self, value: Any, start_mark: Any = ..., end_mark: Any = ..., column: Any = ... + ) -> None: ... + @property + def value(self) -> str: ... + @value.setter + def value(self, val: Any) -> None: ... + def reset(self) -> None: ... + def __repr__(self) -> Any: ... + def __eq__(self, other: Any) -> bool: ... + def __ne__(self, other: Any) -> bool: ... diff --git a/typings/ruamel/yaml/util.pyi b/typings/ruamel/yaml/util.pyi new file mode 100644 index 00000000..b7c06a53 --- /dev/null +++ b/typings/ruamel/yaml/util.pyi @@ -0,0 +1,55 @@ +""" +This type stub file was generated by pyright. +""" + +import datetime + +if False: ... + +class LazyEval: + """ + Lightweight wrapper around lazily evaluated func(*args, **kwargs). + + func is only evaluated when any attribute of its return value is accessed. + Every attribute access is passed through to the wrapped value. + (This only excludes special cases like method-wrappers, e.g., __hash__.) + The sole additional attribute is the lazy_self function which holds the + return value (or, prior to evaluation, func and arguments), in its closure. + """ + def __init__(self, func: Callable[..., Any], *args: Any, **kwargs: Any) -> None: ... + def __getattribute__(self, name: str) -> Any: ... + def __setattr__(self, name: str, value: Any) -> None: ... + +RegExp = ... +timestamp_regexp = ... + +def create_timestamp( + year: Any, + month: Any, + day: Any, + t: Any, + hour: Any, + minute: Any, + second: Any, + fraction: Any, + tz: Any, + tz_sign: Any, + tz_hour: Any, + tz_minute: Any, +) -> Union[datetime.datetime, datetime.date]: ... +def load_yaml_guess_indent(stream: StreamTextType, **kw: Any) -> Any: + """guess the indent and block sequence indent of yaml stream/string + + returns round_trip_loaded stream, indent level, block sequence indent + - block sequence indent is the number of spaces before a dash relative to previous indent + - if there are no block sequences, indent is taken from nested mappings, block sequence + indent is unset (None) in that case + """ + ... + +def configobj_walker(cfg: Any) -> Any: + """ + walks over a ConfigObj (INI file with comments) generating + corresponding YAML output (including comments + """ + ...