inClass

lsst.utils.inClass(cls, name: str | None = None)

Add the decorated function to the given class as a method.

Parameters:
namestr or None, optional

Name to be associated with the decorated function if the default can not be determined.

Notes

Standard decorators like classmethod, staticmethod, and property may be used after this decorator. Custom decorators may only be used if they return an object with a __name__ attribute or the name optional argument is provided.

Examples

For example:

class Foo:
    pass

@inClass(Foo)
def run(self):
    return None

is equivalent to:

class Foo:
    def run(self):
        return None