pylib/uxml/uxpath/functions.py
def foreach_(ctx, seq, expr):
    '''
    Yields the result of applying an expression to each item in the input sequence.

    * seq: input sequence
    * expr: expression to be converted to string, then dynamically evaluated for each item on the sequence to produce the result
    '''
    from . import context, parse as uxpathparse

    if hasattr(seq, 'compute'):
        seq = seq.compute(ctx)

    expr = next(string_arg(ctx, expr), '')

    pexpr = uxpathparse(expr)
    for item in seq:
        innerctx = ctx.copy(item=item)
        yield from pexpr.compute(innerctx)
def foreach_(ctx, seq, expr):
    '''
    Yields the result of applying an expression to each item in the input sequence.

    * seq: input sequence
    * expr: expression to be converted to string, then dynamically evaluated for each item on the sequence to produce the result
    '''
    from . import context, parse as uxpathparse

    if hasattr(seq, 'compute'):
        seq = seq.compute(ctx)

    expr = next(string_arg(ctx, expr), '')

    pexpr = uxpathparse(expr)
    for item in seq:
        innerctx = ctx.copy(item=item)
        yield from pexpr.compute(innerctx)
def foreach_ ( ctx , seq , expr ) : from . import context , parse as uxpathparse if hasattr ( seq , 'compute' ) : seq = seq . compute ( ctx ) expr = next ( string_arg ( ctx , expr ) , '' ) pexpr = uxpathparse ( expr ) for item in seq : innerctx = ctx . copy ( item = item ) yield from pexpr . compute ( innerctx )
Yields the result of applying an expression to each item in the input sequence.

    * seq: input sequence
    * expr: expression to be converted to string, then dynamically evaluated for each item on the sequence to produce the result
Yields the result of applying an expression to each item in the input sequence .