Right now _ProtocolMeta is never used:
| class_ProtocolMeta(ABCMeta): ... |
But, it is a base metaclass for Protocol type in typing.py: https://github.com/python/cpython/blame/723ebe76e787cfa6b08cc9587dd679f3234a1025/Lib/typing.py#L1965
It is also used for all Protocol types (we currently just use ABCMeta for them`):
| @runtime_checkable |
| classSupportsInt(Protocol, metaclass=ABCMeta): |
| @abstractmethod |
| def__int__(self) ->int: ... |
| |
| @runtime_checkable |
| classSupportsFloat(Protocol, metaclass=ABCMeta): |
| @abstractmethod |
| def__float__(self) ->float: ... |
| |
| @runtime_checkable |
| classSupportsComplex(Protocol, metaclass=ABCMeta): |
| @abstractmethod |
| def__complex__(self) ->complex: ... |
| |
| @runtime_checkable |
| classSupportsBytes(Protocol, metaclass=ABCMeta): |
| @abstractmethod |
| def__bytes__(self) ->bytes: ... |
CPython: https://github.com/python/cpython/blame/723ebe76e787cfa6b08cc9587dd679f3234a1025/Lib/typing.py#L2745
So, the question is:
- Should we use for
Protocol class? It is rather complex, because right now Protocol is _SpecialForm - Should we use it for
Protocol types in typing.pyi?
Right now
_ProtocolMetais never used:typeshed/stdlib/typing.pyi
Line 282 in 739711e
But, it is a base metaclass for
Protocoltype intyping.py: https://github.com/python/cpython/blame/723ebe76e787cfa6b08cc9587dd679f3234a1025/Lib/typing.py#L1965It is also used for all
Protocoltypes (we currently just useABCMetafor them`):typeshed/stdlib/typing.pyi
Lines 287 to 305 in 739711e
CPython: https://github.com/python/cpython/blame/723ebe76e787cfa6b08cc9587dd679f3234a1025/Lib/typing.py#L2745
So, the question is:
Protocolclass? It is rather complex, because right nowProtocolis_SpecialFormProtocoltypes intyping.pyi?