Prepends the output of `func` with the status.
507342
def prepend_status(func):
    """"""

    @ft.wraps(func)
    def wrapper(self, *args, **kwargs):
        """Wrapper stub."""
        res = func(self, *args, **kwargs)
        if self.status is not StepResult.UNSET:
            res = "[{status}]".format(status=self.status.name) + res
        return res

    return wrapper
140737
def python(self, func, *args, **kwargs):
        """"""
        self.ops.append(lambda: func(*args, **kwargs))
1030480
def add_done_callback(self, function, **kwargs):
        
        with self._callbacks_lock:
            _function = functools.partial(function, **kwargs)
            self._done_callbacks.append(_function)
1334096
def with_log(func):
    
    @functools.wraps(func)
    def wrapper(*args, **kwargs):
        """Inject `log` argument into wrapped function.

        :param list args: Pass through all positional arguments.
        :param dict kwargs: Pass through all keyword arguments.
        """
        decorator_logger = logging.getLogger('@with_log')
        decorator_logger.debug('Entering %s() function call.', func.__name__)
        log = kwargs.get('log', logging.getLogger(func.__name__))
        try:
            ret = func(log=log, *args, **kwargs)
        finally:
            decorator_logger.debug('Leaving %s() function call.', func.__name__)
        return ret
    return wrapper
483625
def _start(self):
        """"""
        error = None
        output = None

        try:
            output = self.func(*self.args, **self.kwargs)
        except Exception as err:
            error = err

        if not self._is_finished:
            self.sig_finished.emit(self, output, error)
        self._is_finished = True
781791
public function prepend()
    {
        $script = $this->parseArgs(func_get_args());
        if ($script !== false && !in_array($script, $this->members)) array_unshift($this->members, $script);
    }
1155591
def output_callback(self, out, process_status):
        
        self.final_status.append(process_status)
        self.final_output.append(out)
358276
public function prepend(): void
    {
        $script = $this->parseArgs(func_get_args());
        if ($script !== false) {
            array_unshift($this->members, $script);
        }
    }
519061
def mute(returns_output=False):
    
    def decorator(func):
        @wraps(func)
        def wrapper(*args, **kwargs):
            saved_stdout = sys.stdout
            sys.stdout = cStringIO.StringIO()
            try:
                out = func(*args, **kwargs)
                if returns_output:
                    out = sys.stdout.getvalue().strip().split()
            finally:
                sys.stdout = saved_stdout
            return out
        return wrapper
    return decorator
1366039
def _enable_cleanup(func):
    

    @functools.wraps(func)
    def wrapper(*args, **kwargs):
        self = args[0]
        result = func(*args, **kwargs)
        self.cleanup(self)
        return result

    return wrapper
316540
function addHook($type, $func, $prepend = false, $subtype = false)
    {
        if ($subtype)
        {
            if ($prepend)
            {
                array_unshift($this->hooks[$type][$subtype], $func);
            }
            else
            {
                $this->hooks[$type][$subtype][] = $func;
            }
        }
        else
        {
            if ($prepend)
            {
                array_unshift($this->hooks[$type], $func);
            }
            else
            {
                $this->hooks[$type][] = $func;
            }
        }
    }
926562
def ready_print(worker, output, error):  # pragma : no cover
    """"""
    global COUNTER
    COUNTER += 1
    print(COUNTER, output, error)
440092
def callback(func):
    
    @functools.wraps(func)
    def wrapped(*args, **kwargs):
        result = func(*args, **kwargs)
        if inspect.iscoroutine(result):
            aio_loop.create_task(result)

    return wrapped
675460
def on_finish(self, func):
        '''
        '''
        if self._done.is_set():
            if self._failure is None:
                backend.schedule(func, args=(self._value,))
        else:
            self._cbacks.append(func)
160510
def wrap_object(func, before, after):
    '''
    
    '''
    def _wrapper(*args, **kwargs):
        before()
        try:
            return func(*args, **kwargs)
        except Exception as e:
            raise e
        finally:
            after()
    return _wrapper
551309
def decorate(self, func):
		
		self.func = func
		self._set_implied_name()
		self.register()
		return func
1188742
def _sync_call(self, func):
        

        @functools.wraps(func)
        def wrapper(*args, **kwargs):
            if self._start_msg:
                self._start_print()
            result = func(*args, **kwargs)
            if self._end_msg:
                print(self._end_msg)
            return result

        setattr(wrapper, ANNOTATED, True)
        return wrapper