conditional_execute#

conditional_execute(func, execute_operation, alt_func=<function noop>)[source]#

Return the given function or a no-op function based on execute_operation.

Parameters:
funcCallable

Callable.

alt_funcCallable

Callable to return if execute_operation is False, no-op by default.

execute_operationbool

Whether to return func or a alt_func function.

Returns:
Callable

func if execute_operation else alt_func.