SimPEG.utils.hook#
- SimPEG.utils.hook(obj, method, name=None, overwrite=False, silent=False)[source]#
Dynamically bind a class’s method to an instance of a different class.
- Parameters:
- obj
class
Instance of a class that will be binded to a new method
- method
method
The method that will be binded to obj. The syntax is ClassName.method
- name
str
,optional
Provide a different name for the method being binded to obj. If
None
, the original method name is used.- overwritebool, default:
False
If
True
, the hook will overwrite a preexisting method of obj if it has the same name as the name input argument. IfFalse
, preexisting methods are not overwritten.- silentbool, default:
False
Print whether a previous hook was overwritten
- obj