The four protocol-like ABCs outside of collections.abc inherit from ABC directly (#13005)

This commit is contained in:
Stephen Morton
2024-11-16 10:00:39 -08:00
committed by GitHub
parent 7c7629d909
commit f554f54673
3 changed files with 18 additions and 6 deletions

View File

@@ -19,7 +19,7 @@ from _typeshed import (
WriteableBuffer,
structseq,
)
from abc import abstractmethod
from abc import ABC, abstractmethod
from builtins import OSError
from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping, Sequence
from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper
@@ -412,8 +412,11 @@ In the future, this property will contain the last metadata change time."""
# Attributes documented as sometimes appearing, but deliberately omitted from the stub: `st_creator`, `st_rsize`, `st_type`.
# See https://github.com/python/typeshed/pull/6560#issuecomment-991253327
# mypy and pyright object to this being both ABC and Protocol.
# At runtime it inherits from ABC and is not a Protocol, but it will be
# on the allowlist for use as a Protocol starting in 3.14.
@runtime_checkable
class PathLike(Protocol[AnyStr_co]):
class PathLike(ABC, Protocol[AnyStr_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
@abstractmethod
def __fspath__(self) -> AnyStr_co: ...