lisa.utils.DelegateToAttr#

lisa.utils.DelegateToAttr(attr, attr_classes=None)[source]#

Implement delegation of attribute lookup to attribute named attr on instances of the classes specified by attr_classes.

Parameters:

attr_classes (list(type) or None) – List of classes delegated to. Note that Liskov substitution is assumed to work, so the documentation will list all items made available by all subclasses of any class specified here. This allows specifying e.g. an abc.ABC base and let the documentation reflect what is made available by every possible implementation. This means that there could be a runtime AttributeError when accessing some of these attributes, but it is deemed to be more acceptable than simply not documenting those.

The documentation will list all the attributes and methods that the class gains by delegating to the attribute thanks to attr_classes.