diff --git a/stubs/PyYAML/yaml/__init__.pyi b/stubs/PyYAML/yaml/__init__.pyi index 021152a6edb9..70f90017c09d 100644 --- a/stubs/PyYAML/yaml/__init__.pyi +++ b/stubs/PyYAML/yaml/__init__.pyi @@ -22,6 +22,8 @@ from .tokens import * _T = TypeVar("_T") _Constructor = TypeVar("_Constructor", bound=BaseConstructor) +_L = TypeVar("_L", bound=Loader | FullLoader | UnsafeLoader) +_N = TypeVar("_N", bound=Node) _Representer = TypeVar("_Representer", bound=BaseRepresenter) __with_libyaml__: Final[bool] @@ -409,19 +411,17 @@ def add_path_resolver( ) -> None: ... @overload -def add_constructor( - tag: str, constructor: Callable[[Loader | FullLoader | UnsafeLoader, Node], Incomplete], Loader: None = None -) -> None: ... +def add_constructor(tag: str, constructor: Callable[[_L, _N], Incomplete], Loader: None = None) -> None: ... @overload -def add_constructor(tag: str, constructor: Callable[[_Constructor, Node], Incomplete], Loader: type[_Constructor]) -> None: ... +def add_constructor(tag: str, constructor: Callable[[_Constructor, _N], Incomplete], Loader: type[_Constructor]) -> None: ... @overload def add_multi_constructor( - tag_prefix: str, multi_constructor: Callable[[Loader | FullLoader | UnsafeLoader, str, Node], Incomplete], Loader: None = None + tag_prefix: str, multi_constructor: Callable[[_L, str, _N], Incomplete], Loader: None = None ) -> None: ... @overload def add_multi_constructor( - tag_prefix: str, multi_constructor: Callable[[_Constructor, str, Node], Incomplete], Loader: type[_Constructor] + tag_prefix: str, multi_constructor: Callable[[_Constructor, str, _N], Incomplete], Loader: type[_Constructor] ) -> None: ... @overload