Decorate function fun
971986
def _decorate_fun(self, fun):
        """"""

        msg = "Function %s is deprecated" % fun.__name__
        if self.extra:
            msg += "; %s" % self.extra

        def wrapped(*args, **kwargs):
            warnings.warn(msg, category=DeprecationWarning)
            return fun(*args, **kwargs)

        wrapped.__name__ = fun.__name__
        wrapped.__dict__ = fun.__dict__
        wrapped.__doc__ = self._update_doc(fun.__doc__)

        return wrapped
106777
def decorator(caller, _func=None):
    """"""
    if _func is not None:  # return a decorated function
        # this is obsolete behavior; you should use decorate instead
        return decorate(_func, caller)
    # else return a decorator function
    if inspect.isclass(caller):
        name = caller.__name__.lower()
        doc = 'decorator(%s) converts functions/generators into ' \
              'factories of %s objects' % (caller.__name__, caller.__name__)
    elif inspect.isfunction(caller):
        if caller.__name__ == '<lambda>':
            name = '_lambda_'
        else:
            name = caller.__name__
        doc = caller.__doc__
    else:  # assume caller is an object with a __call__ method
        name = caller.__class__.__name__.lower()
        doc = caller.__call__.__doc__
    evaldict = dict(_call_=caller, _decorate_=decorate)
    return FunctionMaker.create(
        '%s(func)' % name, 'return _decorate_(func, _call_)',
        evaldict, doc=doc, module=caller.__module__,
        __wrapped__=caller)
400277
function decorate(pages, page) {
  Object.defineProperties(page, {
    first: {
      enumerable: true,
      set: function() {},
      get: function() {
        return pages.first && pages.first.current;
      }
    },

    current: {
      enumerable: true,
      set: function() {},
      get: function() {
        return this.idx + 1;
      }
    },

    last: {
      enumerable: true,
      set: function() {},
      get: function() {
        return pages.last && pages.last.current;
      }
    },

    total: {
      enumerable: true,
      set: function() {},
      get: function() {
        return pages.total;
      }
    }
  });

  var prev = pages.last;
  var idx = pages.total;
  page.idx = idx;
  if (prev) {
    page.prev = prev.current;
    prev.next = page.current;
  }
  return page;
}
1053829
def _wrap(func, msg):
    """"""

    @functools.wraps(func)
    def new_func(*args, **kwargs):
        warnings.simplefilter('always', DeprecationWarning)     # turn off filter
        warnings.warn(msg, category=DeprecationWarning, stacklevel=2)
        warnings.simplefilter('default', DeprecationWarning)    # reset filter
        return func(*args, **kwargs)
    return new_func
33559
def visit_decorators(self, node):
        """"""
        return "@%s\n" % "\n@".join(item.accept(self) for item in node.nodes)
840186
function(obj, func, items, func2){
					each(items, function(i, item){
						when(obj, func, item, func2)
					})
				}
537457
def _inner_func_anot(func):
    """"""
    @wraps(func)
    def new_func(*args):
        return func(*_lmap(_wrap_surface, args))
    return new_func
201697
def call_and_wrap(func, *args, **kw):
    '''
    '''
    try:
        return func(*args, **kw)
    except api.exceptions.APIException as ex:
        click_exception(ex)
    except urllib3exc.SSLError:
        # see monkey patch above re InsecurePlatformWarning
        if _insecure_warning:
            click.echo(click.style(str(_insecure_warning[0]), fg='red'))
        raise
919202
def decorator(caller, func=None):
    
    if func is None: # returns a decorator
        fun = FunctionMaker(caller)
        first_arg = inspect.getargspec(caller)[0][0]
        src = 'def %s(%s): return _call_(caller, %s)' % (
            caller.__name__, first_arg, first_arg)
        return fun.make(src, dict(caller=caller, _call_=decorator),
                        undecorated=caller)
    else: # returns a decorated function
        fun = FunctionMaker(func)
        src = """def %(name)s(%(signature)s):
    return _call_(_func_, %(signature)s)"""
        return fun.make(src, dict(_func_=func, _call_=caller), undecorated=func)
538642
def add_function(self,
                     fun=None,
                     name=None,
                     fun_type=FUN_TYPE):
        """"""
        if not name:
            if six.PY2:
                name = fun.func_name
            else:
                name = fun.__name__

        self.say('adding fun(%s)' % name, verbosity=50)
        self.say('adding fun_type:%s' % fun_type, verbosity=50)

        if self.function_exists(name):
            self.cry('overwriting :fun(%s)' % name, verbosity=10)

        self.say('added :' + name, verbosity=10)
        self._rule_functions[name] = RuleFunction(name, fun, fun_type)
        return True
1170204
def wrap_function(self, func):
        

        def f(*args, **kwds):
            self.enable_by_count()
            try:
                result = func(*args, **kwds)
            finally:
                self.disable_by_count()
            return result
        return f
1104566
def addpattern(base_func):
    """"""
    def pattern_adder(func):
        @_coconut.functools.wraps(func)
        @_coconut_tco
        def add_pattern_func(*args, **kwargs):
            try:
                return base_func(*args, **kwargs)
            except _coconut_MatchError:
                raise _coconut_tail_call(func, *args, **kwargs)
        return add_pattern_func
    return pattern_adder
551309
def decorate(self, func):
		
		self.func = func
		self._set_implied_name()
		self.register()
		return func
954528
function decorator(fn) {
	return opt => (
		typeof opt==='function' ? fn(opt) : (target, key, desc) => {
			desc.value = fn(desc.value, opt, target, key, desc);
		}
	);
}
1205699
def decorate(self, func, limit=0, ttl=0, *anoop, **kwnoop):
        """"""
        self.limit = int(limit)
        self.ttl = int(ttl)
        return super(RateLimitDecorator, self).decorate(func, target=None, *anoop, **kwnoop)
452963
function wrap(func) {
  if (!util.is('Function', func)) { func = function noop(){}; }

  return function wrapper() {
    try {
      return func.apply(this, arguments);
    } catch(err) {
      this.notify(err, {stackShift: 3});
      throw(err);
    }
  }.bind(this);
}
1200527
function decorate(type, name, combinator, ...terms) {
  /* istanbul ignore else */
  if (__DEV__) terms = freeze(terms);

  defineProperties(type, {
    [TYPICAL_TYPE]: { configurable, enumerable, value: true },
    name: { configurable, value: name },
    kind: { configurable, value: combinator.name },
    is: { configurable, value: v => type(v, { asPredicate: true }) },
    combinator: { configurable, value: combinator },
    terms: { configurable, value: terms },
    toString: {
      configurable,
      value() {
        return `[typical-${combinator.name}-type ${this.name}]`;
      },
    },
  });

  return type;
}