xtuml/meta.py
def apply_query_operators(iterable, ops):
    '''
    Apply a series of query operators to a sequence of instances, e.g.
    where_eq(), order_by() or filter functions.
    '''
    for op in ops:
        if isinstance(op, WhereEqual):
            iterable = op(iterable)
            
        elif isinstance(op, OrderBy):
            iterable = op(iterable)
            
        elif isinstance(op, dict):
            iterable = WhereEqual(op)(iterable)
            
        else:
            iterable = filter(op, iterable)

    return iterable
def apply_query_operators(iterable, ops):
    '''
    Apply a series of query operators to a sequence of instances, e.g.
    where_eq(), order_by() or filter functions.
    '''
    for op in ops:
        if isinstance(op, WhereEqual):
            iterable = op(iterable)
            
        elif isinstance(op, OrderBy):
            iterable = op(iterable)
            
        elif isinstance(op, dict):
            iterable = WhereEqual(op)(iterable)
            
        else:
            iterable = filter(op, iterable)

    return iterable
Apply a series of query operators to a sequence of instances, e.g.
    where_eq(), order_by() or filter functions.