Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(6)  |  Call(3)  |  Derive(0)  |  Import(3)
ABCDE -> (A, B), (C, D), (E, None)

        def group_in_packets_fill_last(iterable, packet_size, fillvalue=None):
    'ABCDE -> (A, B), (C, D), (E, None)'
    # It is faster than group_in_packets
    iterables = [iter(iterable)] * packet_size
    kwargs = {'fillvalue': fillvalue}
    return izip_longest(*iterables, **kwargs)
        


src/s/e/seq_crumbs-HEAD/crumbs/pairs.py   seq_crumbs(Download)
from crumbs.utils.tags import FWD, REV
from crumbs.utils.file_utils import flush_fhand
from crumbs.iterutils import sorted_items, group_in_packets_fill_last
from crumbs.collectionz import KeyedSet
 
 
    if n_seqs_in_pair:
        pairs = group_in_packets_fill_last(seqs, packet_size=n_seqs_in_pair)
        for pair in pairs:
            pair = filter(lambda seq: seq is not None, pair)

src/s/e/seq_crumbs-HEAD/crumbs/seqio.py   seq_crumbs(Download)
                               UnknownFormatError, IncompatibleFormatError,
                               FileIsEmptyError, IsSingleLineFastqError)
from crumbs.iterutils import group_in_packets, group_in_packets_fill_last
from crumbs.utils.file_utils import rel_symlink, flush_fhand
from crumbs.utils.file_formats import get_format, peek_chunk_from_file
def _itemize_fastq_singleline(fhand):
    'It returns the fhand divided in chunks, one per seq'
    # group_in_packets_fill_last is faster than group_in_packets
    blobs = group_in_packets_fill_last(ifilter(_line_is_not_empty, fhand), 4)
    return (SeqItem(_get_name_from_lines(lines), lines) for lines in blobs)

src/s/e/seq_crumbs-HEAD/test/test_iterutils.py   seq_crumbs(Download)
import tempfile
 
from crumbs.iterutils import (sample, sample_low_mem, length, group_in_packets,
                              rolling_window, group_in_packets_fill_last,
                              sorted_items, unique, unique_unordered)
        assert packets == [(0, 1), (2, 3), (4,)]
 
        packets = list(group_in_packets_fill_last(range(5), 2))
        assert packets == [(0, 1), (2, 3), (4, None)]