Checks if arg is list-like. This excludes strings and dicts.
175464
def _is_list(arg):
    """"""
    if isinstance(arg, dict):
        return False
    if isinstance(arg, str): # Python 3-only, as str has __iter__
        return False
    return (not _has_method(arg, "strip")
            and _has_method(arg, "__getitem__")
            or _has_method(arg, "__iter__"))
737752
def stripArgs(args, blacklist):
		
		blacklist = [b.lower() for b in blacklist]
		return list([arg for arg in args if arg.lower() not in blacklist])
573023
def is_list_of_list_of_states(self, arg):
        
        if arg is None:
            return False
        return all([isinstance(arg, list),
                   all(isinstance(i, list) for i in arg),
                   all((isinstance(i, tuple) for i in lst) for lst in arg)])
1241279
def is_valid(cls, arg):
        
        return (isinstance(arg, (int, long)) and (arg >= 0)) or \
            isinstance(arg, basestring)
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)
358179
def _AsList(arg):
    """"""
    if (isinstance(arg, string_types) or
        not isinstance(arg, collections.Iterable)):
      return [arg]
    else:
      return list(arg)
1194999
def check_args(args):
    """"""
    check_args_has_attributes(args)
    if args.v:
        non_version_attrs = [v for k, v in args.__dict__.items() if k != 'v']
        print('non_version_attrs', non_version_attrs)
        if len([v for v in non_version_attrs if v is not None]) != 0:
            fail('Cannot show the version number with another command.')
        return
    if args.i is None:
        fail('Cannot draw ER diagram of no database.')
    if args.o is None:
        fail('Cannot draw ER diagram with no output file.')
141737
def findArgs(args, prefixes):
		
		return list([
			arg for arg in args
			if len([p for p in prefixes if arg.lower().startswith(p.lower())]) > 0
		])
63279
def args_as_tuple(self):
        
        value = self.arguments["header-names"]
        if isinstance(value, list):
            value = "[{}]".format(
                ",".join('"{}"'.format(item) for item in value))
        if not value.startswith("["):
            return ('exists', value.strip('"'))
        return ("exists", ) + tuple(tools.to_list(value))
1077462
def one_of(*args):
    
    if len(args) == 1 and isinstance(args[0], list):
        items = args[0]
    else:
        items = list(args)

    def validate(value):
        if not value in items:
            return e("{} is not in the list {}", value, items)
    return validate
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
205069
def validate_args(f):
    

    def wrapper(self, args):
        arg_types = set([type(arg) for arg in args])
        if len(arg_types) > 1:
            raise TypeError("Mixed input types are not allowed")

        elif list(arg_types)[0] not in (dict, str):
            raise TypeError("Only dict and str types accepted")

        return f(self, args)

    return wrapper
1313424
def check_arguments(self):
        """"""
        for name, default in self.argdict.items():
            if name not in self.names and default is NODEFAULT:
                raise NameError('Missing argparse specification for %r' % name)
333021
def _check_arguments(symbol):
    
    arg_set = set()
    arg_names = symbol.list_arguments()
    for name in arg_names:
        if name in arg_set:
            raise ValueError(('Find duplicated argument name \"%s\", ' +
                              'please make the weight name non-duplicated(using name arguments), ' +
                              'arguments are %s') % (name, str(arg_names)))
        arg_set.add(name)

    aux_set = set()
    aux_names = symbol.list_auxiliary_states()
    for name in aux_names:
        if name in aux_set:
            raise ValueError(
                ('Find duplicated auxiliary param name \"%s\", ' +
                 'please make the weight name non-duplicated(using name arguments), ' +
                 'arguments are %s, auxiliary params are %s'
                ) % (name, str(arg_names), str(aux_names)))
        aux_set.add(name)
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)
550564
def isuncertainties(arg_list):
    
    for arg in arg_list:
        if isinstance(arg, (list, tuple)) and isinstance(arg[0], uct.UFloat):
            return True
        elif isinstance(arg, np.ndarray) and isinstance(
                np.atleast_1d(arg)[0], uct.UFloat):
            return True
        elif isinstance(arg, (float, uct.UFloat)) and \
                isinstance(arg, uct.UFloat):
            return True
    return False
1234963
def _filter_kwargs(self, keep_list, **kwargs):
        ''' 
        '''
        new_kwargs = {}
        for argName, argVal in kwargs.items():
            if argName.lower() in keep_list:
                new_kwargs[argName.lower()] = argVal
        return new_kwargs