Check if arguments are list type.
12320
def list_check(*args, func=None):
    """"""
    func = func or inspect.stack()[2][3]
    for var in args:
        if not isinstance(var, (list, collections.UserList, collections.abc.MutableSequence)):
            name = type(var).__name__
            raise ListError(
                f'Function {func} expected list, {name} got instead.')
507767
def check_arguments(c: typing.Callable,
                    hints: typing.Mapping[str, typing.Optional[type]],
                    *args, **kwargs) -> None:
    
    signature = inspect.signature(c)
    bound = signature.bind(*args, **kwargs)
    for argument_name, value in bound.arguments.items():
        try:
            type_hint = hints[argument_name]
        except KeyError:
            continue
        actual_type, correct = check_type(value, type_hint)
        if not correct:
            raise TypeError(
                'Incorrect type `{}`, expected `{}` for `{}`'.format(
                    actual_type, type_hint, argument_name
                )
            )
1301057
def check_type(*args, **kwargs):
    ''' 
    '''
    args = tuple(x if isinstance(x, collections.Iterable) else (x,) for x in args)
    kwargs = {x: kwargs[x] if isinstance(kwargs[x], collections.Iterable) else (kwargs[x],) for x in kwargs}

    def decorate(func):
        types = args
        kwtypes = kwargs
        gi = "Got <{}> instead"
        errmsg1 = "to be of type <{}>. " + gi
        errmsg2 = "to be one of type ({}). " + gi
        errar = "{}:{} expected '{}' "
        errkw = "{}:{} expected {} "

        def check(*ar, **kw):
            line = inspect.getouterframes(inspect.currentframe())[1][2]
            fname = os.path.basename(inspect.getouterframes(inspect.currentframe())[1][1])

            for arg, type_ in zip(ar, types):
                if type(arg) not in type_:
                    if len(type_) == 1:
                        raise TypeError((errar + errmsg1).format(fname, line, arg, type_[0].__name__,
                                                                 type(arg).__name__))
                    else:
                        raise TypeError((errar + errmsg2).format(fname, line, arg,
                                                                 ', '.join('<%s>' % x.__name__ for x in type_),
                                                                 type(arg).__name__))
            for kwarg in kw:
                if kwtypes.get(kwarg, None) is None:
                    continue
                if type(kw[kwarg]) not in kwtypes[kwarg]:
                    if len(kwtypes[kwarg]) == 1:
                        raise TypeError((errkw + errmsg1).format(fname, line, kwarg, kwtypes[kwarg][0].__name__,
                                                                 type(kw[kwarg]).__name__))
                    else:
                        raise TypeError((errkw + errmsg2).format(
                            fname,
                            line,
                            kwarg,
                            ', '.join('<%s>' % x.__name__ for x in kwtypes[kwarg]),
                            type(kw[kwarg]).__name__)
                        )

            return func(*ar, **kw)

        return check

    return decorate
125420
def _check_type(self, check_type, properties):
        """"""
        if 'PrimitiveType' in properties:
            return properties['PrimitiveType'] == check_type
        if properties['Type'] == 'List':
            if 'ItemType' in properties:
                return properties['ItemType'] == check_type
            else:
                return properties['PrimitiveItemType'] == check_type
        return False
810640
function isType(type, val) {
  if (Struct.typeChecker[type]) {
    return Struct.typeChecker[type](val);
  }
  return false;
}
1372399
def is_list(self, key):
        """"""
        data = self.model.get_data()
        return isinstance(data[key], (tuple, list))
434470
public static boolean isListClass(Class<?> type) {
        if (type.isPrimitive() || type.isEnum()) {
            return false;
        }
        return type.equals(List.class);
    }
1216280
def infer_list_subtype(items):
        """"""
        subtype = End

        for item in items:
            item_type = type(item)
            if not issubclass(item_type, Base):
                continue

            if subtype is End:
                subtype = item_type
                if not issubclass(subtype, List):
                    return subtype
            elif subtype is not item_type:
                stype, itype = subtype, item_type
                generic = List
                while issubclass(stype, List) and issubclass(itype, List):
                    stype, itype = stype.subtype, itype.subtype
                    generic = List[generic]

                if stype is End:
                    subtype = item_type
                elif itype is not End:
                    return generic.subtype
        return subtype
368860
def _check_type(self, ref, value):
        
        if isinstance(value, list):
            return [self._check_type(ref, val) for val in value]

        model_type = self.cube.model[ref].datatype
        if model_type is None:
            return
        query_type = self._api_type(value)
        if query_type == model_type:
            return
        else:
            raise QueryException("Invalid value %r parsed as type '%s' "
                                 "for cut %s of type '%s'"
                                 % (value, query_type, ref, model_type))
1343922
def check_argument_types(cllable = None, call_args = None, clss = None, caller_level = 0):
    
    return _check_caller_type(False, cllable, call_args, clss, caller_level+1)
1247959
def _check_search_kwarg_types(self, kwargs):
        ''''''
        for key in kwargs:
            if key not in self.node_types:
                raise TypeError("Invalid search type: {}".format(key))
623347
def is_list_of_states(self, arg):
        
        return isinstance(arg, list) and all(isinstance(i, tuple) for i in arg)
1237601
def fix_list_arguments(self):
        """"""
        either = [list(c.children) for c in self.either.children]
        for case in either:
            case = [c for c in case if case.count(c) > 1]
            for a in [e for e in case if type(e) == Argument]:
                a.value = []
        return self
406471
def _check_args(self, source):
        '''
        '''
        path = [source]
        args = self.parsed_yaml.get('args', {})
        self._assert_struct_type(args, 'args', (dict, list), path)
        path.append('args')
        if isinstance(args, dict):
            for argn, argattrs in args.items():
                self._check_one_arg(path, argn, argattrs)
        else: # must be list - already asserted struct type
            for argdict in args:
                self._assert_command_dict(argdict, '[list-item]', path)
                argn, argattrs = list(argdict.items())[0] # safe - length asserted on previous line
                self._check_one_arg(path, argn, argattrs)
589906
def type_check(arg_name, pos, reqd_type):
    

    def decorator(fn):

        # brevity compromised in favour of readability
        def logic(*args, **kwargs):
            arg_count = len(args)
            if arg_count:
                if pos < arg_count:
                    if isinstance(args[pos], reqd_type):
                        return fn(*args, **kwargs)
                    else:
                        raise TypeError("'{0}' at position {1} not of type {2}".format(args[pos], pos, reqd_type))
                else:
                    if arg_name in kwargs:
                        value = kwargs[arg_name]
                        if isinstance(value, reqd_type):
                            return fn(*args, **kwargs)
                        else:
                            raise TypeError("'{0}' is not of type {1}".format(arg_name, reqd_type))
                    else:
                        # partially applied functions because of incomplete args, let python handle this
                        return fn(*args, **kwargs)
            else:
                if arg_name in kwargs:
                    value = kwargs[arg_name]
                    if isinstance(value, reqd_type):
                        return fn(*args, **kwargs)
                else:
                    raise TypeError("'{0}' is not of type {1}".format(arg_name, reqd_type))

        return logic

    return decorator
169909
protected static boolean writeListType(Output out, Object listType) {
        log.trace("writeListType");
        if (listType instanceof List<?>) {
            writeList(out, (List<?>) listType);
        } else {
            return false;
        }
        return true;
    }
921327
def detect_output_type(args):
    """"""
    if not args['single'] and not args['multiple']:
        # Save to multiple files if multiple files/URLs entered
        if len(args['query']) > 1 or len(args['out']) > 1:
            args['multiple'] = True
        else:
            args['single'] = True