Returns a wrapped function.
14299
def create_atomic_wrapper(cls, wrapped_func):
        """"""
        def _create_atomic_wrapper(*args, **kwargs):
            """Actual wrapper."""
            # When a view call fails due to a permissions error, it raises an exception.
            # An uncaught exception breaks the DB transaction for any following DB operations
            # unless it's wrapped in a atomic() decorator or context manager.
            with transaction.atomic():
                return wrapped_func(*args, **kwargs)

        return _create_atomic_wrapper
308106
function wrap(ctx, fn, key) {
    return function() {
        var def = Q.defer(),
            args = _.toArray(arguments);

        args.push(def.makeNodeResolver());
        fn.apply(ctx, args);

        return def.promise;
    }
}
191950
def promise_method(func):
    
    name = func.__name__

    @wraps(func)
    def wrapped(self, *args, **kwargs):
        cls_name = type(self).__name__
        if getattr(self, '_%s__resolved' % (cls_name,)):
            return getattr(getattr(self, '_%s__wrapped' % (cls_name,)), name)(*args, **kwargs)
        return func(self, *args, **kwargs)
    return wrapped
1236333
def return_primitive(fn):
    
    @wraps(fn)
    def wrapped_fn(x):
        if isinstance(x, PRIMITIVE_TYPES):
            return x
        return fn(x)
    return wrapped_fn
328867
def preserve_shape(func):
    """"""
    @wraps(func)
    def wrapped_function(img, *args, **kwargs):
        shape = img.shape
        result = func(img, *args, **kwargs)
        result = result.reshape(shape)
        return result

    return wrapped_function
1089237
def wrapped_help_text(wrapped_func):
    
    def decorator(wrapper_func):
        """The decorator.

        Parameters
        ----------
        f : callable
            The wrapped function.

        """
        wrapper_func.__doc__ = ('This method wraps the following method:\n\n' +
                                pydoc.text.document(wrapped_func))
        return wrapper_func
    return decorator
871637
def call(self, func, *args, **kwargs):
        
        wrapped = self.wrap(func)
        return wrapped(*args, **kwargs)
278155
def wrap(func):
    
    @functools.wraps(func, assigned=('restype', 'argtypes'))
    def wrapped(*args):
        if len(args) != len(func.argtypes):
            logger.warn("{} {} not of same length",
                        args, func.argtypes)

        typed_args = []
        for (arg, argtype) in zip(args, func.argtypes):
            if argtype == c_char_p:
                # create a string buffer for strings
                typed_arg = create_string_buffer(arg)
            else:
                # for other types, use the type to do the conversion
                if hasattr(argtype, 'contents'):
                    # type is a pointer
                    typed_arg = argtype(argtype._type_(arg))
                else:
                    typed_arg = argtype(arg)
            typed_args.append(typed_arg)
        result = func(*typed_args)
        if hasattr(result, 'contents'):
            return result.contents
        else:
            return result
    return wrapped
185338
def _wrap_in_place(func):  # noqa: D202
        """"""

        @wraps(func)
        def wrapper(graph, *args, **kwargs):
            """Apply the enclosed function and returns the graph."""
            func(graph, *args, **kwargs)
            return graph

        return wrapper
1137144
def mutating_method(func):
    """"""
    def wrapper(self, *__args, **__kwargs):
        old_mutable = self._mutable
        self._mutable = True
        try:
            # Call the wrapped function
            return func(self, *__args, **__kwargs)
        finally:
            self._mutable = old_mutable
    return wrapper
700569
function wrap(fn) {
  // Error handling middleware
  if (fn.length === 4) {
    return async function wrappedErrorHandler(error, req, res, next) {
      next = _once(next);
      try {
        await fn(error, req, res, next);
        res.headersSent ? null : next();
      } catch(err) {
        res.headersSent ? null : next(err);
      }
    };
  }

  return async function wrappedMiddleware(req, res, next) {
    next = _once(next);
    try {
      await fn(req, res, next);
      res.headersSent ? null : next();
    } catch(err) {
      res.headersSent ? null : next(err);
    }
  };
}
1078193
def wrap_callback(function):
        """"""

        @wraps(function)
        def wrapped(task):
            task._callback_result = function(task)
            return task._callback_result

        return wrapped
981728
public static <T> Function<Void, T> wrap(final Function<T, T> function,
        final Function<Function<T, T>, T> wrapper) {
        return new Function<Void, T>() {
            public T apply(final Void arg) {
                return wrapper.apply(function);
            }
        };
    }
294563
def wrap_with_scope(func, scope_name=None):
    ''''''
    if scope_name is None:
        scope_name = get_current_scope().name
    return lambda *args, scope=scope_name, **kwargs: \
           _call_with_scope(func, scope, args, kwargs)
1324119
def is_decorated(cls, f):
        ''''''
        real_func = inspect.unwrap(f)
        return real_func in cls.DECORATED_FUNCTIONS
116978
def wrapper(self, updateParams=None):
		
		def decorator(f):
			_headers = self._getHeaders(updateParams)
			""" flask decorator to include headers """
			@wraps(f)
			def decorated_function(*args, **kwargs):
				resp = make_response(f(*args, **kwargs))
				self._setRespHeader(resp, _headers)
				resp.has_secure_headers = True
				return resp
			return decorated_function
		return decorator
894221
def _get_wrapper(self):
        
        if self.args_type == "MODULE_FUNCTION":
            return getattr(self.obj, self.prop)
        elif self.args_type == "FUNCTION":
            return getattr(self.g, self.obj.__name__)
        elif self.args_type == "PURE":
            return getattr(self.pure, "func")
        else:
            ErrorHandler.wrapper_object_not_found_error()