(cls)
return cls
Inherit methods' docstrings from first superclass that defines them
Inherit methods' docstrings from first superclass that defines them
Inherit methods docstrings from first superclass that defines them
def inherit_docstrings(cls):
    """Inherit methods' docstrings from first superclass that defines them"""
    for method in cls.__dict__.values():
        if inspect.isfunction(method) and method.__doc__ is None:
            for parent in cls.__mro__[1:]:
                __doc__ = getattr(parent, method.__name__, None).__doc__
                if __doc__:
                    method.__doc__ = __doc__
                    break
    return cls
def inherit_docstrings ( cls ) : for method in cls . __dict__ . values ( ) : if inspect . isfunction ( method ) and method . __doc__ is None : for parent in cls . __mro__ [ 1 : ] : __doc__ = getattr ( parent , method . __name__ , None ) . __doc__ if __doc__ : method . __doc__ = __doc__ break return cls