mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-20 19:01:15 +08:00
typing: add _ProtocolMeta (#6394)
Co-authored-by: hauntsaninja <> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -122,6 +122,14 @@ if sys.version_info >= (3, 9):
|
||||
# Predefined type variables.
|
||||
AnyStr = TypeVar("AnyStr", str, bytes)
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
# This class did actually exist in 3.7, but had a different base.
|
||||
# We'll just pretend it didn't exist though: the main external use case for _ProtocolMeta is
|
||||
# to inherit from for your own custom protocol metaclasses. If you're using 3.7, at runtime
|
||||
# you'd use typing_extensions.Protocol, which would be unrelated to typing._ProtocolMeta and
|
||||
# so you'd run into metaclass conflicts at runtime if you used typing._ProtocolMeta.
|
||||
class _ProtocolMeta(ABCMeta): ...
|
||||
|
||||
# Abstract base classes.
|
||||
|
||||
def runtime_checkable(cls: _TC) -> _TC: ...
|
||||
|
||||
Reference in New Issue
Block a user