You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Test to see if this version of chunk_on has mo powah than the previous version using deques.
# -*- coding: utf-8 -*-# @Author: Cody Kochmannfromitertoolsimportgroupby, chaindefchunk_on(pipeline, new_chunk_signal, output_type=tuple):
''' split the stream into seperate chunks based on a new chunk signal '''assertcallable(new_chunk_signal), 'chunks needs new_chunk_signal to be callable'assertcallable(output_type), 'chunks needs output_type to be callable'holder=Noneforsignal, groupingroupby(pipeline, new_chunk_signal):
ifsignal:
foriingroup:
holder= [i]
breakforiingroup:
yieldoutput_type(holder)
holder= [i]
else:
ifholderisNone:
yieldoutput_type(group)
else:
yieldoutput_type(chain(holder, group))
holder=Noneifholder:
yieldoutput_type(holder)
The text was updated successfully, but these errors were encountered:
# -*- coding: utf-8 -*-# @Author: Cody Kochmannfromitertoolsimportgroupby, chaindefchunk_on(pipeline, new_chunk_signal, output_type=tuple):
''' split the stream into seperate chunks based on a new chunk signal '''assertcallable(new_chunk_signal), 'chunks needs new_chunk_signal to be callable'assertcallable(output_type), 'chunks needs output_type to be callable'holder= []
forsignal, groupingroupby(pipeline, new_chunk_signal):
ifsignal:
foriingroup:
holder= [i]
breakforiingroup:
yieldoutput_type(holder)
holder= [i]
else:
yieldoutput_type(
chain(
holder,
group
)
)
holder= []
ifholder:
yieldoutput_type(holder)
Test to see if this version of
chunk_on
has mo powah than the previous version using deques.The text was updated successfully, but these errors were encountered: