24 """Extends existing documentation for a method that exists in another 25 class and extend it with any additional documentation defined. 27 This decorator takes a class from which to draw documentation from as an 28 argument. This is so that any class may be used as a source of documentation 29 and not just the immediate parent of a class. This is useful when there may 30 be a long inheritance chain, or in the case of mixins. 35 The class to inherit documentation from. 40 Intermediate decorator used in the documentation process. 42 def tmpDecorator(method):
43 """Decorator to update the documentation from a class with the same method 45 methodName = method.__name__
46 if not hasattr(klass, methodName):
47 raise AttributeError(f
"{klass} has no method named {methodName} to inherit from")
48 appendText = method.__doc__
or "" 49 method.__doc__ = getattr(klass, methodName).__doc__ + appendText