(data_sources, query, start, size)
return total, options
Returns the appropriate slice of values from the data sources
    data_sources is a list of (count_fn, getter_fn) tuples
        count_fn returns the total number of entries in a data source,
        getter_fn takes in a start and size parameter and returns entries
Returns the appropriate slice of values from the data sources
    data_sources is a list of (count_fn, getter_fn) tuples
        count_fn returns the total number of entries in a data source,
        getter_fn takes in a start and size parameter and returns entries
Returns the appropriate slice of values from the data sources data_sources is a list of ( count_fn getter_fn ) tuples count_fn returns the total number of entries in a data source getter_fn takes in a start and size parameter and returns entries
def paginate_options(data_sources, query, start, size):
    """
    Returns the appropriate slice of values from the data sources
    data_sources is a list of (count_fn, getter_fn) tuples
        count_fn returns the total number of entries in a data source,
        getter_fn takes in a start and size parameter and returns entries
    """
    # Note this is pretty confusing, check TestEmwfPagination for reference
    options = []
    total = 0
    for get_size, get_objects in data_sources:
        count = get_size(query)
        total += count

        if start > count:  # skip over this whole data source
            start -= count
            continue

        # return a page of objects
        objects = list(get_objects(query, start, size))
        start = 0
        size -= len(objects)  # how many more do we need for this page?
        options.extend(objects)
    return total, options
def paginate_options ( data_sources , query , start , size ) : # Note this is pretty confusing, check TestEmwfPagination for reference options = [ ] total = 0 for get_size , get_objects in data_sources : count = get_size ( query ) total += count if start > count : # skip over this whole data source start -= count continue # return a page of objects objects = list ( get_objects ( query , start , size ) ) start = 0 size -= len ( objects ) # how many more do we need for this page? options . extend ( objects ) return total , options