pcdsdevices.utils.maybe_make_method

pcdsdevices.utils.maybe_make_method(func: Callable | None, owner: object) Callable | None

Bind func as a method of owner if self is the first parameter.

Additionally, this accepts None and passes it through.

Parameters:
  • func (callable or None) – The function to optionally wrap.

  • owner (object) – The owner class instance to optionally bind func to.

Returns:

maybe_method (callable or None) – A callable function or method, depending on the signature of func.