MCPcopy Create free account
hub / github.com/FreedomGu/Diffportrait360 / split

Function split

diffportrait360_release/code/utils/utils.py:45–56  ·  view source on GitHub ↗
(lst, split_nbr)

Source from the content-addressed store, hash-verified

43
44
45def split(lst, split_nbr):
46 div = len(lst) // split_nbr
47 rest = len(lst) % split_nbr
48 results = []
49 start, end = 0, div
50 while start < len(lst):
51 if rest >= 1:
52 end += 1
53 rest -= 1
54 results.append(lst[start:end])
55 start, end = end, end+div
56 return results
57
58def chunk(iterable, chunk_size):
59 ret = []

Callers

nothing calls this directly

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected