From 55a1295b70bf8a4f65924f8c38de06b8f651d6ca Mon Sep 17 00:00:00 2001 From: Stanislav Schmidt Date: Sat, 31 Jul 2021 16:23:08 +0200 Subject: [PATCH 01/13] Change Loader to Type[Loader] in yaml.add_constructor --- stubs/PyYAML/yaml/__init__.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/PyYAML/yaml/__init__.pyi b/stubs/PyYAML/yaml/__init__.pyi index 1bf74c7891ae..4016fcda234a 100644 --- a/stubs/PyYAML/yaml/__init__.pyi +++ b/stubs/PyYAML/yaml/__init__.pyi @@ -260,7 +260,7 @@ def safe_dump( ) -> _Yaml: ... def add_implicit_resolver(tag, regexp, first=..., Loader=..., Dumper=...): ... def add_path_resolver(tag, path, kind=..., Loader=..., Dumper=...): ... -def add_constructor(tag: _Str, constructor: Callable[[Loader, Node], Any], Loader: Loader = ...): ... +def add_constructor(tag: _Str, constructor: Callable[[Loader, Node], Any], Loader: Type[Loader] = ...): ... def add_multi_constructor(tag_prefix, multi_constructor, Loader=...): ... def add_representer(data_type: Type[_T], representer: Callable[[_R, _T], Node], Dumper: Type[_R] = ...) -> None: ... def add_multi_representer(data_type: Type[_T], multi_representer: Callable[[_R, _T], Node], Dumper: Type[_R] = ...) -> None: ... From a5a07578ca01b6a52868b7ae9efd3563b95ed9bc Mon Sep 17 00:00:00 2001 From: Stanislav Schmidt Date: Sat, 31 Jul 2021 16:54:33 +0200 Subject: [PATCH 02/13] Change Loader to BaseConstructor In the implementation of `yaml.add_constructor` the only requirement on the `Loader` parameter is that it defines the `Loader.add_constructor` class method. This method is defined in the `BaseConstructor` base class. So we should use this base class as type parameter type. --- stubs/PyYAML/yaml/__init__.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stubs/PyYAML/yaml/__init__.pyi b/stubs/PyYAML/yaml/__init__.pyi index 4016fcda234a..200154489f1e 100644 --- a/stubs/PyYAML/yaml/__init__.pyi +++ b/stubs/PyYAML/yaml/__init__.pyi @@ -260,7 +260,7 @@ def safe_dump( ) -> _Yaml: ... def add_implicit_resolver(tag, regexp, first=..., Loader=..., Dumper=...): ... def add_path_resolver(tag, path, kind=..., Loader=..., Dumper=...): ... -def add_constructor(tag: _Str, constructor: Callable[[Loader, Node], Any], Loader: Type[Loader] = ...): ... +def add_constructor(tag: _Str, constructor: Callable[[Loader, Node], Any], Loader: Type[BaseConstructor] = ...): ... def add_multi_constructor(tag_prefix, multi_constructor, Loader=...): ... def add_representer(data_type: Type[_T], representer: Callable[[_R, _T], Node], Dumper: Type[_R] = ...) -> None: ... def add_multi_representer(data_type: Type[_T], multi_representer: Callable[[_R, _T], Node], Dumper: Type[_R] = ...) -> None: ... From 6f88e899aed4a20c4026f38b6b5326dd979587b3 Mon Sep 17 00:00:00 2001 From: Stanislav Schmidt Date: Sat, 31 Jul 2021 17:03:29 +0200 Subject: [PATCH 03/13] Add missing BaseConstructor import --- stubs/PyYAML/yaml/__init__.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/stubs/PyYAML/yaml/__init__.pyi b/stubs/PyYAML/yaml/__init__.pyi index 200154489f1e..df6c1824d197 100644 --- a/stubs/PyYAML/yaml/__init__.pyi +++ b/stubs/PyYAML/yaml/__init__.pyi @@ -1,6 +1,7 @@ import sys from typing import IO, Any, Callable, Iterator, Optional, Sequence, Text, Type, TypeVar, Union, overload +from yaml.constructor import BaseConstructor from yaml.dumper import * # noqa: F403 from yaml.error import * # noqa: F403 from yaml.events import * # noqa: F403 From 19b87354d59cd3b65ecddd4d7b3ebfa4fbcd18f3 Mon Sep 17 00:00:00 2001 From: Stanislav Schmidt Date: Sun, 1 Aug 2021 08:49:27 +0200 Subject: [PATCH 04/13] Add additional typing to yaml.__init__ Added / modified types for the following functions: - `add_implicit_resolver(...)` - `add_path_resolver(...)` - `add_constructor(...)` - `add_multi_constructor(...)` - `add_representer(...)` - `add_multi_representer(...)` For the last two only some formatting was changed. --- stubs/PyYAML/yaml/__init__.pyi | 43 ++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/stubs/PyYAML/yaml/__init__.pyi b/stubs/PyYAML/yaml/__init__.pyi index df6c1824d197..1913e71bbc02 100644 --- a/stubs/PyYAML/yaml/__init__.pyi +++ b/stubs/PyYAML/yaml/__init__.pyi @@ -1,5 +1,5 @@ import sys -from typing import IO, Any, Callable, Iterator, Optional, Sequence, Text, Type, TypeVar, Union, overload +from typing import IO, Any, Callable, Iterable, Iterator, Optional, Pattern, Sequence, Text, Type, TypeVar, Union, overload from yaml.constructor import BaseConstructor from yaml.dumper import * # noqa: F403 @@ -8,6 +8,7 @@ from yaml.events import * # noqa: F403 from yaml.loader import * # noqa: F403 from yaml.nodes import * # noqa: F403 from yaml.representer import BaseRepresenter +from yaml.resolver import BaseResolver from yaml.tokens import * # noqa: F403 from . import resolver as resolver # Help mypy a bit; this is implied by loader and dumper @@ -259,12 +260,40 @@ def safe_dump( tags=..., sort_keys: bool = ..., ) -> _Yaml: ... -def add_implicit_resolver(tag, regexp, first=..., Loader=..., Dumper=...): ... -def add_path_resolver(tag, path, kind=..., Loader=..., Dumper=...): ... -def add_constructor(tag: _Str, constructor: Callable[[Loader, Node], Any], Loader: Type[BaseConstructor] = ...): ... -def add_multi_constructor(tag_prefix, multi_constructor, Loader=...): ... -def add_representer(data_type: Type[_T], representer: Callable[[_R, _T], Node], Dumper: Type[_R] = ...) -> None: ... -def add_multi_representer(data_type: Type[_T], multi_representer: Callable[[_R, _T], Node], Dumper: Type[_R] = ...) -> None: ... +def add_implicit_resolver( + tag: _Str, + regexp: Pattern[str], + first: Optional[Iterable] =..., + Loader: Optional[Type[BaseResolver]] = ..., + Dumper: Type[BaseResolver] = ..., +) -> None: ... +def add_path_resolver( + tag: _Str, + path: Iterable[Any], + kind: Optional[Type] = ..., + Loader: Optional[Type[BaseResolver]] = ..., + Dumper: Type[BaseResolver] = ..., +) -> None: ... +def add_constructor( + tag: _Str, + constructor: Callable[[BaseConstructor, Node], Any], + Loader: Optional[Type[BaseConstructor]] = ..., +) -> None: ... +def add_multi_constructor( + tag_prefix: _Str, + multi_constructor: Callable[[BaseConstructor, _Str, Node], Any], + Loader: Optional[Type[BaseConstructor]] = ..., +) -> None: ... +def add_representer( + data_type: Type[_T], + representer: Callable[[_R, _T], Node], + Dumper: Type[_R] = ..., +) -> None: ... +def add_multi_representer( + data_type: Type[_T], + multi_representer: Callable[[_R, _T], Node], + Dumper: Type[_R] = ..., +) -> None: ... class YAMLObjectMetaclass(type): def __init__(self, name, bases, kwds) -> None: ... From 7a45eb0d4baddcc5b2aae0754a876e97f49da149 Mon Sep 17 00:00:00 2001 From: Stanislav Schmidt Date: Sun, 1 Aug 2021 09:12:24 +0200 Subject: [PATCH 05/13] Fix formatting --- stubs/PyYAML/yaml/__init__.pyi | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/stubs/PyYAML/yaml/__init__.pyi b/stubs/PyYAML/yaml/__init__.pyi index 1913e71bbc02..bef35feef833 100644 --- a/stubs/PyYAML/yaml/__init__.pyi +++ b/stubs/PyYAML/yaml/__init__.pyi @@ -263,7 +263,7 @@ def safe_dump( def add_implicit_resolver( tag: _Str, regexp: Pattern[str], - first: Optional[Iterable] =..., + first: Optional[Iterable] = ..., Loader: Optional[Type[BaseResolver]] = ..., Dumper: Type[BaseResolver] = ..., ) -> None: ... @@ -275,25 +275,15 @@ def add_path_resolver( Dumper: Type[BaseResolver] = ..., ) -> None: ... def add_constructor( - tag: _Str, - constructor: Callable[[BaseConstructor, Node], Any], - Loader: Optional[Type[BaseConstructor]] = ..., + tag: _Str, constructor: Callable[[BaseConstructor, Node], Any], Loader: Optional[Type[BaseConstructor]] = ... ) -> None: ... def add_multi_constructor( tag_prefix: _Str, multi_constructor: Callable[[BaseConstructor, _Str, Node], Any], Loader: Optional[Type[BaseConstructor]] = ..., ) -> None: ... -def add_representer( - data_type: Type[_T], - representer: Callable[[_R, _T], Node], - Dumper: Type[_R] = ..., -) -> None: ... -def add_multi_representer( - data_type: Type[_T], - multi_representer: Callable[[_R, _T], Node], - Dumper: Type[_R] = ..., -) -> None: ... +def add_representer(data_type: Type[_T], representer: Callable[[_R, _T], Node], Dumper: Type[_R] = ...) -> None: ... +def add_multi_representer(data_type: Type[_T], multi_representer: Callable[[_R, _T], Node], Dumper: Type[_R] = ...) -> None: ... class YAMLObjectMetaclass(type): def __init__(self, name, bases, kwds) -> None: ... From 2567a7a1abefff40d0783b22a93d782b5bb3c46c Mon Sep 17 00:00:00 2001 From: Stanislav Schmidt Date: Sun, 1 Aug 2021 09:22:00 +0200 Subject: [PATCH 06/13] Fix pyright --- stubs/PyYAML/yaml/__init__.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stubs/PyYAML/yaml/__init__.pyi b/stubs/PyYAML/yaml/__init__.pyi index bef35feef833..3c45c00c5117 100644 --- a/stubs/PyYAML/yaml/__init__.pyi +++ b/stubs/PyYAML/yaml/__init__.pyi @@ -263,14 +263,14 @@ def safe_dump( def add_implicit_resolver( tag: _Str, regexp: Pattern[str], - first: Optional[Iterable] = ..., + first: Optional[Iterable[Any]] = ..., Loader: Optional[Type[BaseResolver]] = ..., Dumper: Type[BaseResolver] = ..., ) -> None: ... def add_path_resolver( tag: _Str, path: Iterable[Any], - kind: Optional[Type] = ..., + kind: Optional[Type[Any]] = ..., Loader: Optional[Type[BaseResolver]] = ..., Dumper: Type[BaseResolver] = ..., ) -> None: ... From 530aba073e54bcf76895795aa1d414071d4ab771 Mon Sep 17 00:00:00 2001 From: Stanislav Schmidt Date: Sun, 1 Aug 2021 09:38:33 +0200 Subject: [PATCH 07/13] Remove yaml.add_constructor from allowlist --- stubs/PyYAML/@tests/stubtest_allowlist.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/stubs/PyYAML/@tests/stubtest_allowlist.txt b/stubs/PyYAML/@tests/stubtest_allowlist.txt index c5e594fd12bc..0b6324d2dc6e 100644 --- a/stubs/PyYAML/@tests/stubtest_allowlist.txt +++ b/stubs/PyYAML/@tests/stubtest_allowlist.txt @@ -5,7 +5,6 @@ yaml.CDumper.__init__ yaml.CEmitter yaml.CParser yaml.YAMLObjectMetaclass.__init__ -yaml.add_constructor yaml.constructor.FullConstructor.set_python_instance_state yaml.cyaml.CBaseDumper.__init__ yaml.cyaml.CDangerDumper From 8f1728358a2fca52b47a5480a00ab21e8891a36a Mon Sep 17 00:00:00 2001 From: Stanislav Schmidt Date: Sun, 1 Aug 2021 10:51:52 +0200 Subject: [PATCH 08/13] Use TypeVar in add_constructor / add_multi_constructor We need to use TypeVar in order to match the types in the second parameter (construtor) and third parameter (Loader). Setting `constructor: Callable[[BaseConstructor, None], Any]` and `Loader: OptionalType[BaseConstructor]` doesn't work for when `Loader` is a subclass `C` of `BaseConstructor`. This is because `Callable[[C, None], Any]` cannot be substituted for `Callable[[BaseConstructur], Any]`. --- stubs/PyYAML/yaml/__init__.pyi | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/stubs/PyYAML/yaml/__init__.pyi b/stubs/PyYAML/yaml/__init__.pyi index 3c45c00c5117..7e46f4e9e52c 100644 --- a/stubs/PyYAML/yaml/__init__.pyi +++ b/stubs/PyYAML/yaml/__init__.pyi @@ -25,7 +25,8 @@ __with_libyaml__: Any __version__: str _T = TypeVar("_T") -_R = TypeVar("_R", bound=BaseRepresenter) +_Constructor = TypeVar("_Constructor", bound=BaseConstructor) +_Representer = TypeVar("_Representer", bound=BaseRepresenter) def scan(stream, Loader=...): ... def parse(stream, Loader=...): ... @@ -275,15 +276,17 @@ def add_path_resolver( Dumper: Type[BaseResolver] = ..., ) -> None: ... def add_constructor( - tag: _Str, constructor: Callable[[BaseConstructor, Node], Any], Loader: Optional[Type[BaseConstructor]] = ... + tag: _Str, constructor: Callable[[_Constructor, Node], Any], Loader: Optional[Type[_Constructor]] = ... ) -> None: ... def add_multi_constructor( - tag_prefix: _Str, - multi_constructor: Callable[[BaseConstructor, _Str, Node], Any], - Loader: Optional[Type[BaseConstructor]] = ..., + tag_prefix: _Str, multi_constructor: Callable[[_Constructor, _Str, Node], Any], Loader: Optional[Type[_Constructor]] = ... +) -> None: ... +def add_representer( + data_type: Type[_T], representer: Callable[[_Representer, _T], Node], Dumper: Type[_Representer] = ... +) -> None: ... +def add_multi_representer( + data_type: Type[_T], multi_representer: Callable[[_Representer, _T], Node], Dumper: Type[_Representer] = ... ) -> None: ... -def add_representer(data_type: Type[_T], representer: Callable[[_R, _T], Node], Dumper: Type[_R] = ...) -> None: ... -def add_multi_representer(data_type: Type[_T], multi_representer: Callable[[_R, _T], Node], Dumper: Type[_R] = ...) -> None: ... class YAMLObjectMetaclass(type): def __init__(self, name, bases, kwds) -> None: ... From 79c4cd79dfd5426a8a04ff470a35764df9df1d44 Mon Sep 17 00:00:00 2001 From: Stanislav Schmidt Date: Sun, 8 Aug 2021 16:19:10 +0200 Subject: [PATCH 09/13] Replace Optional[x] by x | None --- stubs/PyYAML/yaml/__init__.pyi | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/stubs/PyYAML/yaml/__init__.pyi b/stubs/PyYAML/yaml/__init__.pyi index 7b181e952874..530e5a36bf61 100644 --- a/stubs/PyYAML/yaml/__init__.pyi +++ b/stubs/PyYAML/yaml/__init__.pyi @@ -1,5 +1,5 @@ import sys -from typing import IO, Any, Callable, Iterable, Iterator, Optional, Pattern, Sequence, Text, Type, TypeVar, Union, overload +from typing import IO, Any, Callable, Iterable, Iterator, Pattern, Sequence, Text, Type, TypeVar, Union, overload from yaml.constructor import BaseConstructor from yaml.dumper import * # noqa: F403 @@ -264,22 +264,22 @@ def safe_dump( def add_implicit_resolver( tag: _Str, regexp: Pattern[str], - first: Optional[Iterable[Any]] = ..., - Loader: Optional[Type[BaseResolver]] = ..., + first: Iterable[Any] | None = ..., + Loader: Type[BaseResolver] | None = ..., Dumper: Type[BaseResolver] = ..., ) -> None: ... def add_path_resolver( tag: _Str, path: Iterable[Any], - kind: Optional[Type[Any]] = ..., - Loader: Optional[Type[BaseResolver]] = ..., + kind: Type[Any] | None = ..., + Loader: Type[BaseResolver] | None = ..., Dumper: Type[BaseResolver] = ..., ) -> None: ... def add_constructor( - tag: _Str, constructor: Callable[[_Constructor, Node], Any], Loader: Optional[Type[_Constructor]] = ... + tag: _Str, constructor: Callable[[_Constructor, Node], Any], Loader: Type[_Constructor] | None = ... ) -> None: ... def add_multi_constructor( - tag_prefix: _Str, multi_constructor: Callable[[_Constructor, _Str, Node], Any], Loader: Optional[Type[_Constructor]] = ... + tag_prefix: _Str, multi_constructor: Callable[[_Constructor, _Str, Node], Any], Loader: Type[_Constructor] | None = ... ) -> None: ... def add_representer( data_type: Type[_T], representer: Callable[[_Representer, _T], Node], Dumper: Type[_Representer] = ... From 8f56493f68eb4c14d07079fdd434c332a3fe3fe3 Mon Sep 17 00:00:00 2001 From: Stanislav Schmidt Date: Sun, 8 Aug 2021 16:54:10 +0200 Subject: [PATCH 10/13] Add overloads to some yaml.add_* functions --- stubs/PyYAML/yaml/__init__.pyi | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/stubs/PyYAML/yaml/__init__.pyi b/stubs/PyYAML/yaml/__init__.pyi index 530e5a36bf61..b414a52c43dd 100644 --- a/stubs/PyYAML/yaml/__init__.pyi +++ b/stubs/PyYAML/yaml/__init__.pyi @@ -275,15 +275,27 @@ def add_path_resolver( Loader: Type[BaseResolver] | None = ..., Dumper: Type[BaseResolver] = ..., ) -> None: ... -def add_constructor( - tag: _Str, constructor: Callable[[_Constructor, Node], Any], Loader: Type[_Constructor] | None = ... +@overload +def add_constructor(tag: _Str, constructor: Callable[[Loader | FullLoader | UnsafeLoader, Node], Any]) -> None: ... +@overload +def add_constructor(tag: _Str, constructor: Callable[[_Constructor, Node], Any], Loader: Type[_Constructor] = ...) -> None: ... +@overload +def add_multi_constructor( + tag_prefix: _Str, multi_constructor: Callable[[Loader | FullLoader | UnsafeLoader, _Str, Node], Any] ) -> None: ... +@overload def add_multi_constructor( - tag_prefix: _Str, multi_constructor: Callable[[_Constructor, _Str, Node], Any], Loader: Type[_Constructor] | None = ... + tag_prefix: _Str, multi_constructor: Callable[[_Constructor, _Str, Node], Any], Loader: Type[_Constructor] = ... ) -> None: ... +@overload +def add_representer(data_type: Type[_T], representer: Callable[[Dumper, _T], Node]) -> None: ... +@overload def add_representer( data_type: Type[_T], representer: Callable[[_Representer, _T], Node], Dumper: Type[_Representer] = ... ) -> None: ... +@overload +def add_multi_representer(data_type: Type[_T], multi_representer: Callable[[Dumper, _T], Node]) -> None: ... +@overload def add_multi_representer( data_type: Type[_T], multi_representer: Callable[[_Representer, _T], Node], Dumper: Type[_Representer] = ... ) -> None: ... From adc766b341d06984f7f58f9ee11d9d310752df4c Mon Sep 17 00:00:00 2001 From: Stanislav Schmidt Date: Sun, 8 Aug 2021 17:18:20 +0200 Subject: [PATCH 11/13] Fix stubtest --- stubs/PyYAML/yaml/__init__.pyi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stubs/PyYAML/yaml/__init__.pyi b/stubs/PyYAML/yaml/__init__.pyi index b414a52c43dd..4e287048f7ef 100644 --- a/stubs/PyYAML/yaml/__init__.pyi +++ b/stubs/PyYAML/yaml/__init__.pyi @@ -276,12 +276,12 @@ def add_path_resolver( Dumper: Type[BaseResolver] = ..., ) -> None: ... @overload -def add_constructor(tag: _Str, constructor: Callable[[Loader | FullLoader | UnsafeLoader, Node], Any]) -> None: ... +def add_constructor(tag: _Str, constructor: Callable[[Loader | FullLoader | UnsafeLoader, Node], Any], Loader: None = ...) -> None: ... @overload def add_constructor(tag: _Str, constructor: Callable[[_Constructor, Node], Any], Loader: Type[_Constructor] = ...) -> None: ... @overload def add_multi_constructor( - tag_prefix: _Str, multi_constructor: Callable[[Loader | FullLoader | UnsafeLoader, _Str, Node], Any] + tag_prefix: _Str, multi_constructor: Callable[[Loader | FullLoader | UnsafeLoader, _Str, Node], Any], Loader: None = ... ) -> None: ... @overload def add_multi_constructor( From 9caf321e432115c7f40fae97929418370263ff8a Mon Sep 17 00:00:00 2001 From: Stanislav Schmidt Date: Sun, 8 Aug 2021 17:20:47 +0200 Subject: [PATCH 12/13] Fix black --- stubs/PyYAML/yaml/__init__.pyi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stubs/PyYAML/yaml/__init__.pyi b/stubs/PyYAML/yaml/__init__.pyi index 4e287048f7ef..15a4038bb313 100644 --- a/stubs/PyYAML/yaml/__init__.pyi +++ b/stubs/PyYAML/yaml/__init__.pyi @@ -276,7 +276,9 @@ def add_path_resolver( Dumper: Type[BaseResolver] = ..., ) -> None: ... @overload -def add_constructor(tag: _Str, constructor: Callable[[Loader | FullLoader | UnsafeLoader, Node], Any], Loader: None = ...) -> None: ... +def add_constructor( + tag: _Str, constructor: Callable[[Loader | FullLoader | UnsafeLoader, Node], Any], Loader: None = ... +) -> None: ... @overload def add_constructor(tag: _Str, constructor: Callable[[_Constructor, Node], Any], Loader: Type[_Constructor] = ...) -> None: ... @overload From dae51a68ab5d9740341cb32b04013555ef5bdf0e Mon Sep 17 00:00:00 2001 From: Stanislav Schmidt Date: Sun, 8 Aug 2021 20:21:10 +0200 Subject: [PATCH 13/13] Remove default values in overloads --- stubs/PyYAML/yaml/__init__.pyi | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/stubs/PyYAML/yaml/__init__.pyi b/stubs/PyYAML/yaml/__init__.pyi index 15a4038bb313..17807a368459 100644 --- a/stubs/PyYAML/yaml/__init__.pyi +++ b/stubs/PyYAML/yaml/__init__.pyi @@ -280,26 +280,24 @@ def add_constructor( tag: _Str, constructor: Callable[[Loader | FullLoader | UnsafeLoader, Node], Any], Loader: None = ... ) -> None: ... @overload -def add_constructor(tag: _Str, constructor: Callable[[_Constructor, Node], Any], Loader: Type[_Constructor] = ...) -> None: ... +def add_constructor(tag: _Str, constructor: Callable[[_Constructor, Node], Any], Loader: Type[_Constructor]) -> None: ... @overload def add_multi_constructor( tag_prefix: _Str, multi_constructor: Callable[[Loader | FullLoader | UnsafeLoader, _Str, Node], Any], Loader: None = ... ) -> None: ... @overload def add_multi_constructor( - tag_prefix: _Str, multi_constructor: Callable[[_Constructor, _Str, Node], Any], Loader: Type[_Constructor] = ... + tag_prefix: _Str, multi_constructor: Callable[[_Constructor, _Str, Node], Any], Loader: Type[_Constructor] ) -> None: ... @overload def add_representer(data_type: Type[_T], representer: Callable[[Dumper, _T], Node]) -> None: ... @overload -def add_representer( - data_type: Type[_T], representer: Callable[[_Representer, _T], Node], Dumper: Type[_Representer] = ... -) -> None: ... +def add_representer(data_type: Type[_T], representer: Callable[[_Representer, _T], Node], Dumper: Type[_Representer]) -> None: ... @overload def add_multi_representer(data_type: Type[_T], multi_representer: Callable[[Dumper, _T], Node]) -> None: ... @overload def add_multi_representer( - data_type: Type[_T], multi_representer: Callable[[_Representer, _T], Node], Dumper: Type[_Representer] = ... + data_type: Type[_T], multi_representer: Callable[[_Representer, _T], Node], Dumper: Type[_Representer] ) -> None: ... class YAMLObjectMetaclass(type):