[Update misc_util.py]: clean up unused helper functions (#751)
* Update misc_util.py * Update misc_util.py
This commit is contained in:
@@ -13,27 +13,6 @@ def zipsame(*seqs):
|
|||||||
return zip(*seqs)
|
return zip(*seqs)
|
||||||
|
|
||||||
|
|
||||||
def unpack(seq, sizes):
|
|
||||||
"""
|
|
||||||
Unpack 'seq' into a sequence of lists, with lengths specified by 'sizes'.
|
|
||||||
None = just one bare element, not a list
|
|
||||||
|
|
||||||
Example:
|
|
||||||
unpack([1,2,3,4,5,6], [3,None,2]) -> ([1,2,3], 4, [5,6])
|
|
||||||
"""
|
|
||||||
seq = list(seq)
|
|
||||||
it = iter(seq)
|
|
||||||
assert sum(1 if s is None else s for s in sizes) == len(seq), "Trying to unpack %s into %s" % (seq, sizes)
|
|
||||||
for size in sizes:
|
|
||||||
if size is None:
|
|
||||||
yield it.__next__()
|
|
||||||
else:
|
|
||||||
li = []
|
|
||||||
for _ in range(size):
|
|
||||||
li.append(it.__next__())
|
|
||||||
yield li
|
|
||||||
|
|
||||||
|
|
||||||
class EzPickle(object):
|
class EzPickle(object):
|
||||||
"""Objects that are pickled and unpickled via their constructor
|
"""Objects that are pickled and unpickled via their constructor
|
||||||
arguments.
|
arguments.
|
||||||
|
Reference in New Issue
Block a user