Resolve function call arguments that have object ids
        into instances of these objects
171449
def resolve_args(self, args):
        
        def resolve(a):
            if isinstance(a, dict):
                _id = a.get('i', None)
                # If it's a compound type (including dict)
                # Check if it has id (i) to determine that it has
                # a reference in object storage. If it's None, then it's
                # a dict originated at the remote
                return self.objects[_id] if _id else a['v']
            # if array, resolve it's elements
            if isinstance(a, (list, tuple)):
                return [resolve(i) for i in a]
            return a

        return [resolve(a) for a in args]
1104166
function(object, func, thisp) {
		var res = [];
		for (var key in object) {
			res.push(func.call(thisp, key, object[key]));
		}
		return res.filter(function(result) {
			return result !== undefined;
		});
	}
134743
function each (obj, fn) {
      var key;
      for (key in obj) {
        if (Object.hasOwnProperty.call(obj, key)) {
          fn(key);
        }
      }
    }
181466
function callnTimes (object, methodName, count) {
    let returnValue
    while (count--) returnValue = object[methodName]()
    return returnValue
  }
438709
def resolve(self, ts):
        
        if isinstance(ts, six.string_types):
            ts = [ts]

        obj = self
        while len(ts) > 0:
            t = ts.pop(0)

            if issubclass(obj.__class__, BaseObj):
                obj = getattr(obj, t)
            elif isinstance(obj, list):
                obj = obj[int(t)]
            elif isinstance(obj, dict):
                obj = obj[t]

        return obj
1215410
function resolveItem(arg) {
  if (Array.isArray(arg)) {
    return resolveArray(arg);
  } else if (Object.prototype.toString.call(arg) === '[object Function]') {
    //is a function
    return Promise.method(arg)().then(resolveItem);
  } else if (isThenable(arg)) {
    //is a promise
    return arg.then(resolveItem);
  } else if (arg && typeof arg === 'object') {
    //is an object
    if (typeof arg.toString === 'function') {
      var value = arg.toString();
      if (value !== '[object Object]') {
        //with a valid toString
        return Promise.resolve(value);
      }
    }
    return resolveObject(arg);
  } else {
    //Yeah! a value
    return Promise.resolve(arg);
  }
}
420869
function resolveFilesInParams(params, files) {
	var fileIds = Object.keys(files || {});

	var fileCount = fileIds.length;
	if (fileCount === 0) {
		return;
	}

	// scan all members for files, and collect children

	function addMembers(list, obj) {
		var keys = Object.keys(obj || {});

		for (var i = 0; i < keys.length; i++) {
			list.push({
				owner: obj,
				key: keys[i],
				value: obj[keys[i]]
			});
		}
	}

	var list = [];

	addMembers(list, params);

	for (var i = 0; i < list.length && fileCount > 0; i++) {
		var member = list[i];

		if (!member.value) {
			continue;
		}

		var type = typeof member.value;

		if (type === 'object') {
			// append children to the end of the list

			addMembers(list, member.value);
		} else if (type === 'string' && files[member.value]) {
			// file found for this property, so assign it

			var file = files[member.value];

			logger.verbose('Accepted file', '"' + file.partName + '":', file.fileName);

			member.owner[member.key] = file;

			delete files[member.value];
			fileCount -= 1;
		}
	}
}
815893
function bindCallbacks( o, callbacks, args ) {
		var prop = QUnit.objectType( o );
		if ( prop ) {
			if ( QUnit.objectType( callbacks[ prop ] ) === "function" ) {
				return callbacks[ prop ].apply( callbacks, args );
			} else {
				return callbacks[ prop ]; // or undefined
			}
		}
	}
258458
def extract_id(*object_types):
    

    def outer(func):
        def inner(*args, **kwargs):
            def id_of(x):
                return x.id if type(x) in object_types else x

            new_args = [id_of(arg) for arg in args]
            new_kwargs = {k: id_of(v) for k, v in kwargs.items()}
            return func(*new_args, **new_kwargs)

        return inner

    return outer
592760
function _normalizeArguments(obj) {
    var args = arguments;

    if (!obj || Utils.isFunction(obj)) {
      args = Array.prototype.slice.call(arguments, 0);
      args.unshift({});
    }

    return args;
  }
188390
def get_args(obj):
    """"""
    if inspect.isfunction(obj):
        return inspect.getargspec(obj).args
    elif inspect.ismethod(obj):
        return inspect.getargspec(obj).args[1:]
    elif inspect.isclass(obj):
        return inspect.getargspec(obj.__init__).args[1:]
    elif hasattr(obj, '__call__'):
        return inspect.getargspec(obj.__call__).args[1:]
    else:
        raise TypeError("Can't inspect signature of '%s' object." % obj)
51317
def _resolve_to_func(self, what):
        """"""
        if isinstance(what, str):
            what = getattr(Adapter._get_property(self), what)

        # makes it an unbounded function if needed
        if type(what) == types.MethodType:
            what = what.__func__

        if not type(what) == types.FunctionType:
            raise TypeError("Expected a method name, a method or a function")
        return what
1350639
function lookupArgs (args, cb) {
  if (!args.length) return readInstalled([], function (er, inst) {
    if (er) return cb(er)
    var a = []
    asyncMap(Object.keys(inst), function (p, cb) {
      cb(null, Object.keys(inst[p]).map(function (v) {
        var o = {}
        o[p] = {}
        o[p][v] = inst[p][v]
        if (o[p][v].active) o[p].active = v
        return o
      }))
    }, cb)
  })
  var req = {}
  args.forEach(function (a) {
    a = a.split("@")
    var n = a.shift()
      , v = a.join("@")
    ;(req[n] = req[n] || []).push(v)
  })
  log.silly(req, "rebuild request")
  readInstalled(Object.keys(req), function (er, inst) {
    asyncMap(Object.keys(inst), function (p, cb) {
      if (!req.hasOwnProperty(p)) return cb()
      var matches = []
      Object.keys(inst[p]).forEach(function (v) {
        req[p].forEach(function (r) {
          var o = {}
          o[p] = {}
          if (inst[p][v].active) o[p].active = v
          if (semver.satisfies(v, r)) o[p][v] = inst[p][v]
          matches.push(o)
        })
      })
      log.verbose(p, "rebuild")
      cb(null, matches)
    }, cb)
  })
}
1128641
def resolve_functions(slither, functions):
    
    # Create the resolved list.
    resolved = []

    # Verify that the provided argument is a list.
    if not isinstance(functions, list):
        raise ResolveFunctionException("Provided functions to resolve must be a list type.")

    # Loop for each item in the list.
    for item in functions:
        if isinstance(item, str):
            # If the item is a single string, we assume it is of form 'ContractName.FunctionName'.
            parts = item.split('.')
            if len(parts) < 2:
                raise ResolveFunctionException("Provided string descriptor must be of form 'ContractName.FunctionName'")
            resolved.append(resolve_function(slither, parts[0], parts[1]))
        elif isinstance(item, tuple):
            # If the item is a tuple, it should be a 2-tuple providing contract and function names.
            if len(item) != 2:
                raise ResolveFunctionException("Provided tuple descriptor must provide a contract and function name.")
            resolved.append(resolve_function(slither, item[0], item[1]))
        else:
            raise ResolveFunctionException(f"Unexpected function descriptor type to resolve in list: {type(item)}")

    # Return the resolved list.
    return resolved
313486
function merge(var_args) {
              var args = [].slice.call(arguments),
                  newObj = Object.create(null),
                  id = 0, key;

              while (args[id]) {
                for (key in args[id]) {
                  newObj[key] = args[id][key];
                }

                id++;
              }

              return newObj;
            }
69519
function (obj, method, args) {
        switch (args.length) {
        case 0: return obj[method]();
        case 1: return obj[method](args[0]);
        case 2: return obj[method](args[0], args[1]);
        case 3: return obj[method](args[0], args[1], args[2]);
        case 4: return obj[method](args[0], args[1], args[2], args[3]);
        case 5: return obj[method](args[0], args[1], args[2], args[3], args[4]);
        }
    }
217858
function parseArgs (argv, args) {
  var argc = argv.length;
  var sel;
  if (argc === 1) {
    var arg = argv[0];
    if (typeof arg === 'string') {
      // selector with no arguments
      sel = arg;
    } else {
      // legacy API: an Object was passed in
      sel = [];
      Object.keys(arg).forEach(function (s) {
        sel.push(s);
        args.push(arg[s]);
      });
      sel.push('');
      sel = sel.join(':');
    }
  } else {
    // varargs API
    sel = [];
    for (var i=0; i<argc; i+=2) {
      sel.push(argv[i]);
      args.push(argv[i+1]);
    }
    sel.push('');
    sel = sel.join(':');
  }
  return sel;
}