diff options
author | Alexander_Kabui | 2024-01-02 13:21:07 +0300 |
---|---|---|
committer | Alexander_Kabui | 2024-01-02 13:21:07 +0300 |
commit | 70c4201b332e0e2c0d958428086512f291469b87 (patch) | |
tree | aea4fac8782c110fc233c589c3f0f7bd34bada6c /wqflask/utility/chunks.py | |
parent | 5092eb42f062b1695c4e39619f0bd74a876cfac2 (diff) | |
parent | 965ce5114d585624d5edb082c710b83d83a3be40 (diff) | |
download | genenetwork2-70c4201b332e0e2c0d958428086512f291469b87.tar.gz |
merge changes
Diffstat (limited to 'wqflask/utility/chunks.py')
-rw-r--r-- | wqflask/utility/chunks.py | 30 |
1 files changed, 0 insertions, 30 deletions
diff --git a/wqflask/utility/chunks.py b/wqflask/utility/chunks.py deleted file mode 100644 index f6e88cbe..00000000 --- a/wqflask/utility/chunks.py +++ /dev/null @@ -1,30 +0,0 @@ -import math - - -def divide_into_chunks(the_list, number_chunks): - """Divides a list into approximately number_chunks smaller lists - - >>> divide_into_chunks([1, 2, 7, 3, 22, 8, 5, 22, 333], 3) - [[1, 2, 7], [3, 22, 8], [5, 22, 333]] - >>> divide_into_chunks([1, 2, 7, 3, 22, 8, 5, 22, 333], 4) - [[1, 2, 7], [3, 22, 8], [5, 22, 333]] - >>> divide_into_chunks([1, 2, 7, 3, 22, 8, 5, 22, 333], 5) - [[1, 2], [7, 3], [22, 8], [5, 22], [333]] - >>> - - """ - length = len(the_list) - - if length == 0: - return [[]] - - if length <= number_chunks: - number_chunks = length - - chunksize = int(math.ceil(length / number_chunks)) - - chunks = [] - for counter in range(0, length, chunksize): - chunks.append(the_list[counter:counter + chunksize]) - - return chunks |