Did I find the right examples for you? yes no

All Samples(6)  |  Call(5)  |  Derive(0)  |  Import(1)
walks over a sequence, returns a sequence of windowed views of
the sequence, with window size n (defaults to one), and stride s
(defaults to n)

        def window(seq, n=1, s=None):
    """walks over a sequence, returns a sequence of windowed views of
    the sequence, with window size n (defaults to one), and stride s
    (defaults to n)"""

    i = iter(seq)

    if s is None:
        s = n

    b = []
    try:
        for _ in xrange(n):
            b.append(i.next())
    except StopIteration:
        pass
    while True:
        yield b[:]
        try:
            for _ in range(s):
                b.append(i.next())
        except StopIteration:
            del b[:s]
            break
        del b[:s]
    if len(b):
        yield b[:]
        raise StopIteration()
        


src/r/s/rsarm-0.9/rsarm/rsarm.py   rsarm(Download)
import reedsolomon
 
from .utils import read_stream, window
 
def chunkify(s, l=32):
 
    did_padding = False
    for w in map(''.join, window(s, l, l)):
        if not len(w)==l:
            yield padded(w, l)
    for lnum, chunk in enumerate(chunkify(i, l)):
        echunk = codec.encode(chunk)
        l = ("".join(c) for c in window(("%02x" % c for c in echunk), 3))
        l1 = (" ".join(c) for c in window(l, 2))
        l2 = "   ".join(l1)
    ochunks = []
 
    for line, echunk in enumerate(window(ifilter(hexchars.__contains__, i), n*2)):
        hexdigits = [int("".join(c), 16) for c in window(echunk, 2)]
        try: