wildboar.utils.decorators#

Module Contents#

Functions#

array_or_scalar([optional_f, squeeze])

Decorate a function returning an ndarray to return a single scalar if the array

singleton(f)

Recursivley try to unwrap list return arguments such that a single element can

wildboar.utils.decorators.array_or_scalar(optional_f=None, squeeze=True)[source]#

Decorate a function returning an ndarray to return a single scalar if the array has a single item.

Parameters:
  • optional_f (callable, optional) – Used if the decorator is used without arguments

  • squeeze (bool, optional) – Remove axis of length one from the returned arrays

wildboar.utils.decorators.singleton(f)[source]#

Recursivley try to unwrap list return arguments such that a single element can be returned