def batches(files, n=100, stride=1):
    """
    Yield successive n-sized batches from `files`.

    >>> list(batches([1, 2, 3, 4, 5, 6, 7, 8, 9]))
    [[1, 2, 3, 4, 5, 6, 7, 8, 9]]
    >>> list(batches([1, 2, 3, 4, 5, 6, 7, 8, 9], n=2))
    [[1, 2], [3, 4], [5, 6], [7, 8], [9]]
    >>> list(batches([1, 2, 3, 4, 5, 6, 7, 8, 9], n=3))
    [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
    """
    for i in range(0, len(files), n):
        yield files[i:i + n]
