Check if something quacks like a list.
14192
def is_listish(obj):
    """"""
    if isinstance(obj, (list, tuple, set)):
        return True
    return is_sequence(obj)
1104256
def ensure_list(value: Union[T, Sequence[T]]) -> Sequence[T]:
    """"""
    if value is None:
        return []
    return value if isinstance(value, list) else [value]
449290
def check(self, data):
        """"""
        if isinstance(data, Iterable):
            data = "".join(str(x) for x in data)
        try:
            data = str(data)
        except UnicodeDecodeError:
            return False
        return bool(data and self.__regexp.match(data))
667756
def _check_split_list_validity(self):
        
        # FIXME: Currently very primitive, but needs to be fast
        if not (hasattr(self,"_splitListsSet") and (self._splitListsSet)):
            return False
        elif len(self) != self._splitListsLength:
            return False
        else:
            return True
326967
def samecode_alerts(self, samecode):
        """"""
        return [x for x in self._alerts if samecode in x.samecodes]
435674
def _check_list_len(row, length):
        
        if len(row) != length:
            raise Exception(
                "row length does not match expected length of " +
                str(length) + "\nrow: " + str(row))
649599
def isValidList(self, l):  # modified to flatten lists specified using [ a rdf:List; ] syntax
        
        try:
            if self.store.value(l, RDF.first) is None:
                return False
        except:
            return False
        while l:
            if l != RDF.nil:
                po = list(self.store.predicate_objects(l))
                if (RDF.type, RDF.List) in po and len(po) == 3:
                    pass
                elif len(po) != 2:
                    return False
            l = self.store.value(l, RDF.rest)
        return True
80707
static boolean isLineNumberList(List<Long> list) {
    if (list == null) {
      return false;
    }
    for (Long line : list) {
      if (line != null && line < 1) {
        return false;
      }
    }
    return true;
  }
648818
function isList(opts: Options, node: Node): boolean {
    return opts.types.includes(node.type);
}
271306
function(list, checks) {
		var result = -1;
		list.every(function(a, index) {
			if (a.every(function(b, i) {
				return b === checks[i];
			})) {
				result = index;
			}
			return result === -1;
		});
		return result;
	}
658887
def check_has(priority=BaseCheck.HIGH, gname=None):
    """"""

    def _inner(func):
        def _dec(s, ds):
            attr_process = kvp_convert(func(s, ds))

            ret_val = []
            # could potentially run tests in parallel if we eliminated side
            # effects on `ret_val`
            for kvp in attr_process.items():
                # function mutates ret_val
                attr_check(kvp, ds, priority, ret_val, gname)
            return ret_val

        return wraps(func)(_dec)

    return _inner
1270380
def __args_check(self, valid, args=None, kwargs=None):
        '''
        
        '''
        if not isinstance(valid, list):
            valid = [valid]
        for cond in valid:
            if not isinstance(cond, dict):
                # Invalid argument
                continue
            # whitelist args, kwargs
            cond_args = cond.get('args', [])
            good = True
            for i, cond_arg in enumerate(cond_args):
                if args is None or len(args) <= i:
                    good = False
                    break
                if cond_arg is None:  # None == '.*' i.e. allow any
                    continue
                if not self.match_check(cond_arg, six.text_type(args[i])):
                    good = False
                    break
            if not good:
                continue
            # Check kwargs
            cond_kwargs = cond.get('kwargs', {})
            for k, v in six.iteritems(cond_kwargs):
                if kwargs is None or k not in kwargs:
                    good = False
                    break
                if v is None:  # None == '.*' i.e. allow any
                    continue
                if not self.match_check(v, six.text_type(kwargs[k])):
                    good = False
                    break
            if good:
                return True
        return False
23264
def validate_list(self, value):
        
        if len(value) > self.max_items:
            raise ValidationError(
                u'list must not contain more than {max_items} items.'.format(max_items=self.max_items)
            )

        if all(isinstance(item, six.string_types) for item in value) is False:
            raise ValidationError(u'list must only contain strings.')

        return value
896784
def _has_data(self):
        """"""
        return any([
            len([
                v for a in (s[0] if is_list_like(s) else [s])
                for v in (a if is_list_like(a) else [a]) if v is not None
            ]) for s in self.raw_series
        ])
1336268
def p_elseif_list(p):
    ''''''
    if len(p) == 2:
        p[0] = []
    else:
        p[0] = p[1] + [ast.ElseIf(p[4], p[6], lineno=p.lineno(2))]
829422
def _check_if_all_updated(self):
        """"""
        for g in self.toc.toc:
            if g not in self.values:
                return False
            for n in self.toc.toc[g]:
                if n not in self.values[g]:
                    return False

        return True
195982
def _check_list_minions(self, expr, greedy, ignore_missing=False):  # pylint: disable=unused-argument
        '''
        
        '''
        if isinstance(expr, six.string_types):
            expr = [m for m in expr.split(',') if m]
        minions = self._pki_minions()
        return {'minions': [x for x in expr if x in minions],
                'missing': [] if ignore_missing else [x for x in expr if x not in minions]}