Python Sparse data Analysis Package
Note
This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the gallery for the big picture.
- pysap.base.utils.monkeypatch(klass, methodname=None)[source]ΒΆ
Decorator extending class with the decorated callable.
>>> class A: ... pass >>> @monkeypatch(A) ... def meth(self): ... return 12 ... >>> a = A() >>> a.meth() 12 >>> @monkeypatch(A, 'foo') ... def meth(self): ... return 12 ... >>> a.foo() 12
- Parameters
klass : class object
the class to be decorated.
methodname : str, default None
the name of the decorated method. If None, use the function name.
- Returns
decorator : callable
the decorator.
Follow us