mehrlist


Namemehrlist JSON
Version 0.10 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/mehrlist
SummarySubclass of list with more than 100 useful methods - pure Python
upload_time2023-07-12 01:02:54
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords nested list
VCS
bugtrack_url
requirements bisectsearch catmapper flatten_any_dict_iterable_or_whatsoever flatten_everything intersection_grouper isiter levelflatten list2tree nested2nested screwhashesset tolerant_isinstance
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# Subclass of list with more than 100 useful methods - pure Python 
 
## pip install mehrlist

### All dependencies are pure Python


 ```python
 |  append(self, o)
 |      Append object to the end of the list.
 |  
 |  appendleft(self, v)
 |  
 |  bisect_category_mapping(self, cats)
 |  
 |  bisect_leftmost_value_equal_to(self, n)
 |  
 |  bisect_leftmost_value_greater_than(self, n)
 |  
 |  bisect_leftmost_value_greater_than_or_equal(self, n)
 |  
 |  bisect_rightmost_value_equal_to(self, n)
 |  
 |  bisect_rightmost_value_less_than(self, n)
 |  
 |  bisect_rightmost_value_less_than_or_equal(self, n)
 |  
 |  convert_all_to_nested_list(self)
 |  
 |  convert_to_list(self)
 |  
 |  count_all_items(self)
 |  
 |  del_items(self, value)
 |  
 |  extend(self, other) -> None
 |      Extend list by appending elements from the iterable.
 |  
 |  extendleft(self, other)
 |  
 |  find_common_start_string(self)
 |  
 |  find_sequence(self, seq: tuple, distance_tolerance=0)
 |  
 |  flatten(self)
 |  
 |  flatten_and_group_by(self, func, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  flatten_level(self, n=None, dict_treatment='items', consider_non_iter=(<class 'str'>, <class 'bytes'>))
 |  
 |  flatten_with_index(self)
 |  
 |  get_cycle_list_until_every_list_fits(self, maxresults=5, append=False)
 |  
 |  get_iter_2_cycle_second_until_first_done(self, other)
 |  
 |  get_iter_add_one_item_each_iteration(self)
 |  
 |  get_iter_add_one_item_each_iteration_reverse(self)
 |  
 |  get_iter_batch(self, n)
 |  
 |  get_iter_call_function_over_and_over_with_new_value(self, f)
 |      https://github.com/joelgrus/stupid-itertools-tricks-pydata/blob/master/src/stupid_tricks.py
 |  
 |  get_iter_cycle_shortest(self, other)
 |  
 |  get_iter_enumerated_unpacked(self)
 |  
 |  get_iter_every_nth_element(self, step=2)
 |  
 |  get_iter_find_same_beginning_elements(self)
 |  
 |  get_iter_find_same_ending_elements(self)
 |  
 |  get_iter_item_difference(self)
 |  
 |  get_iter_list_ljust_rjust(self, ljust=0, ljustchr=' ', rjust=0, rjustchr=' ', getmax=True)
 |  
 |  get_iter_log_split(self)
 |  
 |  get_iter_nested(self)
 |  
 |  get_iter_nested_for_loop(self)
 |  
 |  get_iter_nested_for_loop_enumerated(self)
 |  
 |  get_iter_nested_one_ahead(self)
 |  
 |  get_iter_nested_with_path(self)
 |  
 |  get_iter_random_values_from_iter_endless(self)
 |  
 |  get_iter_reverse_lists_of_list(self)
 |  
 |  get_iter_rotate_left(self, n, onlyfinal=False)
 |  
 |  get_iter_rotate_right(self, n, onlyfinal=False)
 |  
 |  get_iter_stop_when_next_item_is_duplicate(self)
 |      https://github.com/joelgrus/stupid-itertools-tricks-pydata/blob/master/src/stupid_tricks.py
 |  
 |  get_iter_transposed_list_of_lists(self)
 |  
 |  get_iter_windowed(self, n)
 |  
 |  get_iter_windowed_distance(self, fillvalue=None, distance=1)
 |  
 |  get_levenshtein_distance(self, strings)
 |  
 |  get_normalized_list_of_lists(self, fillv=None)
 |  
 |  get_random_not_repeating_values(self, howmany)
 |  
 |  get_random_values_with_max_rep(self, howmany, maxrep)
 |  
 |  get_shuffle_copied_list(self)
 |  
 |  group_by(self, func, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  group_coordinates_by_distance(self, coordlist, limit_x, limit_y, continue_on_exceptions=True)
 |  
 |  group_intersections(self, keep_duplicates=False)
 |  
 |  group_sequences(self, fu)
 |  
 |  group_values_in_flattened_nested_iter_and_count(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_almost_equal(self, value, equallimit, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_bigger_than(self, number, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_bigger_than_or_equal(self, number, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_can_be_divided_by(self, div, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_ceil(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_coords_almost_equal(self, x_coord, y_coord, limit_x, limit_y, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_decoding_result(self, mode='strict', continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_division_remainder(self, div, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_divisor(self, div, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_element_pos(self, pos, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_endswith(self, n, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_equal(self, number, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_euclid_dist(self, coord, mindistance=0, maxdistance=500, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_even_odd(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_file_extension(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_files_folder_link(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_first_item(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_first_occurrence_in_string(self, char, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_floor(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_frequency(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_is_integer(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_isalnum(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_isalpha(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_isascii(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_isdecimal(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_isdigit(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_isidentifier(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_isin(self, value, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_isiter(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_islower(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_isna(self, emptyiters: bool = False, nastrings: bool = False, emptystrings: bool = False, emptybytes: bool = False, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_isnumeric(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_isprintable(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_isspace(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_istitle(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_isupper(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_last_occurrence_in_string(self, char, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_less_than(self, number, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_less_than_or_equal(self, number, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_literal_eval_type(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_percentage(self, percent_true, group1=True, group2=False, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_regular_expression_matches(self, regexpressions, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_round(self, n, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_startswith(self, n, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_string_length(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_substring(self, substrings, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_sum(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_sys_size(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_type(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_valid_url(self, continue_on_exceptions=True, withindex=False, withvalue=True)
 |  
 |  groupby_words_in_texts(self, wordlist, case_sen=False, continue_on_exceptions=True, withindex=False, boundary_right=True, boundary_left=True, withvalue=True)
 |  
 |  index_all(self, n)
 |  
 |  insert(self, index, value) -> None
 |      Insert object before index.
 |  
 |  list_of_tuples_to_family_tree(self, main_mapping_keys=(), bi_rl_lr='bi')
 |  
 |  number_of_combinations(self, k)
 |      from https://stackoverflow.com/a/48612518/15096247
 |      Number of combinations of length *k* of the elements of *it*.
 |  
 |  popleft(self)
 |  
 |  remove_duplicates(self)
 |  
 |  repeat_items(self, reps)
 |  
 |  reshape(self, how)
 |  
 |  search(self, value)
 |  
 |  shape_repeat(self, shape)
 |  
 |  sorted(self, func, reverse=False)
 |  
 |  split_by_indices(self, indices)
 |  
 |  to_nested_dict(self)
 
 
import math
import random
import sys

from mehrlist import NestedList

li = NestedList(
    [
        [[1, 2], [3, 4]],
        [[1, 2], [3, 4]],
        [[1, 2], [3, 4]],
        [[1, 2], [3, 4]],
        [[1, 2], [3, 4]],
        [[1, 2], [3, 4]],
        [[1, 2], [3, 4]],
        [[1, 2], [3, 4]],
        [[1, 2], [3, 4]],
        [[1, 2], [3, 4]],
        [[1, 2], [3, 4]],
        [[1, 2], [3, 4]],
    ],
    maxsize=30,
)
li.convert_all_to_nested_list()
li.to_nested_dict()
#
# Out[3]:
# {0: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}},
#  1: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}},
#  2: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}},
#  3: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}},
#  4: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}},
#  5: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}},
#  6: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}},
#  7: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}},
#  8: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}},
#  9: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}},
#  10: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}},
#  11: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}}}
li.flatten()
# Out[4]: [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]
li.flatten_with_index()
# Out[5]:
# [((0, 0, 0), 1), ((0, 0, 1), 2), ((0, 1, 0), 3), ((0, 1, 1), 4), ((1, 0, 0), 1), ((1, 0, 1), 2), ((1, 1, 0), 3), ((1, 1, 1), 4), ((2, 0, 0), 1), ((2, 0, 1), 2),
# ((2, 1, 0), 3), ((2, 1, 1), 4), ((3, 0, 0), 1), ((3, 0, 1), 2), ((3, 1, 0), 3), ((3, 1, 1), 4), ((4, 0, 0), 1), ((4, 0, 1), 2), ((4, 1, 0), 3), ((4, 1, 1), 4),
# ((5, 0, 0), 1), ((5, 0, 1), 2), ((5, 1, 0), 3), ((5, 1, 1), 4), ((6, 0, 0), 1), ((6, 0, 1), 2), ((6, 1, 0), 3), ((6, 1, 1), 4), ((7, 0, 0), 1), ((7, 0, 1), 2),
# ((7, 1, 0), 3), ((7, 1, 1), 4), ((8, 0, 0), 1), ((8, 0, 1), 2), ((8, 1, 0), 3), ((8, 1, 1), 4), ((9, 0, 0), 1), ((9, 0, 1), 2), ((9, 1, 0), 3), ((9, 1, 1), 4),
# ((10, 0, 0), 1), ((10, 0, 1), 2), ((10, 1, 0), 3), ((10, 1, 1), 4), ((11, 0, 0), 1), ((11, 0, 1), 2), ((11, 1, 0), 3), ((11, 1, 1), 4)]
li.remove_duplicates()
# Out[6]: [[[1, 2], [3, 4]]]
li.sorted(len)
# Out[7]:
# [[[1, 2], [3, 4]], [[1, 2], [3, 4]], [[1, 2], [3, 4]], [[1, 2], [3, 4]], [[1, 2], [3, 4]], [[1, 2], [3, 4]], [[1, 2], [3, 4]], [[1, 2], [3, 4]], [[1, 2], [3,
# 4]], [[1, 2], [3, 4]], [[1, 2], [3, 4]], [[1, 2], [3, 4]]]
try:
    n = NestedList(1)
except TypeError:
    n = NestedList(1, convert_all=True)
print(n)
l = NestedList(range(50))
l.split_by_indices([2, 24, 48])
# [[0, 1], [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23], [24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
# 41, 42, 43, 44, 45, 46, 47], [48, 49]]
list(l.get_iter_every_nth_element(9))
# Out[8]: [0, 9, 18, 27, 36, 45]
l.repeat_items(5)
# [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, ...]
list(l.get_iter_windowed(n=4))
# Out[12]:
# [(0, 1, 2, 3),
#  (1, 2, 3, 4),
#  (2, 3, 4, 5),
#  (3, 4, 5, 6),
list(l.get_iter_batch(3))
# Out[14]:
# [[0, 1, 2],
#  [3, 4, 5],
#  [6, 7, 8],
#  [9, 10, 11],

list(li.get_iter_nested_for_loop())[:2]
# Out[19]:
# [([1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2]),
#  ([1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [3, 4])]


list(li.get_iter_nested_for_loop_enumerated())[:2]
# Out[20]:
# [(0,
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2]),
#  (1,
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [1, 2],
#   [3, 4])]

list(l.get_iter_add_one_item_each_iteration())[:5]
# Out[22]: [[0], [0, 1], [0, 1, 2], [0, 1, 2, 3], [0, 1, 2, 3, 4]]


list(l.get_iter_add_one_item_each_iteration_reverse())[:5]
# Out[23]: [[49], [48, 49], [47, 48, 49], [46, 47, 48, 49], [45, 46, 47, 48, 49]]

l2 = NestedList(
    [
        [1, 2, 3],
        [4, 5, 6],
        [7, 8, 9],
        [10, 11, 12],
        [13, 14, 15],
        [16, 17, 18],
        [19, 20, 21],
    ]
)
l3 = NestedList(
    [
        [[1, 2, 3], [4, 5, 6]],
        [[7, 8, 9], [10, 11, 12]],
        [[13, 14, 15], [16, 17, 18], [19, 20, 21]],
    ]
)

list(l3.get_iter_nested())
# Out[3]:
# [[[[1, 2, 3], [4, 5, 6]], [1, 2, 3], 1],
#  [[[1, 2, 3], [4, 5, 6]], [1, 2, 3], 2],
#  [[[1, 2, 3], [4, 5, 6]], [1, 2, 3], 3],
#  [[[1, 2, 3], [4, 5, 6]], [4, 5, 6], 4],
#  [[[1, 2, 3], [4, 5, 6]], [4, 5, 6], 5],
#  [[[1, 2, 3], [4, 5, 6]], [4, 5, 6], 6],
#  [[[7, 8, 9], [10, 11, 12]], [7, 8, 9], 7],
#  [[[7, 8, 9], [10, 11, 12]], [7, 8, 9], 8],
#  [[[7, 8, 9], [10, 11, 12]], [7, 8, 9], 9],
#  [[[7, 8, 9], [10, 11, 12]], [10, 11, 12], 10],
#  [[[7, 8, 9], [10, 11, 12]], [10, 11, 12], 11],
#  [[[7, 8, 9], [10, 11, 12]], [10, 11, 12], 12],
#  [[[13, 14, 15], [16, 17, 18], [19, 20, 21]], [13, 14, 15], 13],
#  [[[13, 14, 15], [16, 17, 18], [19, 20, 21]], [13, 14, 15], 14],
#  [[[13, 14, 15], [16, 17, 18], [19, 20, 21]], [13, 14, 15], 15],
#  [[[13, 14, 15], [16, 17, 18], [19, 20, 21]], [16, 17, 18], 16],
#  [[[13, 14, 15], [16, 17, 18], [19, 20, 21]], [16, 17, 18], 17],
#  [[[13, 14, 15], [16, 17, 18], [19, 20, 21]], [16, 17, 18], 18],
#  [[[13, 14, 15], [16, 17, 18], [19, 20, 21]], [19, 20, 21], 19],
#  [[[13, 14, 15], [16, 17, 18], [19, 20, 21]], [19, 20, 21], 20],
#  [[[13, 14, 15], [16, 17, 18], [19, 20, 21]], [19, 20, 21], 21]]

list(l3.get_iter_nested_with_path())
# Out[3]:
# [[((0,), [[1, 2, 3], [4, 5, 6]]), ((0, 0), [1, 2, 3]), ((0, 0, 0), 1)],
#  [((0,), [[1, 2, 3], [4, 5, 6]]), ((0, 0), [1, 2, 3]), ((0, 0, 1), 2)],
#  [((0,), [[1, 2, 3], [4, 5, 6]]), ((0, 0), [1, 2, 3]), ((0, 0, 2), 3)],
#  [((0,), [[1, 2, 3], [4, 5, 6]]), ((0, 1), [4, 5, 6]), ((0, 1, 0), 4)],

l4 = NestedList([[1, 2, 3, 4], [5, 1, 2, 3, 4], [55, 55, 1, 2, 3, 4]])
list(l4.get_iter_find_same_ending_elements())
# Out[4]: [1, 2, 3, 4]
l5 = NestedList(["ababa", "abacxxx", "abdd"])
list(l5.get_iter_find_same_beginning_elements())
# ['a', 'b']


l.reshape([20, [25], {1}, ((1,), 3)])
# Out[11]:
# [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
# 42, 43, 44], {45}, ((46,), 47, 48, 49)]


list(l4.get_iter_rotate_left(3))
# Out[14]:
# [['abacxxx', 'abdd', 'ababa'],
#  ['abdd', 'ababa', 'abacxxx'],
#  ['ababa', 'abacxxx', 'abdd']]

list(l4.get_iter_rotate_right(3))
# Out[15]:
# [['abdd', 'ababa', 'abacxxx'],
#  ['abacxxx', 'abdd', 'ababa'],
#  ['ababa', 'abacxxx', 'abdd']]


l4.shape_repeat((3, 4))

# Out[17]:
# [[['ababa', 'abacxxx', 'abdd'], ['ababa', 'abacxxx', 'abdd'], ['ababa', 'abacxxx', 'abdd']], [['ababa', 'abacxxx', 'abdd'], ['ababa', 'abacxxx', 'abdd'],
# ['ababa', 'abacxxx', 'abdd']], [['ababa', 'abacxxx', 'abdd'], ['ababa', 'abacxxx', 'abdd'], ['ababa', 'abacxxx', 'abdd']], [['ababa', 'abacxxx', 'abdd'],
# ['ababa', 'abacxxx', 'abdd'], ['ababa', 'abacxxx', 'abdd']]]


list(l2.get_iter_enumerated_unpacked())
# Out[19]:
# [(0, 1, 4, 7, 10, 13, 16, 19),
#  (1, 2, 5, 8, 11, 14, 17, 20),
#  (2, 3, 6, 9, 12, 15, 18, 21)]


list(l2.get_iter_cycle_shortest(range(10)))
# Out[21]:
# [([1, 2, 3], 0),
#  ([4, 5, 6], 1),
#  ([7, 8, 9], 2),
#  ([10, 11, 12], 3),
#  ([13, 14, 15], 4),
#  ([16, 17, 18], 5),
#  ([19, 20, 21], 6),
#  ([1, 2, 3], 7),
#  ([4, 5, 6], 8),
#  ([7, 8, 9], 9)]

list(l2.get_iter_reverse_lists_of_list())
# Out[3]:
# [[3, 2, 1],
#  [6, 5, 4],
#  [9, 8, 7],
#  [12, 11, 10],
#  [15, 14, 13],
#  [18, 17, 16],
#  [21, 20, 19]]

l6 = NestedList([1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 0])
list(l6.get_iter_stop_when_next_item_is_duplicate())
# Out[4]: [1, 2, 3, 4, 5, 6, 7, 8]


list(l4.get_iter_nested_one_ahead())
# Out[8]:
# [[[[1, 2, 3, 4], 1], [[1, 2, 3, 4], 2]],
#  [[[1, 2, 3, 4], 2], [[1, 2, 3, 4], 3]],
#  [[[1, 2, 3, 4], 3], [[1, 2, 3, 4], 4]],
#  [[[1, 2, 3, 4], 4], [[5, 1, 2, 3, 4], 5]],
#  [[[5, 1, 2, 3, 4], 5], [[5, 1, 2, 3, 4], 1]],
#  [[[5, 1, 2, 3, 4], 1], [[5, 1, 2, 3, 4], 2]],
#  [[[5, 1, 2, 3, 4], 2], [[5, 1, 2, 3, 4], 3]],
#  [[[5, 1, 2, 3, 4], 3], [[5, 1, 2, 3, 4], 4]],
#  [[[5, 1, 2, 3, 4], 4], [[55, 55, 1, 2, 3, 4], 55]],
#  [[[55, 55, 1, 2, 3, 4], 55], [[55, 55, 1, 2, 3, 4], 55]],
#  [[[55, 55, 1, 2, 3, 4], 55], [[55, 55, 1, 2, 3, 4], 1]],
#  [[[55, 55, 1, 2, 3, 4], 1], [[55, 55, 1, 2, 3, 4], 2]],
#  [[[55, 55, 1, 2, 3, 4], 2], [[55, 55, 1, 2, 3, 4], 3]],
#  [[[55, 55, 1, 2, 3, 4], 3], [[55, 55, 1, 2, 3, 4], 4]]]


l // 3
# Out[3]:
# [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
#  [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31],
#  [32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]]

for ini, v in enumerate(l.get_iter_random_values_from_iter_endless()):
    print(v)
    if ini == 5:
        break
# 36
# 34
# 15
# 23
# 17
# 32

l9 = NestedList(["abab", "cbcv", "banana", "bbb"])
l9.groupby_element_pos(1)
# Out[9]: {'b': ['abab', 'cbcv', 'bbb'], 'a': ['banana']}


l10 = NestedList(["aaabbb", "ccbbbb", "ab", "zcvcb", "abbab"])
l10.groupby_substring("abbb")
# Out[7]: {'abbb': ['aaabbb'], '': ['ccbbbb', 'zcvcb'], 'ab': ['ab'], 'abb': ['abbab']}

l11 = NestedList(
    [
        ["abab", "bac"],
        ["abab", "bac"],
        ["abab", "bac"],
        1,
        2,
        34,
        {43: 33},
        {43: 33},
    ]
)
l11.count_all_items()
# Out[11]: [(['abab', 'bac'], 3), (1, 1), (2, 1), (34, 1), ({43: 33}, 2)]


l12 = NestedList(["anton", "annabell", "anschalten"])
l12.find_common_start_string()
# Out[12]: 'an'


list(l.get_iter_item_difference())
# [1,
#  1,
#  1,
#  1,
#  1...

l2.index_all([4, 5, 6])
# Out[3]: [1]
l2.index_all([1, 2, 3])
# Out[4]: [0]

l13 = NestedList([1, 1, 2, 34, 4, 1, 1, 2, 34, 4, 1, 1])
l13.index_all(1)
# Out[6]: [0, 1, 5, 6, 10, 11]


l2.popleft()
# Out[5]: [1, 2, 3]
l2
# Out[6]: [[4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15], [16, 17, 18], [19, 20, 21]]


l2.appendleft(10)
l2
# Out[5]: [10, [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15], [16, 17, 18], [19, 20, 21]]


seq = (0, 1), (1, 1), (1, 0)
l13 = NestedList(
    [(random.randrange(0, 2), random.randrange(0, 2)) for _ in range(3000)]
)
for xz in l13.find_sequence(seq):
    print(xz)

l13.del_items((0, 0))

l.get_random_values_with_max_rep(10, 2)
# Out[4]: [29, 14, 47, 35, 11, 16, 26, 42, 40, 7]


l.get_random_not_repeating_values(10)
# Out[5]: [33, 37, 20, 14, 47, 17, 44, 2, 46, 32]


for key, item in (
    NestedList([[1, 2, 3, 4], [2, 3, 6]])
    .get_cycle_list_until_every_list_fits(
        maxresults=4,
        append=True,
    )
    .items()
):
    print(key, item)
# 12 defaultdict(<class 'list'>, {0: [[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]], 1: [[2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6]]})
# 24 defaultdict(<class 'list'>, {0: [[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]], 1: [[2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6]]})
# 36 defaultdict(<class 'list'>, {0: [[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]], 1: [[2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6]]})
# 48 defaultdict(<class 'list'>, {0: [[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]], 1: [[2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6]]})

l2.group_by(lambda x: isinstance(x, int))
# Out[6]:
# {True: [10],
#  False: [[4, 5, 6],
#   [7, 8, 9],
#   [10, 11, 12],
#   [13, 14, 15],
#   [16, 17, 18],
#   [19, 20, 21]]}


l.number_of_combinations(4)
# Out[10]: 230300


l3.flatten_and_group_by(lambda x: x > 10)
# Out[13]:
# {False: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
#  True: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]}

l3.get_normalized_list_of_lists()
# Out[3]:
# [[[1, 2, 3], [4, 5, 6], None],
#  [[7, 8, 9], [10, 11, 12], None],
#  [[13, 14, 15], [16, 17, 18], [19, 20, 21]]]

list(l2[1:].get_iter_transposed_list_of_lists())
# Out[3]: [[4, 7, 10, 13, 16, 19], [5, 8, 11, 14, 17, 20], [6, 9, 12, 15, 18, 21]]


shu = l2.get_shuffle_copied_list()
print(shu)

for i, q in enumerate(
    l.get_iter_call_function_over_and_over_with_new_value(lambda x: [y * 2 for y in x])
):
    if i == 3:
        break
    print(q)
# [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
# 42, 43, 44, 45, 46, 47, 48, 49]
# [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98]
# [0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 148, 152, 156, 160, 164, 168, 172, 176, 180, 184, 188, 192, 196]


list(l[:10].get_iter_windowed_distance(fillvalue=None, distance=3))
# Out[9]:
# [(None, 0, 3),
#  (None, 1, 4),
#  (None, 2, 5),
#  (0, 3, 6),
#  (1, 4, 7),
#  (2, 5, 8),
#  (3, 6, 9),
#  (4, 7, None),
#  (5, 8, None),
#  (6, 9, None)]

list(l[:10].get_iter_2_cycle_second_until_first_done(range(3)))
# Out[11]:
# [(0, 0),
#  (1, 1),
#  (2, 2),
#  (3, 0),
#  (4, 1),
#  (5, 2),
#  (6, 0),
#  (7, 1),
#  (8, 2),
#  (9, 0)]


NestedList(
    [
        ("Maria", "Anna"),
        ("Anna", "Joao"),
        ("Kasimir", "Maria"),
        ("Hans", "Fritz"),
        ("Fritz", "Anna"),
        ("Günther", "Wolfgang"),
        ("Joao", "Wolfgang"),
    ]
).list_of_tuples_to_family_tree(main_mapping_keys=("Wolfgang",), bi_rl_lr="rl")

# ([(1, ('Wolfgang', 'Günther')),
#   (2, ('Wolfgang', 'Joao', 'Anna', 'Maria', 'Kasimir')),
#   (3, ('Wolfgang', 'Joao', 'Anna', 'Fritz', 'Hans'))],
#  {'Wolfgang': {'Günther': 1,
#    'Joao': {'Anna': {'Maria': {'Kasimir': 2}, 'Fritz': {'Hans': 3}}}}})


NestedList(["ababa", "bubax", "ali bbaba"]).get_levenshtein_distance("ali baba")
# Out[3]: [[(1, 2, 'ali bbaba', 'ali baba'), (3, 0, 'ababa', 'ali baba'), (6, 1, 'bubax', 'ali baba')]]


NestedList(
    [
        [[("Maria", "Anna"), ("Anna", "Joao")]],
        {("Kasimir", "Maria"), ("Hans", "Fritz")},
        ("Fritz", "Anna"),
        {"Günther": "Wolfgang"},
        ("Joao", "Wolfgang"),
    ]
).flatten_level(n=None, dict_treatment="items", consider_non_iter=(str, bytes, dict))
# Out[5]:
# ['Maria',
#  'Anna',
#  'Anna',
#  'Joao',
#  'Kasimir',
#  'Maria',
#  'Hans',
#  'Fritz',
#  'Fritz',
#  'Anna',
#  {'Günther': 'Wolfgang'},
#  'Joao',
#  'Wolfgang']

print(l.group_sequences(fu=lambda a, b: b > a)[0])
p = NestedList(["a", "aa", "b", "bbb", "c", "d", "dd", "ddd", "vbvdddd"])

print(p.group_sequences(fu=lambda a, b: a in b))
# [['a', 'aa'], ['b', 'bbb'], ['c'], ['d', 'dd', 'ddd', 'vbvdddd']]

k = NestedList([random.randint(0, 5) for x in range(20)])
print(k.group_sequences(lambda a, b: b >= a))
# [3, 1, 3, 5, 3, 4, 4, 3, 4, 3, 4, 4, 5, 1, 3, 2, 3, 1, 1, 3]
# [[3], [1, 3, 5], [3, 4, 4], [3, 4], [3, 4, 4, 5], [1, 3], [2, 3], [1, 1, 3]]


o = NestedList(
    [(1, 2), (3, 4), (501, 641), (300, 4500), (1, 4344)]
).groupby_euclid_dist(
    coord=(0, 0),
    mindistance=0,
    maxdistance=500,
)
# Out[6]: {True: [(1, 2), (3, 4)], False: [(501, 641), (300, 4500), (1, 4344)]}


NestedList(["a", "bbb", "b", "ddd", "444444"]).groupby_string_length()
# Out[3]: {1: ['a', 'b'], 3: ['bbb', 'ddd'], 6: ['444444']}


NestedList(
    ["a", "bbb", "b", "ddd", "444444", [1, [1, 1, 1, 1, 1, 1, [1]]]]
).group_values_in_flattened_nested_iter_and_count()
# Out[4]: {'a': 1, 'bbb': 1, 'b': 1, 'ddd': 1, '444444': 1, 1: 8}


NestedList(
    ["a", "bbb", "b", "ddd", "444444", [1, [1, 1, 1, 1, 1, 1, [1]]]]
).groupby_type()
# Out[5]: {str: ['a', 'bbb', 'b', 'ddd', '444444'], list: [[1, [1, 1, 1, 1, 1, 1, [1]]]]}


NestedList(
    ["a", "bbb", "b", "ddd", "444444", "a", "a", "ddd", [1, [1, 1, 1, 1, 1, 1, [1]]]]
).groupby_frequency()
# Out[6]:
# {3: ['a', 'a', 'a'],
#  1: ['bbb', 'b', '444444', [1, [1, 1, 1, 1, 1, 1, [1]]]],
#  2: ['ddd', 'ddd']}

NestedList(
    [
        4,
        2,
        2,
        2344,
        444,
        222,
        7,
        7,
        8,
        9,
        0,
        7,
        65,
        45,
    ]
).groupby_can_be_divided_by(2)
# Out[7]: {True: [4, 2, 2, 2344, 444, 222, 8, 0], False: [7, 7, 9, 7, 65, 45]}

NestedList(
    [
        4,
        2,
        2,
        2344,
        444,
        222,
        7,
        7,
        8,
        9,
        0,
        7,
        65,
        45,
    ]
).groupby_division_remainder(2)
# Out[8]: {0: [4, 2, 2, 2344, 444, 222, 8, 0], 1: [7, 7, 9, 7, 65, 45]}

NestedList(
    [
        4,
        2,
        2,
        2344,
        444,
        222,
        7,
        7,
        8,
        9,
        0,
        7,
        65,
        45,
    ]
).groupby_divisor(2)
# Out[9]:
# {2: [4],
#  1: [2, 2],
#  1172: [2344],
#  222: [444],
#  111: [222],
#  3: [7, 7, 7],
#  4: [8, 9],
#  0: [0],
#  32: [65],
#  22: [45]}

NestedList(
    [
        4,
        2,
        2,
        2344,
        444,
        222,
        7,
        7,
        8,
        9,
        0,
        7,
        65,
        45,
    ]
).groupby_bigger_than_or_equal(100)
# Out[10]: {False: [4, 2, 2, 7, 7, 8, 9, 0, 7, 65, 45], True: [2344, 444, 222]}

NestedList(
    [
        4,
        2,
        2,
        2344,
        444,
        222,
        7,
        7,
        8,
        9,
        0,
        7,
        65,
        45,
    ]
).groupby_less_than_or_equal(100)
# Out[11]: {True: [4, 2, 2, 7, 7, 8, 9, 0, 7, 65, 45], False: [2344, 444, 222]}


NestedList(
    [
        4,
        2,
        2,
        2344,
        444,
        222,
        7,
        7,
        8,
        9,
        0,
        7,
        65,
        45,
    ]
).groupby_bigger_than(100)
# Out[12]: {False: [4, 2, 2, 7, 7, 8, 9, 0, 7, 65, 45], True: [2344, 444, 222]}
NestedList(
    [
        4,
        2,
        2,
        2344,
        444,
        222,
        7,
        7,
        8,
        9,
        0,
        7,
        65,
        45,
    ]
).groupby_less_than(100)
# Out[13]: {True: [4, 2, 2, 7, 7, 8, 9, 0, 7, 65, 45], False: [2344, 444, 222]}

NestedList(
    [
        4,
        2,
        2,
        2344,
        444,
        222,
        7,
        7,
        8,
        9,
        0,
        7,
        65,
        45,
    ]
).groupby_equal(7)
# Out[14]: {False: [4, 2, 2, 2344, 444, 222, 8, 9, 0, 65, 45], True: [7, 7, 7]}

NestedList(
    ["1342423", "ddd", "33333", "ixxx", "00"]
).groupby_regular_expression_matches(r"\d+")
# Out[15]: {True: ['1342423', '33333', '00'], False: ['ddd', 'ixxx']}

NestedList([2.0, 1, 1, 3, 5, 3.0, 3.4, 2.4, 25.3]).groupby_is_integer()
# Out[17]: {True: [2.0, 1, 1, 3, 5, 3.0], False: [3.4, 2.4, 25.3]}

NestedList(
    [1.0, 1.1, 1.2, 1.3, 1.9, 1.8, 2.0, 1, 1, 3, 5, 3.0, 3.4, 2.4, 25.3]
).groupby_floor()
# Out[18]:
# {1: [1.0, 1.1, 1.2, 1.3, 1.9, 1.8, 1, 1],
#  2: [2.0, 2.4],
#  3: [3, 3.0, 3.4],
#  5: [5],
#  25: [25.3]}
NestedList(
    [1.0, 1.1, 1.2, 1.3, 1.9, 1.8, 2.0, 1, 1, 3, 5, 3.0, 3.4, 2.4, 25.3]
).groupby_ceil()
# Out[19]:
# {1: [1.0, 1, 1],
#  2: [1.1, 1.2, 1.3, 1.9, 1.8, 2.0],
#  3: [3, 3.0, 2.4],
#  5: [5],
#  4: [3.4],
#  26: [25.3]}

seq = [
    1.11111111,
    1.111222222,
    1.11113334,
    1.3,
    1.9,
    1.8,
    2.0,
    1,
    1,
    3,
    5,
    3.0,
    3.4,
    2.4,
    25.3,
]
NestedList(seq).groupby_round(n=2)
# Out[21]:
# {1.11: [1.11111111, 1.111222222, 1.11113334],
#  1.3: [1.3],
#  1.9: [1.9],
#  1.8: [1.8],
#  2.0: [2.0],
#  1: [1, 1],
#  3: [3, 3.0],
#  5: [5],
#  3.4: [3.4],
#  2.4: [2.4],
#  25.3: [25.3]}

seq = ["hallo", "boot", "baba", "bdoo", "flaot", "mama"]
NestedList(seq).groupby_endswith(n=1)
# Out[22]: {'o': ['hallo', 'bdoo'], 't': ['boot', 'flaot'], 'a': ['baba', 'mama']}


NestedList(seq).groupby_startswith(n=1)
# Out[23]: {'h': ['hallo', 'hmama'], 'b': ['boot', 'baba', 'bdoo'], 'f': ['flaot']}


NestedList(seq).groupby_first_occurrence_in_string(char="a")
# Out[25]: {1: ['hallo', 'baba'], -1: ['boot', 'bdoo'], 2: ['flaot', 'hmama']}

NestedList(seq).groupby_last_occurrence_in_string(char="a")
# Out[26]: {1: ['hallo'], -1: ['boot', 'bdoo'], 3: ['baba'], 2: ['flaot'], 4: ['hmama']}

NestedList(seq).groupby_isalnum()
# Out[28]: {True: ['One', '222'], False: ['%', '#']}

NestedList(seq).groupby_isalpha()
# Out[29]: {True: ['One'], False: ['%', '#', '222']}

NestedList(seq).groupby_isascii()
# Out[31]: {True: ['One', '%', '#', '222'], False: ['ç', 'ß']}

NestedList(seq).groupby_isdecimal()
# Out[32]: {False: ['One', '%', '#', 'ç', 'ß'], True: ['222']}

seq = """One % # 222 ç ß""".split()
NestedList(seq).groupby_isdigit()
# Out[33]: {False: ['One', '%', '#', 'ç', 'ß'], True: ['222']}

seq = """One % # 222 ç ß True if bool""".split()
NestedList(seq).groupby_isidentifier()
# Out[35]: {True: ['One', 'ç', 'ß', 'True', 'if', 'bool'], False: ['%', '#', '222']}

seq = """One % # 222 ç ß True if bool""".split()
NestedList(seq).groupby_islower()
# Out[37]: {False: ['One', '%', '#', '222', 'True'], True: ['ç', 'ß', 'if', 'bool']}

NestedList(seq).groupby_isnumeric()
# Out[38]: {False: ['One', '%', '#', 'ç', 'ß', 'True', 'if', 'bool'], True: ['222']}

seq = """One % # 222 ç ß True if bool""".split() + ["\r"]
NestedList(seq).groupby_isprintable()
# Out[42]: {True: ['One', '%', '#', '222', 'ç', 'ß', 'True', 'if', 'bool'], False: ['\r']}

NestedList(seq).groupby_isspace()
# Out[43]: {False: ['One', '%', '#', '222', 'ç', 'ß', 'True', 'if', 'bool'], True: ['\r']}

NestedList(seq).groupby_istitle()
# Out[44]: {True: ['One', 'True'], False: ['%', '#', '222', 'ç', 'ß', 'if', 'bool', '\r']}


seq = """One % # 222 ç ß True if bool AA""".split() + ["\r"]
NestedList(seq).groupby_isupper()
# Out[46]:
# {False: ['One', '%', '#', '222', 'ç', 'ß', 'True', 'if', 'bool', '\r'],
#  True: ['AA']}

seq = """One % # 222 ç ß True if bool AA""".split()
NestedList(seq).groupby_isin("e")
# Out[48]: {True: ['One', 'True'], False: ['%', '#', '222', 'ç', 'ß', 'if', 'bool', 'AA']}

seq = [
    (
        g := random.randrange(1, 200),
        f := random.randrange(1, 200),
        g + 100,
        f + 100,
    )
    for _ in range(10)
]


import numpy as np
import pandas as pd

seq = [pd.NA, np.nan, None, math.nan, 3, 54, 3, (22, 34, 412), {323, 31}, [3312, 3]]
NestedList(seq).groupby_isna(
    emptyiters=False,
    nastrings=False,
    emptystrings=False,
    emptybytes=False,
    continue_on_exceptions=True,
    withindex=False,
    withvalue=True,
)
# Out[4]:
# {True: [<NA>, nan, None, nan],
#  False: [3, 54, 3, (22, 34, 412), {31, 323}, [3312, 3]]}


seq = [pd.NA, np.nan, None, math.nan, 3, 54, 3, (22, 34, 412), {323, 31}, [3312, 3]]
NestedList(seq).groupby_isiter()
# Out[5]:
# {False: [<NA>, nan, None, nan, 3, 54, 3],
#  True: [(22, 34, 412), {31, 323}, [3312, 3]]}


import os

NestedList(os.listdir(r"F:\gitrep\screenshots")).groupby_file_extension()


seq = [1, 2, 3, 45, 56, 6, 32, 12]
NestedList(seq).groupby_even_odd()
# Out[7]: {'odd': [1, 3, 45], 'even': [2, 56, 6, 32, 12]}

seq = [
    os.path.join(r"F:\gitrep\screenshots", x)
    for x in os.listdir(r"F:\gitrep\screenshots")
]

NestedList(seq).groupby_files_folder_link()

seq = [
    [
        1,
        2,
        34,
    ],
    (1, 32, 4),
    (2, 3, 4, 54),
    [2, 3, 3],
]
NestedList(seq).groupby_first_item()
# Out[11]: {1: [[1, 2, 34], (1, 32, 4)], 2: [(2, 3, 4, 54), [2, 3, 3]]}


NestedList(
    ["autobahn", "computerproblem", "kind", "opa", "kind opa"]
).groupby_words_in_texts(
    wordlist=["kind", "opa"],
    case_sen=False,
    continue_on_exceptions=True,
    withindex=False,
    boundary_right=True,
    boundary_left=True,
)
# Out[4]:
# {(): ['autobahn', 'computerproblem'],
#  ('kind',): ['kind'],
#  ('opa',): ['opa'],
#  ('kind', 'opa'): ['kind opa']}


seq = [[1, 2, 2], [5], [2, 3], [4, 4, 4], [12, 0], [6, 6], [1, 2]]
NestedList(seq).groupby_sum()
# Out[5]: {5: [[1, 2, 2], [5], [2, 3]], 12: [[4, 4, 4], [12, 0], [6, 6]], 3: [[1, 2]]}

seq = ["https://www.google.com", "google.com/", "bababa", "http://baba.de"]
NestedList(seq).groupby_valid_url()
# Out[6]:
# {'valid': ['https://www.google.com', 'http://baba.de'],
#  'not_valid': ['google.com/', 'bababa']}


seq = ["11", "bb", '"bb"']
NestedList(seq).groupby_literal_eval_type()
# Out[7]:
# {int: ['11'],
#  'EXCEPTION: malformed node or string on line 1: <ast.Name object at 0x000001BE3C6AC0A0>': ['bb'],
#  str: ['"bb"']}


seq = [b"\\U0001D11E", b"baba"]
NestedList(seq).groupby_decoding_result()


seq = 2 * [1, 2, 34, 4, 2, 3, 54, 6, 6, 4, 3, 2, 21, 45, 56]
NestedList(seq).groupby_percentage(percent_true=63.7)
# Out[4]:
# {True: [1, 34, 2, 3, 54, 6, 2, 21, 45, 56, 1, 34, 4, 2, 3, 6, 4, 3, 2, 45, 56],
#  False: [2, 4, 6, 4, 3, 2, 54, 6, 21]}


seq = [11, 200, 34, 4, 52, 63, 54, 65, 67, 48, 3, 2, 21, 55, 56, 59, 61, 60]
NestedList(seq).groupby_almost_equal(value=60, equallimit=3)
# Out[6]:
# {False: [11, 200, 34, 4, 52, 54, 65, 67, 48, 3, 2, 21, 55, 56],
#  True: [63, 59, 61, 60]}

seq = 2 * [(1, 2), (34, 4), (2, 3), (61, 60)]
NestedList(seq).groupby_coords_almost_equal(
    x_coord=4,
    y_coord=3,
    limit_x=5,
    limit_y=1,
)
# Out[7]:
# {(True, True): [(1, 2), (2, 3), (1, 2), (2, 3)],
#  (False, True): [(34, 4), (34, 4)],
#  (False, False): [(61, 60), (61, 60)]}


coordlist = [
    (745, 519),
    (747, 522),
    (747, 517),
    (747, 517),
    (750, 522),
    (756, 449),
    (757, 461),
    (757, 461),
    (757, 438),
    (830, 144),
    (759, 435),
    (759, 435),
    (761, 468),
    (761, 468),
    (764, 521),
    (1079, 199),
    (770, 474),
    (770, 425),
    (773, 516),
    (776, 515),
    (776, 515),
    (778, 520),
    (779, 519),
    (780, 420),
    (780, 420),
    (782, 478),
    (782, 478),
    (1083, 151),
    (1083, 151),
    (1083, 151),
    (1083, 151),
    (784, 478),
    (759, 435),
    (784, 478),
    (819, 137),
    (819, 137),
    (819, 137),
    (797, 524),
    (825, 125),
    (826, 149),
    (800, 446),
    (800, 446),
    (801, 517),
    (801, 517),
    (802, 520),
    (802, 520),
    (804, 519),
    (804, 519),
    (808, 431),
    (808, 431),
    (809, 464),
    (809, 464),
    (812, 438),
    (813, 449),
]
xx = NestedList(coordlist).group_coordinates_by_distance(
    coordlist, limit_x=10, limit_y=10, continue_on_exceptions=True
)
for x in xx:
    print(x)
#
# ((813, 449),)
# ((779, 519), (773, 516), (776, 515), (778, 520), (764, 521))
# ((808, 431), (812, 438))
# ((1083, 151),)
# ((830, 144), (826, 149))
# ((761, 468), (757, 461), (770, 474))
# ((825, 125),)
# ((756, 449),)
# ((745, 519), (747, 517), (750, 522), (747, 522))
# ((780, 420), (770, 425))
# ((784, 478), (782, 478))
# ((804, 519), (802, 520), (797, 524), (801, 517))
# ((757, 438), (759, 435))
# ((819, 137),)
# ((809, 464),)
# ((800, 446),)
# ((1079, 199),)


seq = sorted(list(range(0, 5)) * 3)
print(NestedList(seq).bisect_rightmost_value_equal_to(4))
print(NestedList(seq).bisect_rightmost_value_equal_to(0))
print(NestedList(seq).bisect_rightmost_value_equal_to(1))
print(NestedList(seq).bisect_leftmost_value_equal_to(4))
print(NestedList(seq).bisect_leftmost_value_equal_to(0))
print(NestedList(seq).bisect_leftmost_value_equal_to(1))
print(NestedList(seq).bisect_rightmost_value_less_than(4))
print(NestedList(seq).bisect_rightmost_value_less_than(2))
print(NestedList(seq).bisect_rightmost_value_less_than(1))
print(NestedList(seq).bisect_rightmost_value_less_than_or_equal(40))
print(NestedList(seq).bisect_rightmost_value_less_than_or_equal(0))
print(NestedList(seq).bisect_rightmost_value_less_than_or_equal(1))
print(NestedList(seq).bisect_leftmost_value_greater_than(2))
print(NestedList(seq).bisect_leftmost_value_greater_than(3))
print(NestedList(seq).bisect_leftmost_value_greater_than(0))
print(NestedList(seq).bisect_leftmost_value_greater_than(1))
print(NestedList(seq).bisect_leftmost_value_greater_than_or_equal(3))
print(NestedList(seq).bisect_leftmost_value_greater_than_or_equal(0))
print(NestedList(seq).bisect_leftmost_value_greater_than_or_equal(1))

# 14
# 2
# 5
# 12
# 0
# 3
# 11
# 5
# 2
# 14
# 2
# 5
# 9
# 12
# 3
# 6
# 9
# 0
# 3


cervejas = [
    ("original", 2.5),
    ("Skol", 0.5),
    ("becks", 16),
    ("brahma", 1.4),
    ("heineken", 5.5),
]
cats_ = [
    ("barato", 1.3),
    ("mais ou menos", 2),
    ("caro", 3.1),
    ("muito caro", 6.5),
    ("absurdo", sys.maxsize),
]
NestedList(cervejas).bisect_category_mapping(cats_)
# Out[4]:
# [(('original', 2.5), 'caro'),
#  (('Skol', 0.5), 'barato'),
#  (('becks', 16), 'absurdo'),
#  (('brahma', 1.4), 'mais ou menos'),
#  (('heineken', 5.5), 'muito caro')]


text = """
Read the running tests and linters section of our documentation to learn how to test your code. For cross-browser
""".split() + [
    1,
    2,
    3,
]
list(
    NestedList(text).get_iter_list_ljust_rjust(
        ljust=None,  # if None and getmax is True -> the longest str will be used
        ljustchr="-",  # fill with char
        rjust=None,  # if None and getmax is True -> the longest str will be used
        rjustchr="-",  # fill with char
        getmax=True,
    )
)
# Out[5]:
# ['---------Read',
#  '----------the',
#  '------running',
#  '--------tests',
#  '----------and',
#  '------linters',
#  '------section',
#  '-----------of',
#  '----------our',
#  'documentation',
#  '-----------to',
#  '--------learn',
#  '----------how',
#  '-----------to',
#  '---------test',
#  '---------your',
#  '--------code.',
#  '----------For',
#  'cross-browser',
#  '------------1',
#  '------------2',
#  '------------3']

for li in NestedList((list(range(20)))).get_iter_log_split():
    print(li)

# [0]
# [1, 2]
# [3, 4, 5]
# [6, 7, 8, 9]
# [10, 11, 12, 13, 14]
# [15, 16, 17, 18, 19]

  ```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/mehrlist",
    "name": "mehrlist",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "nested,list",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e3/fd/1f021bccbb848a4d8d4965fb94ede842d4237bd883d90d462e5b8ea38414/mehrlist-0.10.tar.gz",
    "platform": null,
    "description": "\r\n# Subclass of list with more than 100 useful methods - pure Python \r\n \r\n## pip install mehrlist\r\n\r\n### All dependencies are pure Python\r\n\r\n\r\n ```python\r\n |  append(self, o)\r\n |      Append object to the end of the list.\r\n |  \r\n |  appendleft(self, v)\r\n |  \r\n |  bisect_category_mapping(self, cats)\r\n |  \r\n |  bisect_leftmost_value_equal_to(self, n)\r\n |  \r\n |  bisect_leftmost_value_greater_than(self, n)\r\n |  \r\n |  bisect_leftmost_value_greater_than_or_equal(self, n)\r\n |  \r\n |  bisect_rightmost_value_equal_to(self, n)\r\n |  \r\n |  bisect_rightmost_value_less_than(self, n)\r\n |  \r\n |  bisect_rightmost_value_less_than_or_equal(self, n)\r\n |  \r\n |  convert_all_to_nested_list(self)\r\n |  \r\n |  convert_to_list(self)\r\n |  \r\n |  count_all_items(self)\r\n |  \r\n |  del_items(self, value)\r\n |  \r\n |  extend(self, other) -> None\r\n |      Extend list by appending elements from the iterable.\r\n |  \r\n |  extendleft(self, other)\r\n |  \r\n |  find_common_start_string(self)\r\n |  \r\n |  find_sequence(self, seq: tuple, distance_tolerance=0)\r\n |  \r\n |  flatten(self)\r\n |  \r\n |  flatten_and_group_by(self, func, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  flatten_level(self, n=None, dict_treatment='items', consider_non_iter=(<class 'str'>, <class 'bytes'>))\r\n |  \r\n |  flatten_with_index(self)\r\n |  \r\n |  get_cycle_list_until_every_list_fits(self, maxresults=5, append=False)\r\n |  \r\n |  get_iter_2_cycle_second_until_first_done(self, other)\r\n |  \r\n |  get_iter_add_one_item_each_iteration(self)\r\n |  \r\n |  get_iter_add_one_item_each_iteration_reverse(self)\r\n |  \r\n |  get_iter_batch(self, n)\r\n |  \r\n |  get_iter_call_function_over_and_over_with_new_value(self, f)\r\n |      https://github.com/joelgrus/stupid-itertools-tricks-pydata/blob/master/src/stupid_tricks.py\r\n |  \r\n |  get_iter_cycle_shortest(self, other)\r\n |  \r\n |  get_iter_enumerated_unpacked(self)\r\n |  \r\n |  get_iter_every_nth_element(self, step=2)\r\n |  \r\n |  get_iter_find_same_beginning_elements(self)\r\n |  \r\n |  get_iter_find_same_ending_elements(self)\r\n |  \r\n |  get_iter_item_difference(self)\r\n |  \r\n |  get_iter_list_ljust_rjust(self, ljust=0, ljustchr=' ', rjust=0, rjustchr=' ', getmax=True)\r\n |  \r\n |  get_iter_log_split(self)\r\n |  \r\n |  get_iter_nested(self)\r\n |  \r\n |  get_iter_nested_for_loop(self)\r\n |  \r\n |  get_iter_nested_for_loop_enumerated(self)\r\n |  \r\n |  get_iter_nested_one_ahead(self)\r\n |  \r\n |  get_iter_nested_with_path(self)\r\n |  \r\n |  get_iter_random_values_from_iter_endless(self)\r\n |  \r\n |  get_iter_reverse_lists_of_list(self)\r\n |  \r\n |  get_iter_rotate_left(self, n, onlyfinal=False)\r\n |  \r\n |  get_iter_rotate_right(self, n, onlyfinal=False)\r\n |  \r\n |  get_iter_stop_when_next_item_is_duplicate(self)\r\n |      https://github.com/joelgrus/stupid-itertools-tricks-pydata/blob/master/src/stupid_tricks.py\r\n |  \r\n |  get_iter_transposed_list_of_lists(self)\r\n |  \r\n |  get_iter_windowed(self, n)\r\n |  \r\n |  get_iter_windowed_distance(self, fillvalue=None, distance=1)\r\n |  \r\n |  get_levenshtein_distance(self, strings)\r\n |  \r\n |  get_normalized_list_of_lists(self, fillv=None)\r\n |  \r\n |  get_random_not_repeating_values(self, howmany)\r\n |  \r\n |  get_random_values_with_max_rep(self, howmany, maxrep)\r\n |  \r\n |  get_shuffle_copied_list(self)\r\n |  \r\n |  group_by(self, func, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  group_coordinates_by_distance(self, coordlist, limit_x, limit_y, continue_on_exceptions=True)\r\n |  \r\n |  group_intersections(self, keep_duplicates=False)\r\n |  \r\n |  group_sequences(self, fu)\r\n |  \r\n |  group_values_in_flattened_nested_iter_and_count(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_almost_equal(self, value, equallimit, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_bigger_than(self, number, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_bigger_than_or_equal(self, number, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_can_be_divided_by(self, div, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_ceil(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_coords_almost_equal(self, x_coord, y_coord, limit_x, limit_y, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_decoding_result(self, mode='strict', continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_division_remainder(self, div, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_divisor(self, div, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_element_pos(self, pos, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_endswith(self, n, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_equal(self, number, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_euclid_dist(self, coord, mindistance=0, maxdistance=500, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_even_odd(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_file_extension(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_files_folder_link(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_first_item(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_first_occurrence_in_string(self, char, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_floor(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_frequency(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_is_integer(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_isalnum(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_isalpha(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_isascii(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_isdecimal(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_isdigit(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_isidentifier(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_isin(self, value, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_isiter(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_islower(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_isna(self, emptyiters: bool = False, nastrings: bool = False, emptystrings: bool = False, emptybytes: bool = False, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_isnumeric(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_isprintable(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_isspace(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_istitle(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_isupper(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_last_occurrence_in_string(self, char, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_less_than(self, number, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_less_than_or_equal(self, number, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_literal_eval_type(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_percentage(self, percent_true, group1=True, group2=False, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_regular_expression_matches(self, regexpressions, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_round(self, n, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_startswith(self, n, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_string_length(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_substring(self, substrings, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_sum(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_sys_size(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_type(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_valid_url(self, continue_on_exceptions=True, withindex=False, withvalue=True)\r\n |  \r\n |  groupby_words_in_texts(self, wordlist, case_sen=False, continue_on_exceptions=True, withindex=False, boundary_right=True, boundary_left=True, withvalue=True)\r\n |  \r\n |  index_all(self, n)\r\n |  \r\n |  insert(self, index, value) -> None\r\n |      Insert object before index.\r\n |  \r\n |  list_of_tuples_to_family_tree(self, main_mapping_keys=(), bi_rl_lr='bi')\r\n |  \r\n |  number_of_combinations(self, k)\r\n |      from https://stackoverflow.com/a/48612518/15096247\r\n |      Number of combinations of length *k* of the elements of *it*.\r\n |  \r\n |  popleft(self)\r\n |  \r\n |  remove_duplicates(self)\r\n |  \r\n |  repeat_items(self, reps)\r\n |  \r\n |  reshape(self, how)\r\n |  \r\n |  search(self, value)\r\n |  \r\n |  shape_repeat(self, shape)\r\n |  \r\n |  sorted(self, func, reverse=False)\r\n |  \r\n |  split_by_indices(self, indices)\r\n |  \r\n |  to_nested_dict(self)\r\n \r\n \r\nimport math\r\nimport random\r\nimport sys\r\n\r\nfrom mehrlist import NestedList\r\n\r\nli = NestedList(\r\n    [\r\n        [[1, 2], [3, 4]],\r\n        [[1, 2], [3, 4]],\r\n        [[1, 2], [3, 4]],\r\n        [[1, 2], [3, 4]],\r\n        [[1, 2], [3, 4]],\r\n        [[1, 2], [3, 4]],\r\n        [[1, 2], [3, 4]],\r\n        [[1, 2], [3, 4]],\r\n        [[1, 2], [3, 4]],\r\n        [[1, 2], [3, 4]],\r\n        [[1, 2], [3, 4]],\r\n        [[1, 2], [3, 4]],\r\n    ],\r\n    maxsize=30,\r\n)\r\nli.convert_all_to_nested_list()\r\nli.to_nested_dict()\r\n#\r\n# Out[3]:\r\n# {0: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}},\r\n#  1: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}},\r\n#  2: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}},\r\n#  3: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}},\r\n#  4: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}},\r\n#  5: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}},\r\n#  6: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}},\r\n#  7: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}},\r\n#  8: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}},\r\n#  9: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}},\r\n#  10: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}},\r\n#  11: {0: {0: 1, 1: 2}, 1: {0: 3, 1: 4}}}\r\nli.flatten()\r\n# Out[4]: [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4]\r\nli.flatten_with_index()\r\n# Out[5]:\r\n# [((0, 0, 0), 1), ((0, 0, 1), 2), ((0, 1, 0), 3), ((0, 1, 1), 4), ((1, 0, 0), 1), ((1, 0, 1), 2), ((1, 1, 0), 3), ((1, 1, 1), 4), ((2, 0, 0), 1), ((2, 0, 1), 2),\r\n# ((2, 1, 0), 3), ((2, 1, 1), 4), ((3, 0, 0), 1), ((3, 0, 1), 2), ((3, 1, 0), 3), ((3, 1, 1), 4), ((4, 0, 0), 1), ((4, 0, 1), 2), ((4, 1, 0), 3), ((4, 1, 1), 4),\r\n# ((5, 0, 0), 1), ((5, 0, 1), 2), ((5, 1, 0), 3), ((5, 1, 1), 4), ((6, 0, 0), 1), ((6, 0, 1), 2), ((6, 1, 0), 3), ((6, 1, 1), 4), ((7, 0, 0), 1), ((7, 0, 1), 2),\r\n# ((7, 1, 0), 3), ((7, 1, 1), 4), ((8, 0, 0), 1), ((8, 0, 1), 2), ((8, 1, 0), 3), ((8, 1, 1), 4), ((9, 0, 0), 1), ((9, 0, 1), 2), ((9, 1, 0), 3), ((9, 1, 1), 4),\r\n# ((10, 0, 0), 1), ((10, 0, 1), 2), ((10, 1, 0), 3), ((10, 1, 1), 4), ((11, 0, 0), 1), ((11, 0, 1), 2), ((11, 1, 0), 3), ((11, 1, 1), 4)]\r\nli.remove_duplicates()\r\n# Out[6]: [[[1, 2], [3, 4]]]\r\nli.sorted(len)\r\n# Out[7]:\r\n# [[[1, 2], [3, 4]], [[1, 2], [3, 4]], [[1, 2], [3, 4]], [[1, 2], [3, 4]], [[1, 2], [3, 4]], [[1, 2], [3, 4]], [[1, 2], [3, 4]], [[1, 2], [3, 4]], [[1, 2], [3,\r\n# 4]], [[1, 2], [3, 4]], [[1, 2], [3, 4]], [[1, 2], [3, 4]]]\r\ntry:\r\n    n = NestedList(1)\r\nexcept TypeError:\r\n    n = NestedList(1, convert_all=True)\r\nprint(n)\r\nl = NestedList(range(50))\r\nl.split_by_indices([2, 24, 48])\r\n# [[0, 1], [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23], [24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,\r\n# 41, 42, 43, 44, 45, 46, 47], [48, 49]]\r\nlist(l.get_iter_every_nth_element(9))\r\n# Out[8]: [0, 9, 18, 27, 36, 45]\r\nl.repeat_items(5)\r\n# [0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, ...]\r\nlist(l.get_iter_windowed(n=4))\r\n# Out[12]:\r\n# [(0, 1, 2, 3),\r\n#  (1, 2, 3, 4),\r\n#  (2, 3, 4, 5),\r\n#  (3, 4, 5, 6),\r\nlist(l.get_iter_batch(3))\r\n# Out[14]:\r\n# [[0, 1, 2],\r\n#  [3, 4, 5],\r\n#  [6, 7, 8],\r\n#  [9, 10, 11],\r\n\r\nlist(li.get_iter_nested_for_loop())[:2]\r\n# Out[19]:\r\n# [([1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2]),\r\n#  ([1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [3, 4])]\r\n\r\n\r\nlist(li.get_iter_nested_for_loop_enumerated())[:2]\r\n# Out[20]:\r\n# [(0,\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2]),\r\n#  (1,\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [1, 2],\r\n#   [3, 4])]\r\n\r\nlist(l.get_iter_add_one_item_each_iteration())[:5]\r\n# Out[22]: [[0], [0, 1], [0, 1, 2], [0, 1, 2, 3], [0, 1, 2, 3, 4]]\r\n\r\n\r\nlist(l.get_iter_add_one_item_each_iteration_reverse())[:5]\r\n# Out[23]: [[49], [48, 49], [47, 48, 49], [46, 47, 48, 49], [45, 46, 47, 48, 49]]\r\n\r\nl2 = NestedList(\r\n    [\r\n        [1, 2, 3],\r\n        [4, 5, 6],\r\n        [7, 8, 9],\r\n        [10, 11, 12],\r\n        [13, 14, 15],\r\n        [16, 17, 18],\r\n        [19, 20, 21],\r\n    ]\r\n)\r\nl3 = NestedList(\r\n    [\r\n        [[1, 2, 3], [4, 5, 6]],\r\n        [[7, 8, 9], [10, 11, 12]],\r\n        [[13, 14, 15], [16, 17, 18], [19, 20, 21]],\r\n    ]\r\n)\r\n\r\nlist(l3.get_iter_nested())\r\n# Out[3]:\r\n# [[[[1, 2, 3], [4, 5, 6]], [1, 2, 3], 1],\r\n#  [[[1, 2, 3], [4, 5, 6]], [1, 2, 3], 2],\r\n#  [[[1, 2, 3], [4, 5, 6]], [1, 2, 3], 3],\r\n#  [[[1, 2, 3], [4, 5, 6]], [4, 5, 6], 4],\r\n#  [[[1, 2, 3], [4, 5, 6]], [4, 5, 6], 5],\r\n#  [[[1, 2, 3], [4, 5, 6]], [4, 5, 6], 6],\r\n#  [[[7, 8, 9], [10, 11, 12]], [7, 8, 9], 7],\r\n#  [[[7, 8, 9], [10, 11, 12]], [7, 8, 9], 8],\r\n#  [[[7, 8, 9], [10, 11, 12]], [7, 8, 9], 9],\r\n#  [[[7, 8, 9], [10, 11, 12]], [10, 11, 12], 10],\r\n#  [[[7, 8, 9], [10, 11, 12]], [10, 11, 12], 11],\r\n#  [[[7, 8, 9], [10, 11, 12]], [10, 11, 12], 12],\r\n#  [[[13, 14, 15], [16, 17, 18], [19, 20, 21]], [13, 14, 15], 13],\r\n#  [[[13, 14, 15], [16, 17, 18], [19, 20, 21]], [13, 14, 15], 14],\r\n#  [[[13, 14, 15], [16, 17, 18], [19, 20, 21]], [13, 14, 15], 15],\r\n#  [[[13, 14, 15], [16, 17, 18], [19, 20, 21]], [16, 17, 18], 16],\r\n#  [[[13, 14, 15], [16, 17, 18], [19, 20, 21]], [16, 17, 18], 17],\r\n#  [[[13, 14, 15], [16, 17, 18], [19, 20, 21]], [16, 17, 18], 18],\r\n#  [[[13, 14, 15], [16, 17, 18], [19, 20, 21]], [19, 20, 21], 19],\r\n#  [[[13, 14, 15], [16, 17, 18], [19, 20, 21]], [19, 20, 21], 20],\r\n#  [[[13, 14, 15], [16, 17, 18], [19, 20, 21]], [19, 20, 21], 21]]\r\n\r\nlist(l3.get_iter_nested_with_path())\r\n# Out[3]:\r\n# [[((0,), [[1, 2, 3], [4, 5, 6]]), ((0, 0), [1, 2, 3]), ((0, 0, 0), 1)],\r\n#  [((0,), [[1, 2, 3], [4, 5, 6]]), ((0, 0), [1, 2, 3]), ((0, 0, 1), 2)],\r\n#  [((0,), [[1, 2, 3], [4, 5, 6]]), ((0, 0), [1, 2, 3]), ((0, 0, 2), 3)],\r\n#  [((0,), [[1, 2, 3], [4, 5, 6]]), ((0, 1), [4, 5, 6]), ((0, 1, 0), 4)],\r\n\r\nl4 = NestedList([[1, 2, 3, 4], [5, 1, 2, 3, 4], [55, 55, 1, 2, 3, 4]])\r\nlist(l4.get_iter_find_same_ending_elements())\r\n# Out[4]: [1, 2, 3, 4]\r\nl5 = NestedList([\"ababa\", \"abacxxx\", \"abdd\"])\r\nlist(l5.get_iter_find_same_beginning_elements())\r\n# ['a', 'b']\r\n\r\n\r\nl.reshape([20, [25], {1}, ((1,), 3)])\r\n# Out[11]:\r\n# [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, [20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,\r\n# 42, 43, 44], {45}, ((46,), 47, 48, 49)]\r\n\r\n\r\nlist(l4.get_iter_rotate_left(3))\r\n# Out[14]:\r\n# [['abacxxx', 'abdd', 'ababa'],\r\n#  ['abdd', 'ababa', 'abacxxx'],\r\n#  ['ababa', 'abacxxx', 'abdd']]\r\n\r\nlist(l4.get_iter_rotate_right(3))\r\n# Out[15]:\r\n# [['abdd', 'ababa', 'abacxxx'],\r\n#  ['abacxxx', 'abdd', 'ababa'],\r\n#  ['ababa', 'abacxxx', 'abdd']]\r\n\r\n\r\nl4.shape_repeat((3, 4))\r\n\r\n# Out[17]:\r\n# [[['ababa', 'abacxxx', 'abdd'], ['ababa', 'abacxxx', 'abdd'], ['ababa', 'abacxxx', 'abdd']], [['ababa', 'abacxxx', 'abdd'], ['ababa', 'abacxxx', 'abdd'],\r\n# ['ababa', 'abacxxx', 'abdd']], [['ababa', 'abacxxx', 'abdd'], ['ababa', 'abacxxx', 'abdd'], ['ababa', 'abacxxx', 'abdd']], [['ababa', 'abacxxx', 'abdd'],\r\n# ['ababa', 'abacxxx', 'abdd'], ['ababa', 'abacxxx', 'abdd']]]\r\n\r\n\r\nlist(l2.get_iter_enumerated_unpacked())\r\n# Out[19]:\r\n# [(0, 1, 4, 7, 10, 13, 16, 19),\r\n#  (1, 2, 5, 8, 11, 14, 17, 20),\r\n#  (2, 3, 6, 9, 12, 15, 18, 21)]\r\n\r\n\r\nlist(l2.get_iter_cycle_shortest(range(10)))\r\n# Out[21]:\r\n# [([1, 2, 3], 0),\r\n#  ([4, 5, 6], 1),\r\n#  ([7, 8, 9], 2),\r\n#  ([10, 11, 12], 3),\r\n#  ([13, 14, 15], 4),\r\n#  ([16, 17, 18], 5),\r\n#  ([19, 20, 21], 6),\r\n#  ([1, 2, 3], 7),\r\n#  ([4, 5, 6], 8),\r\n#  ([7, 8, 9], 9)]\r\n\r\nlist(l2.get_iter_reverse_lists_of_list())\r\n# Out[3]:\r\n# [[3, 2, 1],\r\n#  [6, 5, 4],\r\n#  [9, 8, 7],\r\n#  [12, 11, 10],\r\n#  [15, 14, 13],\r\n#  [18, 17, 16],\r\n#  [21, 20, 19]]\r\n\r\nl6 = NestedList([1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 0])\r\nlist(l6.get_iter_stop_when_next_item_is_duplicate())\r\n# Out[4]: [1, 2, 3, 4, 5, 6, 7, 8]\r\n\r\n\r\nlist(l4.get_iter_nested_one_ahead())\r\n# Out[8]:\r\n# [[[[1, 2, 3, 4], 1], [[1, 2, 3, 4], 2]],\r\n#  [[[1, 2, 3, 4], 2], [[1, 2, 3, 4], 3]],\r\n#  [[[1, 2, 3, 4], 3], [[1, 2, 3, 4], 4]],\r\n#  [[[1, 2, 3, 4], 4], [[5, 1, 2, 3, 4], 5]],\r\n#  [[[5, 1, 2, 3, 4], 5], [[5, 1, 2, 3, 4], 1]],\r\n#  [[[5, 1, 2, 3, 4], 1], [[5, 1, 2, 3, 4], 2]],\r\n#  [[[5, 1, 2, 3, 4], 2], [[5, 1, 2, 3, 4], 3]],\r\n#  [[[5, 1, 2, 3, 4], 3], [[5, 1, 2, 3, 4], 4]],\r\n#  [[[5, 1, 2, 3, 4], 4], [[55, 55, 1, 2, 3, 4], 55]],\r\n#  [[[55, 55, 1, 2, 3, 4], 55], [[55, 55, 1, 2, 3, 4], 55]],\r\n#  [[[55, 55, 1, 2, 3, 4], 55], [[55, 55, 1, 2, 3, 4], 1]],\r\n#  [[[55, 55, 1, 2, 3, 4], 1], [[55, 55, 1, 2, 3, 4], 2]],\r\n#  [[[55, 55, 1, 2, 3, 4], 2], [[55, 55, 1, 2, 3, 4], 3]],\r\n#  [[[55, 55, 1, 2, 3, 4], 3], [[55, 55, 1, 2, 3, 4], 4]]]\r\n\r\n\r\nl // 3\r\n# Out[3]:\r\n# [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],\r\n#  [16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31],\r\n#  [32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]]\r\n\r\nfor ini, v in enumerate(l.get_iter_random_values_from_iter_endless()):\r\n    print(v)\r\n    if ini == 5:\r\n        break\r\n# 36\r\n# 34\r\n# 15\r\n# 23\r\n# 17\r\n# 32\r\n\r\nl9 = NestedList([\"abab\", \"cbcv\", \"banana\", \"bbb\"])\r\nl9.groupby_element_pos(1)\r\n# Out[9]: {'b': ['abab', 'cbcv', 'bbb'], 'a': ['banana']}\r\n\r\n\r\nl10 = NestedList([\"aaabbb\", \"ccbbbb\", \"ab\", \"zcvcb\", \"abbab\"])\r\nl10.groupby_substring(\"abbb\")\r\n# Out[7]: {'abbb': ['aaabbb'], '': ['ccbbbb', 'zcvcb'], 'ab': ['ab'], 'abb': ['abbab']}\r\n\r\nl11 = NestedList(\r\n    [\r\n        [\"abab\", \"bac\"],\r\n        [\"abab\", \"bac\"],\r\n        [\"abab\", \"bac\"],\r\n        1,\r\n        2,\r\n        34,\r\n        {43: 33},\r\n        {43: 33},\r\n    ]\r\n)\r\nl11.count_all_items()\r\n# Out[11]: [(['abab', 'bac'], 3), (1, 1), (2, 1), (34, 1), ({43: 33}, 2)]\r\n\r\n\r\nl12 = NestedList([\"anton\", \"annabell\", \"anschalten\"])\r\nl12.find_common_start_string()\r\n# Out[12]: 'an'\r\n\r\n\r\nlist(l.get_iter_item_difference())\r\n# [1,\r\n#  1,\r\n#  1,\r\n#  1,\r\n#  1...\r\n\r\nl2.index_all([4, 5, 6])\r\n# Out[3]: [1]\r\nl2.index_all([1, 2, 3])\r\n# Out[4]: [0]\r\n\r\nl13 = NestedList([1, 1, 2, 34, 4, 1, 1, 2, 34, 4, 1, 1])\r\nl13.index_all(1)\r\n# Out[6]: [0, 1, 5, 6, 10, 11]\r\n\r\n\r\nl2.popleft()\r\n# Out[5]: [1, 2, 3]\r\nl2\r\n# Out[6]: [[4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15], [16, 17, 18], [19, 20, 21]]\r\n\r\n\r\nl2.appendleft(10)\r\nl2\r\n# Out[5]: [10, [4, 5, 6], [7, 8, 9], [10, 11, 12], [13, 14, 15], [16, 17, 18], [19, 20, 21]]\r\n\r\n\r\nseq = (0, 1), (1, 1), (1, 0)\r\nl13 = NestedList(\r\n    [(random.randrange(0, 2), random.randrange(0, 2)) for _ in range(3000)]\r\n)\r\nfor xz in l13.find_sequence(seq):\r\n    print(xz)\r\n\r\nl13.del_items((0, 0))\r\n\r\nl.get_random_values_with_max_rep(10, 2)\r\n# Out[4]: [29, 14, 47, 35, 11, 16, 26, 42, 40, 7]\r\n\r\n\r\nl.get_random_not_repeating_values(10)\r\n# Out[5]: [33, 37, 20, 14, 47, 17, 44, 2, 46, 32]\r\n\r\n\r\nfor key, item in (\r\n    NestedList([[1, 2, 3, 4], [2, 3, 6]])\r\n    .get_cycle_list_until_every_list_fits(\r\n        maxresults=4,\r\n        append=True,\r\n    )\r\n    .items()\r\n):\r\n    print(key, item)\r\n# 12 defaultdict(<class 'list'>, {0: [[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]], 1: [[2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6]]})\r\n# 24 defaultdict(<class 'list'>, {0: [[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]], 1: [[2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6]]})\r\n# 36 defaultdict(<class 'list'>, {0: [[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]], 1: [[2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6]]})\r\n# 48 defaultdict(<class 'list'>, {0: [[1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4], [1, 2, 3, 4]], 1: [[2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6], [2, 3, 6]]})\r\n\r\nl2.group_by(lambda x: isinstance(x, int))\r\n# Out[6]:\r\n# {True: [10],\r\n#  False: [[4, 5, 6],\r\n#   [7, 8, 9],\r\n#   [10, 11, 12],\r\n#   [13, 14, 15],\r\n#   [16, 17, 18],\r\n#   [19, 20, 21]]}\r\n\r\n\r\nl.number_of_combinations(4)\r\n# Out[10]: 230300\r\n\r\n\r\nl3.flatten_and_group_by(lambda x: x > 10)\r\n# Out[13]:\r\n# {False: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],\r\n#  True: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21]}\r\n\r\nl3.get_normalized_list_of_lists()\r\n# Out[3]:\r\n# [[[1, 2, 3], [4, 5, 6], None],\r\n#  [[7, 8, 9], [10, 11, 12], None],\r\n#  [[13, 14, 15], [16, 17, 18], [19, 20, 21]]]\r\n\r\nlist(l2[1:].get_iter_transposed_list_of_lists())\r\n# Out[3]: [[4, 7, 10, 13, 16, 19], [5, 8, 11, 14, 17, 20], [6, 9, 12, 15, 18, 21]]\r\n\r\n\r\nshu = l2.get_shuffle_copied_list()\r\nprint(shu)\r\n\r\nfor i, q in enumerate(\r\n    l.get_iter_call_function_over_and_over_with_new_value(lambda x: [y * 2 for y in x])\r\n):\r\n    if i == 3:\r\n        break\r\n    print(q)\r\n# [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,\r\n# 42, 43, 44, 45, 46, 47, 48, 49]\r\n# [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98]\r\n# [0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 92, 96, 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140, 144, 148, 152, 156, 160, 164, 168, 172, 176, 180, 184, 188, 192, 196]\r\n\r\n\r\nlist(l[:10].get_iter_windowed_distance(fillvalue=None, distance=3))\r\n# Out[9]:\r\n# [(None, 0, 3),\r\n#  (None, 1, 4),\r\n#  (None, 2, 5),\r\n#  (0, 3, 6),\r\n#  (1, 4, 7),\r\n#  (2, 5, 8),\r\n#  (3, 6, 9),\r\n#  (4, 7, None),\r\n#  (5, 8, None),\r\n#  (6, 9, None)]\r\n\r\nlist(l[:10].get_iter_2_cycle_second_until_first_done(range(3)))\r\n# Out[11]:\r\n# [(0, 0),\r\n#  (1, 1),\r\n#  (2, 2),\r\n#  (3, 0),\r\n#  (4, 1),\r\n#  (5, 2),\r\n#  (6, 0),\r\n#  (7, 1),\r\n#  (8, 2),\r\n#  (9, 0)]\r\n\r\n\r\nNestedList(\r\n    [\r\n        (\"Maria\", \"Anna\"),\r\n        (\"Anna\", \"Joao\"),\r\n        (\"Kasimir\", \"Maria\"),\r\n        (\"Hans\", \"Fritz\"),\r\n        (\"Fritz\", \"Anna\"),\r\n        (\"G\u00fcnther\", \"Wolfgang\"),\r\n        (\"Joao\", \"Wolfgang\"),\r\n    ]\r\n).list_of_tuples_to_family_tree(main_mapping_keys=(\"Wolfgang\",), bi_rl_lr=\"rl\")\r\n\r\n# ([(1, ('Wolfgang', 'G\u00fcnther')),\r\n#   (2, ('Wolfgang', 'Joao', 'Anna', 'Maria', 'Kasimir')),\r\n#   (3, ('Wolfgang', 'Joao', 'Anna', 'Fritz', 'Hans'))],\r\n#  {'Wolfgang': {'G\u00fcnther': 1,\r\n#    'Joao': {'Anna': {'Maria': {'Kasimir': 2}, 'Fritz': {'Hans': 3}}}}})\r\n\r\n\r\nNestedList([\"ababa\", \"bubax\", \"ali bbaba\"]).get_levenshtein_distance(\"ali baba\")\r\n# Out[3]: [[(1, 2, 'ali bbaba', 'ali baba'), (3, 0, 'ababa', 'ali baba'), (6, 1, 'bubax', 'ali baba')]]\r\n\r\n\r\nNestedList(\r\n    [\r\n        [[(\"Maria\", \"Anna\"), (\"Anna\", \"Joao\")]],\r\n        {(\"Kasimir\", \"Maria\"), (\"Hans\", \"Fritz\")},\r\n        (\"Fritz\", \"Anna\"),\r\n        {\"G\u00fcnther\": \"Wolfgang\"},\r\n        (\"Joao\", \"Wolfgang\"),\r\n    ]\r\n).flatten_level(n=None, dict_treatment=\"items\", consider_non_iter=(str, bytes, dict))\r\n# Out[5]:\r\n# ['Maria',\r\n#  'Anna',\r\n#  'Anna',\r\n#  'Joao',\r\n#  'Kasimir',\r\n#  'Maria',\r\n#  'Hans',\r\n#  'Fritz',\r\n#  'Fritz',\r\n#  'Anna',\r\n#  {'G\u00fcnther': 'Wolfgang'},\r\n#  'Joao',\r\n#  'Wolfgang']\r\n\r\nprint(l.group_sequences(fu=lambda a, b: b > a)[0])\r\np = NestedList([\"a\", \"aa\", \"b\", \"bbb\", \"c\", \"d\", \"dd\", \"ddd\", \"vbvdddd\"])\r\n\r\nprint(p.group_sequences(fu=lambda a, b: a in b))\r\n# [['a', 'aa'], ['b', 'bbb'], ['c'], ['d', 'dd', 'ddd', 'vbvdddd']]\r\n\r\nk = NestedList([random.randint(0, 5) for x in range(20)])\r\nprint(k.group_sequences(lambda a, b: b >= a))\r\n# [3, 1, 3, 5, 3, 4, 4, 3, 4, 3, 4, 4, 5, 1, 3, 2, 3, 1, 1, 3]\r\n# [[3], [1, 3, 5], [3, 4, 4], [3, 4], [3, 4, 4, 5], [1, 3], [2, 3], [1, 1, 3]]\r\n\r\n\r\no = NestedList(\r\n    [(1, 2), (3, 4), (501, 641), (300, 4500), (1, 4344)]\r\n).groupby_euclid_dist(\r\n    coord=(0, 0),\r\n    mindistance=0,\r\n    maxdistance=500,\r\n)\r\n# Out[6]: {True: [(1, 2), (3, 4)], False: [(501, 641), (300, 4500), (1, 4344)]}\r\n\r\n\r\nNestedList([\"a\", \"bbb\", \"b\", \"ddd\", \"444444\"]).groupby_string_length()\r\n# Out[3]: {1: ['a', 'b'], 3: ['bbb', 'ddd'], 6: ['444444']}\r\n\r\n\r\nNestedList(\r\n    [\"a\", \"bbb\", \"b\", \"ddd\", \"444444\", [1, [1, 1, 1, 1, 1, 1, [1]]]]\r\n).group_values_in_flattened_nested_iter_and_count()\r\n# Out[4]: {'a': 1, 'bbb': 1, 'b': 1, 'ddd': 1, '444444': 1, 1: 8}\r\n\r\n\r\nNestedList(\r\n    [\"a\", \"bbb\", \"b\", \"ddd\", \"444444\", [1, [1, 1, 1, 1, 1, 1, [1]]]]\r\n).groupby_type()\r\n# Out[5]: {str: ['a', 'bbb', 'b', 'ddd', '444444'], list: [[1, [1, 1, 1, 1, 1, 1, [1]]]]}\r\n\r\n\r\nNestedList(\r\n    [\"a\", \"bbb\", \"b\", \"ddd\", \"444444\", \"a\", \"a\", \"ddd\", [1, [1, 1, 1, 1, 1, 1, [1]]]]\r\n).groupby_frequency()\r\n# Out[6]:\r\n# {3: ['a', 'a', 'a'],\r\n#  1: ['bbb', 'b', '444444', [1, [1, 1, 1, 1, 1, 1, [1]]]],\r\n#  2: ['ddd', 'ddd']}\r\n\r\nNestedList(\r\n    [\r\n        4,\r\n        2,\r\n        2,\r\n        2344,\r\n        444,\r\n        222,\r\n        7,\r\n        7,\r\n        8,\r\n        9,\r\n        0,\r\n        7,\r\n        65,\r\n        45,\r\n    ]\r\n).groupby_can_be_divided_by(2)\r\n# Out[7]: {True: [4, 2, 2, 2344, 444, 222, 8, 0], False: [7, 7, 9, 7, 65, 45]}\r\n\r\nNestedList(\r\n    [\r\n        4,\r\n        2,\r\n        2,\r\n        2344,\r\n        444,\r\n        222,\r\n        7,\r\n        7,\r\n        8,\r\n        9,\r\n        0,\r\n        7,\r\n        65,\r\n        45,\r\n    ]\r\n).groupby_division_remainder(2)\r\n# Out[8]: {0: [4, 2, 2, 2344, 444, 222, 8, 0], 1: [7, 7, 9, 7, 65, 45]}\r\n\r\nNestedList(\r\n    [\r\n        4,\r\n        2,\r\n        2,\r\n        2344,\r\n        444,\r\n        222,\r\n        7,\r\n        7,\r\n        8,\r\n        9,\r\n        0,\r\n        7,\r\n        65,\r\n        45,\r\n    ]\r\n).groupby_divisor(2)\r\n# Out[9]:\r\n# {2: [4],\r\n#  1: [2, 2],\r\n#  1172: [2344],\r\n#  222: [444],\r\n#  111: [222],\r\n#  3: [7, 7, 7],\r\n#  4: [8, 9],\r\n#  0: [0],\r\n#  32: [65],\r\n#  22: [45]}\r\n\r\nNestedList(\r\n    [\r\n        4,\r\n        2,\r\n        2,\r\n        2344,\r\n        444,\r\n        222,\r\n        7,\r\n        7,\r\n        8,\r\n        9,\r\n        0,\r\n        7,\r\n        65,\r\n        45,\r\n    ]\r\n).groupby_bigger_than_or_equal(100)\r\n# Out[10]: {False: [4, 2, 2, 7, 7, 8, 9, 0, 7, 65, 45], True: [2344, 444, 222]}\r\n\r\nNestedList(\r\n    [\r\n        4,\r\n        2,\r\n        2,\r\n        2344,\r\n        444,\r\n        222,\r\n        7,\r\n        7,\r\n        8,\r\n        9,\r\n        0,\r\n        7,\r\n        65,\r\n        45,\r\n    ]\r\n).groupby_less_than_or_equal(100)\r\n# Out[11]: {True: [4, 2, 2, 7, 7, 8, 9, 0, 7, 65, 45], False: [2344, 444, 222]}\r\n\r\n\r\nNestedList(\r\n    [\r\n        4,\r\n        2,\r\n        2,\r\n        2344,\r\n        444,\r\n        222,\r\n        7,\r\n        7,\r\n        8,\r\n        9,\r\n        0,\r\n        7,\r\n        65,\r\n        45,\r\n    ]\r\n).groupby_bigger_than(100)\r\n# Out[12]: {False: [4, 2, 2, 7, 7, 8, 9, 0, 7, 65, 45], True: [2344, 444, 222]}\r\nNestedList(\r\n    [\r\n        4,\r\n        2,\r\n        2,\r\n        2344,\r\n        444,\r\n        222,\r\n        7,\r\n        7,\r\n        8,\r\n        9,\r\n        0,\r\n        7,\r\n        65,\r\n        45,\r\n    ]\r\n).groupby_less_than(100)\r\n# Out[13]: {True: [4, 2, 2, 7, 7, 8, 9, 0, 7, 65, 45], False: [2344, 444, 222]}\r\n\r\nNestedList(\r\n    [\r\n        4,\r\n        2,\r\n        2,\r\n        2344,\r\n        444,\r\n        222,\r\n        7,\r\n        7,\r\n        8,\r\n        9,\r\n        0,\r\n        7,\r\n        65,\r\n        45,\r\n    ]\r\n).groupby_equal(7)\r\n# Out[14]: {False: [4, 2, 2, 2344, 444, 222, 8, 9, 0, 65, 45], True: [7, 7, 7]}\r\n\r\nNestedList(\r\n    [\"1342423\", \"ddd\", \"33333\", \"ixxx\", \"00\"]\r\n).groupby_regular_expression_matches(r\"\\d+\")\r\n# Out[15]: {True: ['1342423', '33333', '00'], False: ['ddd', 'ixxx']}\r\n\r\nNestedList([2.0, 1, 1, 3, 5, 3.0, 3.4, 2.4, 25.3]).groupby_is_integer()\r\n# Out[17]: {True: [2.0, 1, 1, 3, 5, 3.0], False: [3.4, 2.4, 25.3]}\r\n\r\nNestedList(\r\n    [1.0, 1.1, 1.2, 1.3, 1.9, 1.8, 2.0, 1, 1, 3, 5, 3.0, 3.4, 2.4, 25.3]\r\n).groupby_floor()\r\n# Out[18]:\r\n# {1: [1.0, 1.1, 1.2, 1.3, 1.9, 1.8, 1, 1],\r\n#  2: [2.0, 2.4],\r\n#  3: [3, 3.0, 3.4],\r\n#  5: [5],\r\n#  25: [25.3]}\r\nNestedList(\r\n    [1.0, 1.1, 1.2, 1.3, 1.9, 1.8, 2.0, 1, 1, 3, 5, 3.0, 3.4, 2.4, 25.3]\r\n).groupby_ceil()\r\n# Out[19]:\r\n# {1: [1.0, 1, 1],\r\n#  2: [1.1, 1.2, 1.3, 1.9, 1.8, 2.0],\r\n#  3: [3, 3.0, 2.4],\r\n#  5: [5],\r\n#  4: [3.4],\r\n#  26: [25.3]}\r\n\r\nseq = [\r\n    1.11111111,\r\n    1.111222222,\r\n    1.11113334,\r\n    1.3,\r\n    1.9,\r\n    1.8,\r\n    2.0,\r\n    1,\r\n    1,\r\n    3,\r\n    5,\r\n    3.0,\r\n    3.4,\r\n    2.4,\r\n    25.3,\r\n]\r\nNestedList(seq).groupby_round(n=2)\r\n# Out[21]:\r\n# {1.11: [1.11111111, 1.111222222, 1.11113334],\r\n#  1.3: [1.3],\r\n#  1.9: [1.9],\r\n#  1.8: [1.8],\r\n#  2.0: [2.0],\r\n#  1: [1, 1],\r\n#  3: [3, 3.0],\r\n#  5: [5],\r\n#  3.4: [3.4],\r\n#  2.4: [2.4],\r\n#  25.3: [25.3]}\r\n\r\nseq = [\"hallo\", \"boot\", \"baba\", \"bdoo\", \"flaot\", \"mama\"]\r\nNestedList(seq).groupby_endswith(n=1)\r\n# Out[22]: {'o': ['hallo', 'bdoo'], 't': ['boot', 'flaot'], 'a': ['baba', 'mama']}\r\n\r\n\r\nNestedList(seq).groupby_startswith(n=1)\r\n# Out[23]: {'h': ['hallo', 'hmama'], 'b': ['boot', 'baba', 'bdoo'], 'f': ['flaot']}\r\n\r\n\r\nNestedList(seq).groupby_first_occurrence_in_string(char=\"a\")\r\n# Out[25]: {1: ['hallo', 'baba'], -1: ['boot', 'bdoo'], 2: ['flaot', 'hmama']}\r\n\r\nNestedList(seq).groupby_last_occurrence_in_string(char=\"a\")\r\n# Out[26]: {1: ['hallo'], -1: ['boot', 'bdoo'], 3: ['baba'], 2: ['flaot'], 4: ['hmama']}\r\n\r\nNestedList(seq).groupby_isalnum()\r\n# Out[28]: {True: ['One', '222'], False: ['%', '#']}\r\n\r\nNestedList(seq).groupby_isalpha()\r\n# Out[29]: {True: ['One'], False: ['%', '#', '222']}\r\n\r\nNestedList(seq).groupby_isascii()\r\n# Out[31]: {True: ['One', '%', '#', '222'], False: ['\u00e7', '\u00df']}\r\n\r\nNestedList(seq).groupby_isdecimal()\r\n# Out[32]: {False: ['One', '%', '#', '\u00e7', '\u00df'], True: ['222']}\r\n\r\nseq = \"\"\"One % # 222 \u00e7 \u00df\"\"\".split()\r\nNestedList(seq).groupby_isdigit()\r\n# Out[33]: {False: ['One', '%', '#', '\u00e7', '\u00df'], True: ['222']}\r\n\r\nseq = \"\"\"One % # 222 \u00e7 \u00df True if bool\"\"\".split()\r\nNestedList(seq).groupby_isidentifier()\r\n# Out[35]: {True: ['One', '\u00e7', '\u00df', 'True', 'if', 'bool'], False: ['%', '#', '222']}\r\n\r\nseq = \"\"\"One % # 222 \u00e7 \u00df True if bool\"\"\".split()\r\nNestedList(seq).groupby_islower()\r\n# Out[37]: {False: ['One', '%', '#', '222', 'True'], True: ['\u00e7', '\u00df', 'if', 'bool']}\r\n\r\nNestedList(seq).groupby_isnumeric()\r\n# Out[38]: {False: ['One', '%', '#', '\u00e7', '\u00df', 'True', 'if', 'bool'], True: ['222']}\r\n\r\nseq = \"\"\"One % # 222 \u00e7 \u00df True if bool\"\"\".split() + [\"\\r\"]\r\nNestedList(seq).groupby_isprintable()\r\n# Out[42]: {True: ['One', '%', '#', '222', '\u00e7', '\u00df', 'True', 'if', 'bool'], False: ['\\r']}\r\n\r\nNestedList(seq).groupby_isspace()\r\n# Out[43]: {False: ['One', '%', '#', '222', '\u00e7', '\u00df', 'True', 'if', 'bool'], True: ['\\r']}\r\n\r\nNestedList(seq).groupby_istitle()\r\n# Out[44]: {True: ['One', 'True'], False: ['%', '#', '222', '\u00e7', '\u00df', 'if', 'bool', '\\r']}\r\n\r\n\r\nseq = \"\"\"One % # 222 \u00e7 \u00df True if bool AA\"\"\".split() + [\"\\r\"]\r\nNestedList(seq).groupby_isupper()\r\n# Out[46]:\r\n# {False: ['One', '%', '#', '222', '\u00e7', '\u00df', 'True', 'if', 'bool', '\\r'],\r\n#  True: ['AA']}\r\n\r\nseq = \"\"\"One % # 222 \u00e7 \u00df True if bool AA\"\"\".split()\r\nNestedList(seq).groupby_isin(\"e\")\r\n# Out[48]: {True: ['One', 'True'], False: ['%', '#', '222', '\u00e7', '\u00df', 'if', 'bool', 'AA']}\r\n\r\nseq = [\r\n    (\r\n        g := random.randrange(1, 200),\r\n        f := random.randrange(1, 200),\r\n        g + 100,\r\n        f + 100,\r\n    )\r\n    for _ in range(10)\r\n]\r\n\r\n\r\nimport numpy as np\r\nimport pandas as pd\r\n\r\nseq = [pd.NA, np.nan, None, math.nan, 3, 54, 3, (22, 34, 412), {323, 31}, [3312, 3]]\r\nNestedList(seq).groupby_isna(\r\n    emptyiters=False,\r\n    nastrings=False,\r\n    emptystrings=False,\r\n    emptybytes=False,\r\n    continue_on_exceptions=True,\r\n    withindex=False,\r\n    withvalue=True,\r\n)\r\n# Out[4]:\r\n# {True: [<NA>, nan, None, nan],\r\n#  False: [3, 54, 3, (22, 34, 412), {31, 323}, [3312, 3]]}\r\n\r\n\r\nseq = [pd.NA, np.nan, None, math.nan, 3, 54, 3, (22, 34, 412), {323, 31}, [3312, 3]]\r\nNestedList(seq).groupby_isiter()\r\n# Out[5]:\r\n# {False: [<NA>, nan, None, nan, 3, 54, 3],\r\n#  True: [(22, 34, 412), {31, 323}, [3312, 3]]}\r\n\r\n\r\nimport os\r\n\r\nNestedList(os.listdir(r\"F:\\gitrep\\screenshots\")).groupby_file_extension()\r\n\r\n\r\nseq = [1, 2, 3, 45, 56, 6, 32, 12]\r\nNestedList(seq).groupby_even_odd()\r\n# Out[7]: {'odd': [1, 3, 45], 'even': [2, 56, 6, 32, 12]}\r\n\r\nseq = [\r\n    os.path.join(r\"F:\\gitrep\\screenshots\", x)\r\n    for x in os.listdir(r\"F:\\gitrep\\screenshots\")\r\n]\r\n\r\nNestedList(seq).groupby_files_folder_link()\r\n\r\nseq = [\r\n    [\r\n        1,\r\n        2,\r\n        34,\r\n    ],\r\n    (1, 32, 4),\r\n    (2, 3, 4, 54),\r\n    [2, 3, 3],\r\n]\r\nNestedList(seq).groupby_first_item()\r\n# Out[11]: {1: [[1, 2, 34], (1, 32, 4)], 2: [(2, 3, 4, 54), [2, 3, 3]]}\r\n\r\n\r\nNestedList(\r\n    [\"autobahn\", \"computerproblem\", \"kind\", \"opa\", \"kind opa\"]\r\n).groupby_words_in_texts(\r\n    wordlist=[\"kind\", \"opa\"],\r\n    case_sen=False,\r\n    continue_on_exceptions=True,\r\n    withindex=False,\r\n    boundary_right=True,\r\n    boundary_left=True,\r\n)\r\n# Out[4]:\r\n# {(): ['autobahn', 'computerproblem'],\r\n#  ('kind',): ['kind'],\r\n#  ('opa',): ['opa'],\r\n#  ('kind', 'opa'): ['kind opa']}\r\n\r\n\r\nseq = [[1, 2, 2], [5], [2, 3], [4, 4, 4], [12, 0], [6, 6], [1, 2]]\r\nNestedList(seq).groupby_sum()\r\n# Out[5]: {5: [[1, 2, 2], [5], [2, 3]], 12: [[4, 4, 4], [12, 0], [6, 6]], 3: [[1, 2]]}\r\n\r\nseq = [\"https://www.google.com\", \"google.com/\", \"bababa\", \"http://baba.de\"]\r\nNestedList(seq).groupby_valid_url()\r\n# Out[6]:\r\n# {'valid': ['https://www.google.com', 'http://baba.de'],\r\n#  'not_valid': ['google.com/', 'bababa']}\r\n\r\n\r\nseq = [\"11\", \"bb\", '\"bb\"']\r\nNestedList(seq).groupby_literal_eval_type()\r\n# Out[7]:\r\n# {int: ['11'],\r\n#  'EXCEPTION: malformed node or string on line 1: <ast.Name object at 0x000001BE3C6AC0A0>': ['bb'],\r\n#  str: ['\"bb\"']}\r\n\r\n\r\nseq = [b\"\\\\U0001D11E\", b\"baba\"]\r\nNestedList(seq).groupby_decoding_result()\r\n\r\n\r\nseq = 2 * [1, 2, 34, 4, 2, 3, 54, 6, 6, 4, 3, 2, 21, 45, 56]\r\nNestedList(seq).groupby_percentage(percent_true=63.7)\r\n# Out[4]:\r\n# {True: [1, 34, 2, 3, 54, 6, 2, 21, 45, 56, 1, 34, 4, 2, 3, 6, 4, 3, 2, 45, 56],\r\n#  False: [2, 4, 6, 4, 3, 2, 54, 6, 21]}\r\n\r\n\r\nseq = [11, 200, 34, 4, 52, 63, 54, 65, 67, 48, 3, 2, 21, 55, 56, 59, 61, 60]\r\nNestedList(seq).groupby_almost_equal(value=60, equallimit=3)\r\n# Out[6]:\r\n# {False: [11, 200, 34, 4, 52, 54, 65, 67, 48, 3, 2, 21, 55, 56],\r\n#  True: [63, 59, 61, 60]}\r\n\r\nseq = 2 * [(1, 2), (34, 4), (2, 3), (61, 60)]\r\nNestedList(seq).groupby_coords_almost_equal(\r\n    x_coord=4,\r\n    y_coord=3,\r\n    limit_x=5,\r\n    limit_y=1,\r\n)\r\n# Out[7]:\r\n# {(True, True): [(1, 2), (2, 3), (1, 2), (2, 3)],\r\n#  (False, True): [(34, 4), (34, 4)],\r\n#  (False, False): [(61, 60), (61, 60)]}\r\n\r\n\r\ncoordlist = [\r\n    (745, 519),\r\n    (747, 522),\r\n    (747, 517),\r\n    (747, 517),\r\n    (750, 522),\r\n    (756, 449),\r\n    (757, 461),\r\n    (757, 461),\r\n    (757, 438),\r\n    (830, 144),\r\n    (759, 435),\r\n    (759, 435),\r\n    (761, 468),\r\n    (761, 468),\r\n    (764, 521),\r\n    (1079, 199),\r\n    (770, 474),\r\n    (770, 425),\r\n    (773, 516),\r\n    (776, 515),\r\n    (776, 515),\r\n    (778, 520),\r\n    (779, 519),\r\n    (780, 420),\r\n    (780, 420),\r\n    (782, 478),\r\n    (782, 478),\r\n    (1083, 151),\r\n    (1083, 151),\r\n    (1083, 151),\r\n    (1083, 151),\r\n    (784, 478),\r\n    (759, 435),\r\n    (784, 478),\r\n    (819, 137),\r\n    (819, 137),\r\n    (819, 137),\r\n    (797, 524),\r\n    (825, 125),\r\n    (826, 149),\r\n    (800, 446),\r\n    (800, 446),\r\n    (801, 517),\r\n    (801, 517),\r\n    (802, 520),\r\n    (802, 520),\r\n    (804, 519),\r\n    (804, 519),\r\n    (808, 431),\r\n    (808, 431),\r\n    (809, 464),\r\n    (809, 464),\r\n    (812, 438),\r\n    (813, 449),\r\n]\r\nxx = NestedList(coordlist).group_coordinates_by_distance(\r\n    coordlist, limit_x=10, limit_y=10, continue_on_exceptions=True\r\n)\r\nfor x in xx:\r\n    print(x)\r\n#\r\n# ((813, 449),)\r\n# ((779, 519), (773, 516), (776, 515), (778, 520), (764, 521))\r\n# ((808, 431), (812, 438))\r\n# ((1083, 151),)\r\n# ((830, 144), (826, 149))\r\n# ((761, 468), (757, 461), (770, 474))\r\n# ((825, 125),)\r\n# ((756, 449),)\r\n# ((745, 519), (747, 517), (750, 522), (747, 522))\r\n# ((780, 420), (770, 425))\r\n# ((784, 478), (782, 478))\r\n# ((804, 519), (802, 520), (797, 524), (801, 517))\r\n# ((757, 438), (759, 435))\r\n# ((819, 137),)\r\n# ((809, 464),)\r\n# ((800, 446),)\r\n# ((1079, 199),)\r\n\r\n\r\nseq = sorted(list(range(0, 5)) * 3)\r\nprint(NestedList(seq).bisect_rightmost_value_equal_to(4))\r\nprint(NestedList(seq).bisect_rightmost_value_equal_to(0))\r\nprint(NestedList(seq).bisect_rightmost_value_equal_to(1))\r\nprint(NestedList(seq).bisect_leftmost_value_equal_to(4))\r\nprint(NestedList(seq).bisect_leftmost_value_equal_to(0))\r\nprint(NestedList(seq).bisect_leftmost_value_equal_to(1))\r\nprint(NestedList(seq).bisect_rightmost_value_less_than(4))\r\nprint(NestedList(seq).bisect_rightmost_value_less_than(2))\r\nprint(NestedList(seq).bisect_rightmost_value_less_than(1))\r\nprint(NestedList(seq).bisect_rightmost_value_less_than_or_equal(40))\r\nprint(NestedList(seq).bisect_rightmost_value_less_than_or_equal(0))\r\nprint(NestedList(seq).bisect_rightmost_value_less_than_or_equal(1))\r\nprint(NestedList(seq).bisect_leftmost_value_greater_than(2))\r\nprint(NestedList(seq).bisect_leftmost_value_greater_than(3))\r\nprint(NestedList(seq).bisect_leftmost_value_greater_than(0))\r\nprint(NestedList(seq).bisect_leftmost_value_greater_than(1))\r\nprint(NestedList(seq).bisect_leftmost_value_greater_than_or_equal(3))\r\nprint(NestedList(seq).bisect_leftmost_value_greater_than_or_equal(0))\r\nprint(NestedList(seq).bisect_leftmost_value_greater_than_or_equal(1))\r\n\r\n# 14\r\n# 2\r\n# 5\r\n# 12\r\n# 0\r\n# 3\r\n# 11\r\n# 5\r\n# 2\r\n# 14\r\n# 2\r\n# 5\r\n# 9\r\n# 12\r\n# 3\r\n# 6\r\n# 9\r\n# 0\r\n# 3\r\n\r\n\r\ncervejas = [\r\n    (\"original\", 2.5),\r\n    (\"Skol\", 0.5),\r\n    (\"becks\", 16),\r\n    (\"brahma\", 1.4),\r\n    (\"heineken\", 5.5),\r\n]\r\ncats_ = [\r\n    (\"barato\", 1.3),\r\n    (\"mais ou menos\", 2),\r\n    (\"caro\", 3.1),\r\n    (\"muito caro\", 6.5),\r\n    (\"absurdo\", sys.maxsize),\r\n]\r\nNestedList(cervejas).bisect_category_mapping(cats_)\r\n# Out[4]:\r\n# [(('original', 2.5), 'caro'),\r\n#  (('Skol', 0.5), 'barato'),\r\n#  (('becks', 16), 'absurdo'),\r\n#  (('brahma', 1.4), 'mais ou menos'),\r\n#  (('heineken', 5.5), 'muito caro')]\r\n\r\n\r\ntext = \"\"\"\r\nRead the running tests and linters section of our documentation to learn how to test your code. For cross-browser\r\n\"\"\".split() + [\r\n    1,\r\n    2,\r\n    3,\r\n]\r\nlist(\r\n    NestedList(text).get_iter_list_ljust_rjust(\r\n        ljust=None,  # if None and getmax is True -> the longest str will be used\r\n        ljustchr=\"-\",  # fill with char\r\n        rjust=None,  # if None and getmax is True -> the longest str will be used\r\n        rjustchr=\"-\",  # fill with char\r\n        getmax=True,\r\n    )\r\n)\r\n# Out[5]:\r\n# ['---------Read',\r\n#  '----------the',\r\n#  '------running',\r\n#  '--------tests',\r\n#  '----------and',\r\n#  '------linters',\r\n#  '------section',\r\n#  '-----------of',\r\n#  '----------our',\r\n#  'documentation',\r\n#  '-----------to',\r\n#  '--------learn',\r\n#  '----------how',\r\n#  '-----------to',\r\n#  '---------test',\r\n#  '---------your',\r\n#  '--------code.',\r\n#  '----------For',\r\n#  'cross-browser',\r\n#  '------------1',\r\n#  '------------2',\r\n#  '------------3']\r\n\r\nfor li in NestedList((list(range(20)))).get_iter_log_split():\r\n    print(li)\r\n\r\n# [0]\r\n# [1, 2]\r\n# [3, 4, 5]\r\n# [6, 7, 8, 9]\r\n# [10, 11, 12, 13, 14]\r\n# [15, 16, 17, 18, 19]\r\n\r\n  ```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Subclass of list with more than 100 useful methods - pure Python",
    "version": "0.10",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/mehrlist"
    },
    "split_keywords": [
        "nested",
        "list"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f6010e6b10b51df81d1fd6ac13d9dc76bbcd0f4698e86db89031df235237f09c",
                "md5": "c3e49d17dc1e8057cd44d83ca79f9c9f",
                "sha256": "ae1eaa8dda8e43f2a9c7a9fcfeb5fb1a5ea8c858f2cdc96ebd9be10dfb7cade4"
            },
            "downloads": -1,
            "filename": "mehrlist-0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c3e49d17dc1e8057cd44d83ca79f9c9f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 31510,
            "upload_time": "2023-07-12T01:02:51",
            "upload_time_iso_8601": "2023-07-12T01:02:51.945643Z",
            "url": "https://files.pythonhosted.org/packages/f6/01/0e6b10b51df81d1fd6ac13d9dc76bbcd0f4698e86db89031df235237f09c/mehrlist-0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e3fd1f021bccbb848a4d8d4965fb94ede842d4237bd883d90d462e5b8ea38414",
                "md5": "028cb528c23eb91c75ab8c589bd3f3f0",
                "sha256": "ba7951032c165e32828f436d90bdb848a4909c4bc3727bbaba13f31c4cb9daf7"
            },
            "downloads": -1,
            "filename": "mehrlist-0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "028cb528c23eb91c75ab8c589bd3f3f0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 46952,
            "upload_time": "2023-07-12T01:02:54",
            "upload_time_iso_8601": "2023-07-12T01:02:54.713178Z",
            "url": "https://files.pythonhosted.org/packages/e3/fd/1f021bccbb848a4d8d4965fb94ede842d4237bd883d90d462e5b8ea38414/mehrlist-0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-12 01:02:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "mehrlist",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "bisectsearch",
            "specs": []
        },
        {
            "name": "catmapper",
            "specs": []
        },
        {
            "name": "flatten_any_dict_iterable_or_whatsoever",
            "specs": []
        },
        {
            "name": "flatten_everything",
            "specs": []
        },
        {
            "name": "intersection_grouper",
            "specs": []
        },
        {
            "name": "isiter",
            "specs": []
        },
        {
            "name": "levelflatten",
            "specs": []
        },
        {
            "name": "list2tree",
            "specs": []
        },
        {
            "name": "nested2nested",
            "specs": []
        },
        {
            "name": "screwhashesset",
            "specs": []
        },
        {
            "name": "tolerant_isinstance",
            "specs": []
        }
    ],
    "lcname": "mehrlist"
}
        
Elapsed time: 0.35074s