wrapper for do_* funcs to call process_* with missing handler. Unpacks the FieldKey.
767264
def fkapply(models,pool,fn,missing_fn,(nombre,pkey,field),*args):
  ""
  if (nombre,pkey) in models: return fn(pool,models[nombre,pkey],field,*args)
  else: return missing_fn(pool,field,*args) if missing_fn else ['missing']
1328317
def wrap(self, methodName, types, skip=2):
        

        def handler(fields):
            try:
                args = [
                    field if typ is str else
                    int(field or 0) if typ is int else
                    float(field or 0) if typ is float else
                    bool(int(field or 0))
                    for (typ, field) in zip(types, fields[skip:])]
                method(*args)
            except Exception:
                self.logger.exception(f'Error for {methodName}:')

        method = getattr(self.wrapper, methodName, None)
        return handler if method else lambda *args: None
48765
def attr_item_call_auto_cache(func):
    
    def __missing__(self, key):
        result = self[key] = func(key)
        return result
    wrapper = type(snake2ucamel(func.__name__), (dict,), {
      "__missing__": __missing__,
      "__call__": dict.__getitem__,
      "__getattr__": dict.__getitem__,
      "__doc__": func.__doc__, # Class docstring can't be updated afterwards
      "__module__": func.__module__,
    })()
    for k, v in vars(func).items():
        setattr(wrapper, k, v)
    return wrapper
1136482
def throws(exc):
    '''
    
    '''
    if not __CHECKING__:
        return lambda f: f

    def wrap(f):
        def call(*args, **kwd):
            res = f(*args, **kwd)
            # raise UncheckedExceptionError if exc is not automatically
            # registered by a function decorated with @catches(exc);
            # otherwise do nothing
            exc_checker.throwing(exc)
            return res
        call.__name__ = f.__name__
        return call
    return wrap
1095283
def method_missing(key_name, *args)
      key_name_str = key_name.to_s()
      if key_name_str =~ /=$/ then
        self[key_name_str.chop()] = args[0]
      else
        return self[key_name_str]
      end
    end
153647
def method_missing method, *args, &block
      method, *args = special_handler(method, *args, &block) \
        if self.private_methods.include?(:special_handler)
      [method, args].flatten
    end
936716
def callwith(context_manager):
    
    def decorator(func):
        @functools.wraps(func)
        def wrapper(*args, **kwds):
            with context_manager:
                return func(*args, **kwds)
        return wrapper
    return decorator
362090
def wrap_errorhandler(app):
        
        try:
            existing_handler = app.error_handler_spec[None][404][NotFound]
        except (KeyError, TypeError):
            existing_handler = None

        if existing_handler:
            app.error_handler_spec[None][404][NotFound] = \
                lambda error: handle_not_found(error, wrapped=existing_handler)
        else:
            app.error_handler_spec.setdefault(None, {}).setdefault(404, {})
            app.error_handler_spec[None][404][NotFound] = handle_not_found
1051889
def process_request_body(fn):
    '''
    
    '''
    @functools.wraps(fn)
    def wrapped(*args, **kwargs):  # pylint: disable=C0111
        if cherrypy.request.process_request_body is not False:
            fn(*args, **kwargs)
    return wrapped
452403
def _process_registry(registry, call_func):
    
    from django.core.exceptions import ImproperlyConfigured
    from django.apps import apps

    for key, value in list(registry.items()):
        model = apps.get_model(*key.split('.'))
        if model is None:
            raise ImproperlyConfigured(_('%(key)s is not a model') % {'key': key})
        if isinstance(value, (tuple, list)):
            for item in value:
                if isinstance(item, str):
                    call_func(model, item)
                elif isinstance(item, dict):
                    field_name = item.pop('name')
                    call_func(model, field_name, extra_params=item)
                else:
                    raise ImproperlyConfigured(_("%(settings)s doesn't recognize the value of %(key)s") %
                                               {'settings': 'CATEGORY_SETTINGS', 'key': key})
        elif isinstance(value, str):
            call_func(model, value)
        elif isinstance(value, dict):
            field_name = value.pop('name')
            call_func(model, field_name, extra_params=value)
        else:
            raise ImproperlyConfigured(_("%(settings)s doesn't recognize the value of %(key)s") %
                                       {'settings': 'CATEGORY_SETTINGS', 'key': key})
462738
def _postprocess(self, filehandle, metadata):
        ""
        for process in self._postprocessors:
            filehandle = process(filehandle, metadata)
        return filehandle
12708
def method_missing(name, *args, &block)
      helpers.key?(name) ? helpers.fetch(name).call : super
    end
1118881
def get_method_returning_field_value(self, field_name):
        
        method = getattr(self, field_name, None)
        return method if method and callable(method) else None
745004
function pidOf( procName, callback ){
    if ( isString( procName )){
        var pids = [];

        procStat( procName, function( err, processes ){
            processes.object.forEach( function( proc ){
                pids.push( proc.pid )
            });

            callback( err, pids )
        })
    } else callback( new Error( 'A non-string process name was supplied' ), null, null )
}
83042
function processHandler(fn) {
                if (_.isFunction(handler)) {
                    return fn(null, handler);
                }
                if (_.isString(handler)) {
                    return self.processStringHandler(mycro, handler, fn);
                }
                if (_.isObject(handler)) {
                    // make sure the object defines a `handler` attribute
                    if (!handler.handler) {
                        return fn('Unable to locate handler for ' + verb.toUpperCase() + ' ' + path.toString());
                    }
                    // extend options with any route specific options
                    if (handler.options && _.isObject(handler.options)) {
                        _.extend(options.defaultOptions, handler.options);
                    }
                    // allow route to override policy chain
                    if (handler.policies && _.isArray(handler.policies)) {
                        options.defaultPolicies = handler.policies;
                    }
                    // allow route to augment policy chain
                    if (handler.additionalPolicies && _.isArray(handler.additionalPolicies)) {
                        options.defaultPolicies = options.defaultPolicies.concat(handler.additionalPolicies);
                    }
                    if (_.isFunction(handler.handler)) {
                        return fn(null, handler.handler);
                    }
                    if (_.isString(handler.handler)) {
                        return self.processStringHandler(mycro, handler.handler, fn);
                    }
                }
                return fn('Unsupported handler type for '+ verb.toUpperCase() + ' ' + path.toString());
            }
667771
def transactional_tasklet(func, args, kwds, **options):
  
  from . import tasklets
  func = tasklets.tasklet(func)
  return transactional_async.wrapped_decorator(func, args, kwds, **options)
454432
def do_find(self, arg):
        
        if not arg:
            raise CmdError("missing parameter: string")
        process = self.get_process_from_prefix()
        self.find_in_memory(arg, process)