Flattens a list.

    Example:

    >>> flatten([a,b,[c,d,[e,f]]])
    [a,b,c,d,e,f]
189075
def flatten(L):
    
    if not isinstance(L, list):
        return [L]

    if L == []:
        return L

    return flatten(L[0]) + flatten(L[1:])
1066114
def flatten_list(x: List[Any]) -> List[Any]:
      # noqa
    return [item for sublist in x for item in sublist]
1228821
def _flatten(cls, arr) -> List[float]:
        
        if isinstance(arr, cls.SCALAR_ACTION_TYPES):
            arr = [float(arr)]
        if isinstance(arr, np.ndarray):
            arr = arr.tolist()
        if len(arr) == 0:
            return arr
        if isinstance(arr[0], np.ndarray):
            arr = [item for sublist in arr for item in sublist.tolist()]
        if isinstance(arr[0], list):
            arr = [item for sublist in arr for item in sublist]
        arr = [float(x) for x in arr]
        return arr
1368742
def flatten(nested, containers=(list, tuple)):
    
    for item in nested:
        if hasattr(item, "next") or isinstance(item, containers):
            for subitem in flatten(item):
                yield subitem
        else:
            yield item
77291
def flatten(sequence, levels = 1):
	
	if levels == 0:
		for x in sequence:
			yield x
	else:
		for x in sequence:
			for y in flatten(x, levels - 1):
				yield y
391927
def flatten(input_list):
    
    for el in input_list:
        if isinstance(el, collections.Iterable) \
                and not isinstance(el, basestring):
            for sub in flatten(el):
                yield sub
        else:
            yield el
724532
def flatten(items):
    
    for x in items:
        if isinstance(x, Iterable):
            yield from flatten(x)
        else:
            yield x
1282637
def flatten(d, parent_key='', sep='__'):
    
    # http://stackoverflow.com/questions/6027558/flatten-nested-python-dictionaries-compressing-keys
    if type(d) == list:
        flat = []
        for entry in d:
            flat.append(flatten(entry, parent_key=parent_key, sep=sep))
        return flat
    else:
        items = []
        for k, v in d.items():
            new_key = parent_key + sep + k if parent_key else k

            if isinstance(v, collectionsAbc.MutableMapping):
                items.extend(flatten(v, new_key, sep=sep).items())
            else:
                items.append((new_key, v))


        return dict(items)
1147952
def flatten(self, lst):
        """"""
        if lst == []:
            return lst
        if isinstance(lst[0], list):
            return self.flatten(lst[0]) + self.flatten(lst[1:])
        return lst[:1] + self.flatten(lst[1:])
1200469
def flatten (d, *keys):
    
    flat = { }

    for k in keys:
        flat = merge(flat, d.pop(k, { }))

    return flat
527485
def flatten(l: Iterable) -> List:
    
    rval = []
    for e in l:
        if not isinstance(e, str) and isinstance(e, Iterable):
            if len(list(e)):
                rval += flatten(e)
        else:
            rval.append(e)
    return rval
198316
def _flatten_dicts(self, dicts):
        
        d = dict()
        list_of_dicts = [d.get() for d in dicts or []]
        return {k: v for d in list_of_dicts for k, v in d.items()}
1315612
def flatten_list(node):
    
    flat_elems = []
    for elem in node:
        if elem == 'expr1024':
            for subelem in elem:
                assert subelem == 'expr32'
                for subsubelem in subelem:
                    flat_elems.append(subsubelem)
        elif elem == 'expr32':
            for subelem in elem:
                assert subelem == 'expr'
                flat_elems.append(subelem)
        else:
            flat_elems.append(elem)
            pass
        pass
    return flat_elems
894167
def flatten_list(lobj):
    
    ret = []
    for item in lobj:
        if isinstance(item, list):
            for sub_item in flatten_list(item):
                ret.append(sub_item)
        else:
            ret.append(item)
    return ret
330162
function flatten(a) {
  return a.reduce(function(flat, val) {
    if (val && typeof val.flatten === 'function') {
      flat = flat.concat(val.flatten());
    }
    else if (Array.isArray(val)) {
      flat = flat.concat(flatten(val));
    }
    else {
      flat.push(val);
    }
    return flat;
  });
}
1284105
def flatten(list_of_lists):
    """"""
    flat_list = []
    for sublist in list_of_lists:
        if isinstance(sublist, string_types) or isinstance(sublist, int):
            flat_list.append(sublist)
        elif sublist is None:
            continue
        elif not isinstance(sublist, string_types) and len(sublist) == 1:
            flat_list.append(sublist[0])
        else:
            flat_list.append(tuple(sublist))
    return flat_list
1195034
def flatten(iterable, check=is_iterable):
    
    for value in iterable:
        if check(value):
            for flat in flatten(value, check):
                yield flat
        else:
            yield value