memberOf¶
-
lsst.sconsUtils.utils.
memberOf
(cls, name=None)¶ A Python decorator that injects functions into a class.
Parameters: - cls :
class
Class in which to inject this method.
- name :
str
, optional Name of the method. Will be determined from function name if not define.
Notes
For example:
class test_class: pass @memberOf(test_class): def test_method(self): print("test_method!")
…will cause
test_method
to appear as as if it were defined withintest_class
.The function or method will still be added to the module scope as well, replacing any existing module-scope function with that name; this appears to be unavoidable.
- cls :