(cls, subclass)
return False
Override for issubclass(subclass, cls).
Override for issubclass(subclass, cls).
Override for issubclass ( subclass cls ) .
def __subclasscheck__(cls, subclass):
        """Override for issubclass(subclass, cls)."""
        # Check cache
        if subclass in cls._abc_cache:
            return True
        # Check negative cache; may have to invalidate
        if cls._abc_negative_cache_version < ABCMeta._abc_invalidation_counter:
            # Invalidate the negative cache
            cls._abc_negative_cache = WeakSet()
            cls._abc_negative_cache_version = ABCMeta._abc_invalidation_counter
        elif subclass in cls._abc_negative_cache:
            return False
        # Check the subclass hook
        ok = cls.__subclasshook__(subclass)
        if ok is not NotImplemented:
            assert isinstance(ok, bool)
            if ok:
                cls._abc_cache.add(subclass)
            else:
                cls._abc_negative_cache.add(subclass)
            return ok
        # Check if it's a direct subclass
        if cls in getattr(subclass, '__mro__', ()):
            cls._abc_cache.add(subclass)
            return True
        # Check if it's a subclass of a registered class (recursive)
        for rcls in cls._abc_registry:
            if issubclass(subclass, rcls):
                cls._abc_cache.add(subclass)
                return True
        # Check if it's a subclass of a subclass (recursive)
        for scls in cls.__subclasses__():
            if issubclass(subclass, scls):
                cls._abc_cache.add(subclass)
                return True
        # No dice; update negative cache
        cls._abc_negative_cache.add(subclass)
        return False
def __subclasscheck__ ( cls , subclass ) : # Check cache if subclass in cls . _abc_cache : return True # Check negative cache; may have to invalidate if cls . _abc_negative_cache_version < ABCMeta . _abc_invalidation_counter : # Invalidate the negative cache cls . _abc_negative_cache = WeakSet ( ) cls . _abc_negative_cache_version = ABCMeta . _abc_invalidation_counter elif subclass in cls . _abc_negative_cache : return False # Check the subclass hook ok = cls . __subclasshook__ ( subclass ) if ok is not NotImplemented : assert isinstance ( ok , bool ) if ok : cls . _abc_cache . add ( subclass ) else : cls . _abc_negative_cache . add ( subclass ) return ok # Check if it's a direct subclass if cls in getattr ( subclass , '__mro__' , ( ) ) : cls . _abc_cache . add ( subclass ) return True # Check if it's a subclass of a registered class (recursive) for rcls in cls . _abc_registry : if issubclass ( subclass , rcls ) : cls . _abc_cache . add ( subclass ) return True # Check if it's a subclass of a subclass (recursive) for scls in cls . __subclasses__ ( ) : if issubclass ( subclass , scls ) : cls . _abc_cache . add ( subclass ) return True # No dice; update negative cache cls . _abc_negative_cache . add ( subclass ) return False