Parameters
    ----------
    l : list of arrays

    Returns
    -------
    a set of kinds that exist in this list of arrays
426763
def get_dtype_kinds(l):
    

    typs = set()
    for arr in l:

        dtype = arr.dtype
        if is_categorical_dtype(dtype):
            typ = 'category'
        elif is_sparse(arr):
            typ = 'sparse'
        elif isinstance(arr, ABCRangeIndex):
            typ = 'range'
        elif is_datetime64tz_dtype(arr):
            # if to_concat contains different tz,
            # the result must be object dtype
            typ = str(arr.dtype)
        elif is_datetime64_dtype(dtype):
            typ = 'datetime'
        elif is_timedelta64_dtype(dtype):
            typ = 'timedelta'
        elif is_object_dtype(dtype):
            typ = 'object'
        elif is_bool_dtype(dtype):
            typ = 'bool'
        elif is_extension_array_dtype(dtype):
            typ = str(arr.dtype)
        else:
            typ = dtype.kind
        typs.add(typ)
    return typs
1109718
def arrays(self):
        
        return [x for x in self[self.current_scope].values() if x.class_ == CLASS.array]
410839
def is_array_type(type_):
    

    array_types = _get_types(Types.ARRAY)
    if is_typing_type(type_):
        return type_ in array_types or (
            hasattr(type_, "__origin__") and type_.__origin__ in array_types
        )
    return type_ in array_types
526883
def flatten(l):
    
    l = list(l)
    i = 0
    while i < len(l):
        while isinstance(l[i], list):
            if not l[i]:
                l.pop(i)
                i -= 1
                break
            else:
                l[i:i + 1] = l[i]
        i += 1
    return l
1352201
def argument_kind(args):
    # type: (List[Argument]) -> Optional[str]
    
    kinds = set(arg.kind for arg in args)
    if len(kinds) != 1:
        return None
    return kinds.pop()
39004
def registered_types
      list = []

      registered_types_internal.each_pair do |type, ary|
        list << {type: type, class: ary[0], unpacker: ary[2]}
      end

      list.sort{|a, b| a[:type] <=> b[:type] }
    end
389690
def flatten(l):
    '''  '''
    for el in l:
        if isinstance(el, collections.Iterable) and not isinstance(el, string_types):
            for sub in flatten(el):
                yield sub
        else:
            yield el
1177672
def _result_type_many(*arrays_and_dtypes):
    
    try:
        return np.result_type(*arrays_and_dtypes)
    except ValueError:
        # we have > NPY_MAXARGS terms in our expression
        return reduce(np.result_type, arrays_and_dtypes)
778400
def flat(l):
    
    newl = []
    for i in range(len(l)):
        for j in range(len(l[i])):
            newl.append(l[i][j])
    return newl
793166
@Requires({
    "elements != null",
    "!elements.contains(null)",
    "clazz != null",
    "kinds != null"
  })
  @SuppressWarnings("unchecked")
  public static <T extends ElementModel> List<? extends T> filter(
      List<? extends ElementModel> elements, Class<T> clazz,
      ElementKind... kinds) {
    ArrayList<T> result = new ArrayList<T>();
    List<ElementKind> list = Arrays.asList(kinds);
    for (ElementModel element : elements) {
      if (list.contains(element.getKind())
          && clazz.isAssignableFrom(element.getClass())) {
        result.add((T) element);
      }
    }
    return Collections.unmodifiableList(result);
  }
1264903
private static <T extends Comparable<T>> List<T> lcs(List<T> arg0, List<T> arg1, int i, int j) {
        if (arg0.size() == i || arg1.size() == j) {
            return new ArrayList<>(Math.min(arg0.size(), arg1.size()));
        }

        if (arg0.get(i) != null && arg1.get(j) != null && arg0.get(i).compareTo(arg1.get(j)) == 0) {
            T t = arg0.get(i);
            List<T> list = lcs(arg0, arg1, i + 1, j + 1);
            list.add(t);
            return list;
        } else {
            List<T> l1 = lcs(arg0, arg1, i + 1, j);
            List<T> l2 = lcs(arg0, arg1, i, j + 1);
            return l1.size() > l2.size() ? l1 : l2;
        }
    }
57905
def kinds(context, show_all, ids_or_names):
    
    logging.info(_('Entering kind mode'))
    logging.debug('args: %s', ids_or_names)
    sense = context.obj['sense']
    none = True
    if show_all:
        none = False
        print(sense.query_kinds(None))
    else:
        for id_or_name in ids_or_names:
            id_name = sense.query_kinds(id_or_name)
            if id_name:
                none = False
                print(id_name)
    sys.exit(1 if none else 0)
956237
def ints(l, ifilter=lambda x: x, idescr=None):
    
    if isinstance(l, string_types):
        if l[0] == '[' and l[-1] == ']':
            l = l[1:-1]
        l = list(map(lambda x: x.strip(), l.split(',')))
    try:
        l = list(map(ifilter, list(map(int, l))))
    except:
        raise ValueError("Bad list of {}integers"
                         .format("" if idescr is None else idescr + " "))
    return l
564008
def _avoid_duplicate_arrays(types):
    
    arrays = [t for t in types if isinstance(t, dict) and t["type"] == "array"]
    others = [t for t in types if not (isinstance(t, dict) and t["type"] == "array")]
    if arrays:
        items = set([])
        for t in arrays:
            if isinstance(t["items"], (list, tuple)):
                items |= set(t["items"])
            else:
                items.add(t["items"])
        if len(items) == 1:
            items = items.pop()
        else:
            items = sorted(list(items))
        arrays = [{"type": "array", "items": items}]
    return others + arrays
148270
def n_elements(self):
        
        if self.is_array:
            return functools.reduce(operator.mul, self.array_dimensions)
        else:
            return 1
322616
def itemgetters(*args):
    

    f = itemgetter(*args)

    def inner(l):
        return [f(x) for x in l]

    return inner
1253608
def unwrap_arrays(l):
    
    # keep processing until all nesting is removed
    process = True
    # fail safe: cap the loops at 20, so we don't run into an error and loop infinitely.
    # if it takes more than 20 loops then there is a problem with the data given.
    loops = 25
    while process and loops > 0:
        try:
            # new "flat" list
            l2 = []
            for k in l:
                # all items in this list are numeric, so this list is done. append to main list
                if all(isinstance(i, float) or isinstance(i, int) for i in k):
                    l2.append(k)
                # this list has more nested lists inside. append each individual nested list to the main one.
                elif all(isinstance(i, list) or isinstance(i, np.ndarray) for i in k):
                    for i in k:
                        l2.append(i)
        except Exception:
            print("something went wrong during process")
        # verify the main list
        try:
            # if every list has a numeric at index 0, then there is no more nesting and we can stop processing
            if all(isinstance(i[0], (int, str, float)) for i in l2):
                process = False
            else:
                l = l2
        except IndexError:
            # there's no index 0, so there must be mixed data types or empty data somewhere.
            print("something went wrong during verify")
        loops -= 1
    return l2