def Check(self, params, named_params):
    """Ensures that the parameters used while recording a call are valid.

    Args:
      # params: A list of positional parameters.
      # named_params: A dict of named parameters.
      params: list
      named_params: dict

    Raises:
      AttributeError: the given parameters don't work with the given method.
    """
    arg_status = dict((a, MethodCallChecker._NEEDED)
                      for a in self._required_args)
    for arg in self._default_args:
      arg_status[arg] = MethodCallChecker._DEFAULT

    # Check that each positional param is valid.
    for i in range(len(params)):
      try:
        arg_name = self._args[i]
      except IndexError:
        if not self._has_varargs:
          raise AttributeError('%s does not take %d or more positional '
                               'arguments' % (self._method.__name__, i))
      else:
        self._RecordArgumentGiven(arg_name, arg_status)

    # Check each keyword argument.
    for arg_name in named_params:
      if arg_name not in arg_status and not self._has_varkw:
        raise AttributeError('%s is not expecting keyword argument %s'
                             % (self._method.__name__, arg_name))
      self._RecordArgumentGiven(arg_name, arg_status)

    # Ensure all the required arguments have been given.
    still_needed = [k for k, v in arg_status.iteritems()
                    if v == MethodCallChecker._NEEDED]
    if still_needed:
      raise AttributeError('No values given for arguments %s'
                           % (' '.join(sorted(still_needed))))
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/mox/mox.py/MethodCallChecker.Check/original