MCPcopy Index your code
hub / github.com/python/cpython / __init_subclass__

Method __init_subclass__

Lib/typing.py:2189–2207  ·  view source on GitHub ↗
(cls, *args, **kwargs)

Source from the content-addressed store, hash-verified

2187 _is_runtime_protocol = False
2188
2189 def __init_subclass__(cls, *args, **kwargs):
2190 super().__init_subclass__(*args, **kwargs)
2191
2192 # Determine if this is a protocol or a concrete subclass.
2193 if not cls.__dict__.get('_is_protocol', False):
2194 cls._is_protocol = any(b is Protocol for b in cls.__bases__)
2195
2196 # Mark inherited runtime checkability (deprecated). See GH-132604.
2197 if cls._is_protocol and getattr(cls, '_is_runtime_protocol', False):
2198 # This flag is set to False by @runtime_checkable.
2199 cls.__typing_is_deprecated_inherited_runtime_protocol__ = True
2200
2201 # Set (or override) the protocol subclass hook.
2202 if '__subclasshook__' not in cls.__dict__:
2203 cls.__subclasshook__ = _proto_hook
2204
2205 # Prohibit instantiation for protocol classes
2206 if cls._is_protocol and cls.__init__ is Protocol.__init__:
2207 cls.__init__ = _no_init_or_replace_init
2208
2209
2210class _AnnotatedAlias(_NotIterable, _GenericAlias, _root=True):

Callers

nothing calls this directly

Calls 4

superClass · 0.85
anyFunction · 0.70
__init_subclass__Method · 0.45
getMethod · 0.45

Tested by

no test coverage detected