Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyYAML: correct return type of construct_scalar() #12664

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions stubs/PyYAML/yaml/constructor.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ from collections.abc import Callable, Hashable
from datetime import date
from re import Pattern
from typing import Any, ClassVar, TypeVar
from typing_extensions import TypeAlias

from yaml.error import MarkedYAMLError
from yaml.nodes import MappingNode, Node, ScalarNode, SequenceNode
Expand All @@ -13,8 +12,6 @@ from .loader import _Loader
_L = TypeVar("_L", bound=_Loader | _CLoader)
_N = TypeVar("_N", bound=Node)

_Scalar: TypeAlias = str | int | float | bool | None

class ConstructorError(MarkedYAMLError): ...

class BaseConstructor:
Expand All @@ -31,7 +28,7 @@ class BaseConstructor:
def get_single_data(self) -> Any: ...
def construct_document(self, node): ...
def construct_object(self, node, deep=False): ...
def construct_scalar(self, node: ScalarNode) -> _Scalar: ...
def construct_scalar(self, node: ScalarNode) -> str: ...
def construct_sequence(self, node: SequenceNode, deep: bool = False) -> list[Any]: ...
def construct_mapping(self, node: MappingNode, deep: bool = False) -> dict[Hashable, Any]: ...
def construct_pairs(self, node, deep=False): ...
Expand All @@ -42,7 +39,7 @@ class BaseConstructor:
def add_multi_constructor(cls, tag_prefix, multi_constructor): ...

class SafeConstructor(BaseConstructor):
def construct_scalar(self, node: ScalarNode) -> _Scalar: ...
def construct_scalar(self, node: ScalarNode) -> str: ...
def flatten_mapping(self, node: MappingNode) -> None: ...
def construct_mapping(self, node: MappingNode, deep: bool = False) -> dict[Hashable, Any]: ...
def construct_yaml_null(self, node: ScalarNode) -> None: ...
Expand Down