Decorator to add a post-run hook to this ingredient.

        Post-run hooks are captured functions that are run, just after the
        main function is executed.
971104
def post_run_hook(self, func, prefix=None):
        
        cf = self.capture(func, prefix=prefix)
        self.post_run_hooks.append(cf)
        return cf
1268774
def call_hook(self, hook, *args, **kwargs):
        
        for function in self.hooks[hook]:
            function.__call__(*args, **kwargs)
533095
function nextPostHook(res) {
                    response = checkResponse(res, response);

                    if (currentPost + 1 < totalPost && self.__hooksEnabled !== false) {
                        currentPost += 1;

                        // Reference to current post hook
                        const currPost = posts[currentPost];
                        const hookMethod = currPost.displayName || currPost.name;
                        scope = getScope(self, name, res, hookMethod, 'post');

                        // Recursively call all the "post" hooks
                        return currPost.call(scope, response).then(nextPostHook, postHookErrorHandler);
                    }

                    /**
                     * All "post" hook process done.
                     * If the response has an "__override" property it will be our response
                     */
                    if (is.object(response) && {}.hasOwnProperty.call(response, '__override')) {
                        response = response.__override;
                    }

                    return resolveFn(response);
                }
804738
def register_postcmd_hook(self, func: Callable[[plugin.PostcommandData], plugin.PostcommandData]) -> None:
        """"""
        self._validate_prepostcmd_hook(func, plugin.PostcommandData)
        self._postcmd_hooks.append(func)
279673
function addPostHooksTransaction() {
            // disable (post) hooks, we will only trigger them on transaction succceed
            this.__hooksEnabled = false;
            this.constructor.hooksTransaction.call(
                _this,
                transaction,
                this.__posts
                    ? this.__posts.save
                    : undefined
            );
        }
917004
def command_post_hook(*args)
      command = args.shift
      method = to_method_name("#{command}_post_hook")
      if respond_to?(method)
        send(method, *args)
      end
    end
659117
def _postrun(cls, span, obj, **kwargs):
        
        for key, value in ResultSchema().dump(obj.result).items():
            if isinstance(value, dict):
                try:
                    flat_data = cls.filter_keys(
                        cls.fix_additional_fields(value)
                    )
                    span.set_tag("result.{}".format(key), json.dumps(flat_data))
                except Exception:
                    span.set_tag("result.{}".format(key), "N/A")
            elif isinstance(value, (list, tuple)):
                try:
                    span.set_tag("result.{}".format(key), json.dumps(value))
                except Exception:
                    try:
                        span.set_tag("result.{}".format(key), value)
                    except Exception:
                        span.set_tag("result.{}".format(key), "N/A")
            else:
                span.set_tag("result.{}".format(key), value)
624416
def post_link_hook(linker)
      basic_name = get_basic_name(linker)
      soname = get_soname(linker)
      symlink_lib_to basic_name
      symlink_lib_to soname
    end
272467
def run_hook(hook_name, project_dir, context):
    
    script = find_hook(hook_name)
    if script is None:
        logger.debug('No {} hook found'.format(hook_name))
        return
    logger.debug('Running hook {}'.format(hook_name))
    run_script_with_context(script, project_dir, context)
604434
def decorate_method(cls, func):
        
        func_args = [arg for arg in function_arguments(func) if arg != 'self']
        method_return_types = \
            Endpoint._parse_function_return_types_from_doc(func.__doc__)
        name = '%s.%s' % (cls.path, func.__name__)

        @wraps(func)
        def method_decorator(self, *args, **kwargs):
            for i in range(len(args)):
                kwargs[func_args[i]] = args[i]

            api_call = self.connection._pre_process_call(
                name, endpoint_params=kwargs)
            try:
                data = func(**kwargs)
            except RestException as e:
                api_call.error = e
                raise e

            except Exception as e:
                call_queue = self.connection._call_queue.get(
                    self.connection._get_thread_id(), [])
                if api_call in call_queue:
                    call_queue.remove(api_call)
                e = RestException(original_error=e,
                                  stack=traceback.format_exc())
                log.error('ApiCall Exception: %s' % e, exc_info=True)
                raise e
            return self.connection._post_process_call(
                api_call, data, method_return_types)

        method_decorator.rest_method = True
        return method_decorator
693212
def call_after(lag):
  
  def decorator(func):
    @wraps(func)
    def wrapper(*args, **kwargs):
      wrapper.timer.cancel() # Debounce
      wrapper.timer = threading.Timer(lag, func, args=args, kwargs=kwargs)
      wrapper.timer.start()
    wrapper.timer = threading.Timer(0, lambda: None) # timer.cancel now exists
    return wrapper
  return decorator
342787
def run_hooks_for(event,*args)
      results = global_hooks_for(event).map { |prc| prc.call(*args) } || [true]
      results << hooks_for(event).map { |method| send(method,*args) }
      results = false if results.any? {|r| false == r }
      results
    end
1371182
def postprocessor(accepts, flag=None):
    """"""
    def decorator(f):
        postprocessors.append((accepts, flag, f))
        return f
    return decorator
934130
def decorate_postinject(func, classkey=None, skipmain=False):
    
    #import utool as ut
    global __CLASSTYPE_POSTINJECT_FUNCS__
    assert classkey is not None, 'must specify classkey'
    #if not (skipmain and ut.get_caller_modname() == '__main__'):
    __CLASSTYPE_POSTINJECT_FUNCS__[classkey].append(func)
    return func
806776
function afterHeadersReject (error, payload, response) {

			logger.info(methodName+': running `afterHeaders` hook');
			globalize.afterHeaders.call(threadneedle, config, error, payload, params, response)

			.done(
				function (headers) {
					reject(formatResponse(headers, error));
				},
				function (err) {
					reject(formatResponse({}, err || error));
				}
			);

		}
389403
def add_hook(self, hook):
        
        h = hook.hash
        self.hooks[h] = hook
651632
def _post_run_hook(self, runtime):
        '''  '''

        brain_extraction_mask = self.aggregate_outputs(runtime=runtime).BrainExtractionMask

        if isdefined(self.inputs.keep_temporary_files) and self.inputs.keep_temporary_files == 1:
            self._anat_file = self.aggregate_outputs(runtime=runtime).N4Corrected0
        else:
            self._anat_file = self.inputs.anatomical_image
        self._mask_file = brain_extraction_mask
        self._seg_files = [brain_extraction_mask]
        self._masked = False

        NIWORKFLOWS_LOG.info('Generating report for ANTS BrainExtraction. file "%s", mask "%s"',
                             self._anat_file, self._mask_file)

        return super(BrainExtractionRPT, self)._post_run_hook(runtime)