inClass¶
-
lsst.utils.
inClass
(cls, name=None)¶ Add the decorated function to the given class as a method.
For example:
class Foo: pass @inClass(Foo) def run(self): return None
is equivalent to:
class Foo: def run(self): return None
Standard decorators like
classmethod
,staticmethod
, andproperty
may be used after this decorator. Custom decorators may only be used if they return an object with a__name__
attribute or thename
optional argument is provided.