Lines Matching refs:subclass
54 def register(cls, subclass): argument
59 if not isinstance(subclass, type):
61 if issubclass(subclass, cls):
62 return subclass # Already a subclass
65 if issubclass(cls, subclass):
68 cls._abc_registry.add(subclass)
70 return subclass
95 subclass = instance.__class__
96 if subclass in cls._abc_cache:
99 if subtype is subclass:
102 subclass in cls._abc_negative_cache):
105 return cls.__subclasscheck__(subclass)
106 return any(cls.__subclasscheck__(c) for c in (subclass, subtype))
108 def __subclasscheck__(cls, subclass): argument
110 if not isinstance(subclass, type):
113 if subclass in cls._abc_cache:
120 elif subclass in cls._abc_negative_cache:
123 ok = cls.__subclasshook__(subclass)
127 cls._abc_cache.add(subclass)
129 cls._abc_negative_cache.add(subclass)
132 if cls in getattr(subclass, '__mro__', ()):
133 cls._abc_cache.add(subclass)
137 if issubclass(subclass, rcls):
138 cls._abc_cache.add(subclass)
142 if issubclass(subclass, scls):
143 cls._abc_cache.add(subclass)
146 cls._abc_negative_cache.add(subclass)