utils/decorators.py
def overrides(interface_class):
    """
    Function override annotation.
    Corollary to @abc.abstractmethod where the override is not of an
    abstractmethod.
    Modified from answer https://stackoverflow.com/a/8313042/471376
    """
    def confirm_override(method):
        if method.__name__ not in dir(interface_class):
            raise NotImplementedError('function "%s" is an @override but that'
                                      ' function is not implemented in base'
                                      ' class %s'
                                      % (method.__name__,
                                         interface_class)
                                      )

        def func():
            pass

        attr = getattr(interface_class, method.__name__)
        if type(attr) is not type(func):
            raise NotImplementedError('function "%s" is an @override'
                                      ' but that is implemented as type %s'
                                      ' in base class %s, expected implemented'
                                      ' type %s'
                                      % (method.__name__,
                                         type(attr),
                                         interface_class,
                                         type(func))
                                      )
        return method
    return confirm_override

    Function override annotation.
    Corollary to @abc.abstractmethod where the override is not of an
    abstractmethod.
    Modified from answer https://stackoverflow.com/a/8313042/471376
    
Function override annotation.
Corollary to @abc.abstractmethod where the override is not of an
abstractmethod.
Function override annotation . Corollary to @abc . abstractmethod where the override is not of an abstractmethod .
def overrides(interface_class):
    def confirm_override(method):
        if method.__name__ not in dir(interface_class):
            raise NotImplementedError('function "%s" is an @override but that'
                                      ' function is not implemented in base'
                                      ' class %s'
                                      % (method.__name__,
                                         interface_class)
                                      )
        def func():
            pass
        attr = getattr(interface_class, method.__name__)
        if type(attr) is not type(func):
            raise NotImplementedError('function "%s" is an @override'
                                      ' but that is implemented as type %s'
                                      ' in base class %s, expected implemented'
                                      ' type %s'
                                      % (method.__name__,
                                         type(attr),
                                         interface_class,
                                         type(func))
                                      )
        return method
    return confirm_override
def overrides ( interface_class ) : def confirm_override ( method ) : if method . __name__ not in dir ( interface_class ) : raise NotImplementedError ( 'function "%s" is an @override but that' ' function is not implemented in base' ' class %s' % ( method . __name__ , interface_class ) ) def func ( ) : pass attr = getattr ( interface_class , method . __name__ ) if type ( attr ) is not type ( func ) : raise NotImplementedError ( 'function "%s" is an @override' ' but that is implemented as type %s' ' in base class %s, expected implemented' ' type %s' % ( method . __name__ , type ( attr ) , interface_class , type ( func ) ) ) return method return confirm_override
Function override annotation.
Function override annotation .
"""
    Function override annotation.
    Corollary to @abc.abstractmethod where the override is not of an
    abstractmethod.
    Modified from answer https://stackoverflow.com/a/8313042/471376
    """
interface_class