MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / chunkIt

Function chunkIt

src/pyOpenMS/create_cpp_extension.py:91–101  ·  view source on GitHub ↗
(seq, num)

Source from the content-addressed store, hash-verified

89 autowrap.DeclResolver.default_namespace = "OpenMS"
90
91 def chunkIt(seq, num):
92 avg = len(seq) / float(num)
93 out = []
94 last = 0.0
95 while len(out) < num:
96 out.append(seq[int(last):int(last + avg)])
97 last += avg
98
99 # append the rest to the last element (if there is any)
100 out[-1].extend( seq[int(last):] )
101 return out
102
103 j = os.path.join
104

Callers 1

Calls 2

extendMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected