Check arg's type is one in type_list, otherwise,
    raises an error.
185956
def check_type(lineno, type_list, arg):
    
    if not isinstance(type_list, list):
        type_list = [type_list]

    if arg.type_ in type_list:
        return True

    if len(type_list) == 1:
        syntax_error(lineno, "Wrong expression type '%s'. Expected '%s'" %
                     (arg.type_, type_list[0]))
    else:
        syntax_error(lineno, "Wrong expression type '%s'. Expected one of '%s'"
                     % (arg.type_, tuple(type_list)))

    return False
1142623
def _check_bool(result, func, args):  # pylint: disable=unused-argument
    

    if not result:
        raise ctypes.WinError(ctypes.get_last_error())
    return args
209163
def _validate_argument(self, arg):
        """"""
        if arg is None:
            return arg

        if isinstance(arg, type):
            return InstanceOf(arg)
        if not isinstance(arg, BaseMatcher):
            raise TypeError(
                "argument of %s can be a type or a matcher (got %r)" % (
                    self.__class__.__name__, type(arg)))

        return arg
239941
def raise_type_error(key, type)
      raise_error(type: "type", key: key, supposed: type, found: key.class)
    end
1072522
def ensure_tuple(arg, len_=None):
    
    if not is_tuple(arg, len_=len_):
        len_part = "" if len_ is None else " of length %s" % len_
        raise TypeError(
            "expected tuple%s, got %s" % (len_part, _describe_type(arg)))
    return arg
497323
def in_argv(arg_list):
    
    for arg in sys.argv:
        for parg in arg_list:
            if parg == arg or arg.startswith(parg):
                return True
    return False
1161464
def _check_arg_length(fname, args, max_fname_arg_count, compat_args):
    
    if max_fname_arg_count < 0:
        raise ValueError("'max_fname_arg_count' must be non-negative")

    if len(args) > len(compat_args):
        max_arg_count = len(compat_args) + max_fname_arg_count
        actual_arg_count = len(args) + max_fname_arg_count
        argument = 'argument' if max_arg_count == 1 else 'arguments'

        raise TypeError(
            "{fname}() takes at most {max_arg} {argument} "
            "({given_arg} given)".format(
                fname=fname, max_arg=max_arg_count,
                argument=argument, given_arg=actual_arg_count))
279925
def invalid_type_error(method_name, arg_name, got_value, expected_type,
                       version='0.13.0'):
    
    got_type = type(got_value)
    msg = ("As of {version}, 'adapter.{method_name}' expects argument "
           "'{arg_name}' to be of type '{expected_type}', instead got "
           "{got_value} ({got_type})")
    raise_compiler_error(msg.format(version=version, method_name=method_name,
                         arg_name=arg_name, expected_type=expected_type,
                         got_value=got_value, got_type=got_type))
1241279
def is_valid(cls, arg):
        
        return (isinstance(arg, (int, long)) and (arg >= 0)) or \
            isinstance(arg, basestring)
388677
def check_arguments(cls, passed):
        """"""
        defaults = list(cls.default_arguments().keys())
        template = ("Pass arg {argument:!r} in {cname:!r}, can be a typo? "
                    "Supported key arguments: {defaults}")
        fails = []
        for arg in passed:
            if arg not in defaults:
                warn(template.format(argument=arg,
                                     cname=cls.__name__,
                                     defaults=defaults))
                fails.append(arg)

        return any(fails)
423737
def __get_type_args(for_type=None, for_types=None):
        
        if for_type:
            if for_types:
                raise ValueError("Cannot pass both for_type and for_types.")
            for_types = (for_type,)
        elif for_types:
            if not isinstance(for_types, tuple):
                raise TypeError("for_types must be passed as a tuple of "
                                "types (classes).")
        else:
            raise ValueError("Must pass either for_type or for_types.")

        return for_types
362390
def verifyArguments(self, arg):
        
        for l in arg:
            if not type(l) == list and \
               not type(l) == type(Numeric.array([0.0])) and \
               not type(l) == tuple and \
               not type(l) == dict:
                return 0
            if type(l) == dict:
                for i in l:
                    if not type(i) == str and i not in list(self.layers.keys()):
                        return 0
            else:
                for i in l:
                    if not type(i) == float and not type(i) == int:
                        return 0
        return 1
1123274
def check_arguments(self):
        
        for k, v in self.Parameters.iteritems():
            if self.Parameters[k].isOn():
                if k in self._valid_arguments:
                    if not self._valid_arguments[k](v.Value):
                        error_message = 'Invalid argument (%s) ' % v.Value
                        error_message += 'for parameter %s\n' % k
                        raise InvalidArgumentApplicationError(error_message)
901872
def type_check_and_str(python_type, value):
    """"""
    if not isinstance(value, python_type):
        raise GraphQLInvalidArgumentError(u'Attempting to represent a non-{type} as a {type}: '
                                          u'{value}'.format(type=python_type, value=value))

    return str(value)
65260
def AssertType(value, expected_type):
  
  if not isinstance(value, expected_type):
    message = "Expected type `%r`, but got value `%r` of type `%s`"
    message %= (expected_type, value, type(value))
    raise TypeError(message)
865448
def check_is_a_sequence(var, allow_none=False):
    
    if not is_a_sequence(var, allow_none=allow_none):
        raise TypeError("var must be a list or tuple, however type(var) is {}"
                        .format(type(var)))
294348
def validate_type(value, types, **kwargs):
    
    if not is_value_of_any_type(value, types):
        raise ValidationError(MESSAGES['type']['invalid'].format(
            repr(value), get_type_for_value(value), types,
        ))