Simplify Traversable signature (#10934)

Simplify Traversable.open() signature. This is necessary so that implentors can
reasonanbly implement this method. For example `zipfile.Path.open()` (which
is considered a `Traversable`) only supports this subset.

Make `Traversable.__truediv__` and `joinpath` arguments pos-only. The
arguments are named differently in both `pathlib.Path` and `zipfile.Path`.
This commit is contained in:
Sebastian Rittau
2023-10-27 00:50:11 +02:00
committed by GitHub
parent a08d4c8d2e
commit 1c184fea33
6 changed files with 40 additions and 70 deletions

View File

@@ -152,6 +152,10 @@ typing.ParamSpec(Args|Kwargs).__origin__
# https://github.com/python/mypy/issues/15302
typing.NewType.__call__
# Problematic protocol signatures at runtime, see source code comments.
importlib.abc.Traversable.joinpath
importlib.abc.Traversable.open
# Super-special typing primitives
typing\.NamedTuple
typing\.Annotated

View File

@@ -107,6 +107,10 @@ platform.uname_result.processor
unittest.TestCase.__init_subclass__
unittest.case.TestCase.__init_subclass__
# Problematic protocol signature at runtime, see source code comments.
importlib.abc.Traversable.open
importlib.resources.abc.Traversable.open
# Super-special typing primitives
typing\._SpecialForm.*
typing\.NamedTuple

View File

@@ -96,6 +96,10 @@ platform.uname_result.processor
unittest.TestCase.__init_subclass__
unittest.case.TestCase.__init_subclass__
# Problematic protocol signature at runtime, see source code comments.
importlib.abc.Traversable.open
importlib.resources.abc.Traversable.open
# Super-special typing primitives
typing\._SpecialForm.*
typing\.NamedTuple

View File

@@ -141,6 +141,9 @@ types.MemberDescriptorType.__get__
types.MethodDescriptorType.__get__
types.WrapperDescriptorType.__get__
# Problematic protocol signature at runtime, see source code comments.
importlib.abc.Traversable.open
# Super-special typing primitives
typing\.NamedTuple
typing\.Annotated