Wrapping function.
558087
def SecurityCheck(self, func, request, *args, **kwargs):
    """"""
    request.user = u""

    authorized = False
    try:
      auth_type, authorization = request.headers.get("Authorization",
                                                     " ").split(" ", 1)

      if auth_type == "Basic":
        authorization_string = authorization.decode("base64").decode("utf-8")
        user, password = authorization_string.split(":", 1)

        if data_store.AFF4Enabled():

          token = access_control.ACLToken(username=user)

          fd = aff4.FACTORY.Open(
              "aff4:/users/%s" % user,
              aff4_type=aff4_users.GRRUser,
              token=token)
          crypted_password = fd.Get(fd.Schema.PASSWORD)
          if crypted_password and crypted_password.CheckPassword(password):
            authorized = True

            # The password is ok - update the user
            request.user = user

        else:

          try:
            user_obj = data_store.REL_DB.ReadGRRUser(user)
            if user_obj.password.CheckPassword(password):
              authorized = True

              # The password is ok - update the user
              request.user = user

          except db.UnknownGRRUserError:
            pass

    except access_control.UnauthorizedAccess as e:
      logging.warning("UnauthorizedAccess: %s for %s", e, request)
    except (IndexError, KeyError, IOError):
      pass

    if not authorized:
      result = werkzeug_wrappers.Response("Unauthorized", status=401)
      result.headers["WWW-Authenticate"] = "Basic realm='Secure Area'"
      return result

    # Modify this to implement additional checking (e.g. enforce SSL).
    return func(request, *args, **kwargs)
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)
355158
def _wrap(fn):
        
        def _func(*args):
            merged = None
            _args = []
            for arg in args:
                if merged.__class__ != arg.__class__:
                    if merged is None:
                        merged = arg.__class__(None)
                    else:
                        merged = Value._merge_type(merged, arg)(None)
                merged.merge(arg)
                if isinstance(arg, Value):
                    arg = arg.value
                _args.append(arg)
            merged.value = fn(*_args)
            return merged
        return _func
293842
def wraps(wrapped):
    """"""
    if isinstance(wrapped, functools.partial):
        return six.wraps(wrapped, assigned=_PARTIAL_VALID_ASSIGNMENTS)
    else:
        return six.wraps(wrapped)
320684
function wrap(input, wrap, ends) {
  return isString(input) && isDefined(wrap)
    ? [wrap, input, ends || wrap].join('')
    : input;
}
1275023
def _wrap(method: Callable, wrapper: Callable) -> Callable:
        
        def wrapped(*args, **kwargs):
            return wrapper(method, *args, **kwargs)
        return wrapped
566640
def _wrap_result(self, func):
        
        def wrapper(*args):
            result = func(*args)
            if hasattr(result, '__iter__') and not isinstance(result, etree._Element):
                return [self._wrap_element(element) for element in result]
            else:
                return self._wrap_element(result)
        return wrapper
1172661
def wrap_function(func):
    
    if is_text(func):
        return compile_expression(func)

    numarg = func.__code__.co_argcount
    if numarg == 0:

        def temp(row, rownum, rows):
            return func()

        return temp
    elif numarg == 1:

        def temp(row, rownum, rows):
            return func(row)

        return temp
    elif numarg == 2:

        def temp(row, rownum, rows):
            return func(row, rownum)

        return temp
    elif numarg == 3:
        return func
205185
function wrapHandler(handler) {
  return function (state, ...args) {
    return _.assign({}, state, handler(state, ...args));
  };
}
1231066
def _wrap_functions(self, client):
        

        def wrap(fn):
            def wrapper(*args, **kwargs):
                """Simple wrapper for to catch dead clients."""
                try:
                    return fn(*args, **kwargs)
                except (ConnectionError, TimeoutError):  # TO THE PENALTY BOX!
                    self._penalize_client(client)
                    raise

            return functools.update_wrapper(wrapper, fn)

        for name in dir(client):
            if name.startswith("_"):
                continue
            # Some things aren't wrapped
            if name in ("echo", "execute_command", "parse_response"):
                continue
            obj = getattr(client, name)
            if not callable(obj):
                continue
            log.debug("Wrapping %s", name)
            setattr(client, name, wrap(obj))
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;
    }
}
1318638
function wrap(func) {
      return function wrappedParsePromise() {
        var args = Array.prototype.slice.call(arguments, 0);
        var parsePromise = func.apply(this, args);
        var promise = $q(parsePromise.then.bind(parsePromise));
        wrapParsePromise(promise, parsePromise);
        return promise;
      };
    }
1239127
def _wrap_set_op(self, fun, arg):
        """"""
        result = fun(self, arg)
        result._autostep = self._autostep
        result.padding = self.padding
        return result
379059
function wrapItUp(){
		let optValue = currentOption.values;
		
		// Don't store solitary values in an array. Store them directly as strings
		if(1 === currentOption.arity && !currentOption.variadic)
			optValue = optValue[0];

		setValue(currentOption, optValue);
		currentOption.values = [];
		currentOption = null;
	}
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);
}
428772
def _wrap(self, ret):
        
        if self.chained:
            self._wrapped = ret
            return self
        else:
            return ret
979021
def _wrap_define_function(original_function):
    """"""

    def wrapper(*args, **kwargs):
        """Wrapper function that turns old keyword names to new ones."""
        has_old_names = False
        for old_name, new_name in _six.iteritems(_RENAMED_ARGUMENTS):
            if old_name in kwargs:
                has_old_names = True
                value = kwargs.pop(old_name)
                kwargs[new_name] = value
        if has_old_names:
            _logging.warning(
                "Use of the keyword argument names (flag_name, default_value, "
                "docstring) is deprecated, please use (name, default, help) instead."
            )
        return original_function(*args, **kwargs)

    return wrapper