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:
objclass

Instance of a class that will be binded to a new method

methodmethod

The method that will be binded to obj. The syntax is ClassName.method

namestr, 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. If False, preexisting methods are not overwritten.

silentbool, default: False

Print whether a previous hook was overwritten