Skip to main content
`Ctrl`+`K`

# skbio.workflow.requires

class skbio.workflow.requires(option=None, values=<skbio.workflow.Exists object>, state=None)

  Decorator that executes a function if requirements are met.

  Parameters:
    option any Hashable object

      An option that is required for the decorated method to execute. This option will be looked up within the containing `Workflow``s' ``options`.

    values object

      A required value. This defaults to `anything` indicating that the only requirement is that the `option` exists. It can be useful to specify `not_none` which indicates that the requirement is satisfied if the `option` exists and it holds a value that is not `None`. Values also supports iterables or singular values.

    state Function

      A requirement on workflow state. This must be a function that accepts a single argument, and returns `True` to indicate the requirement is satisfied, or `False` to indicate the requirement is not satisfied. This method will be passed the containing `Workflow``s' ``state` member variable.

  Special methods

  `__call__` | Wrap a function.

  Special methods (inherited)

  `__eq__` | Return self==value.
  `__ge__` | Return self>=value.
  `__getstate__` | Helper for pickle.
  `__gt__` | Return self>value.
  `__hash__` | Return hash(self).
  `__le__` | Return self<=value.
  `__lt__` | Return self<value.
  `__ne__` | Return self!=value.
  `__str__` | Return str(self).

  Details

  __call__(func)

    Wrap a function.

    func : the function to wrap