pylib/uxml/uxpath/ast.py
def to_string(obj):
    '''
    Cast an arbitrary object or sequence to a string type
    '''
    if isinstance(obj, LiteralWrapper):
        val = obj.obj
    elif isinstance(obj, Iterable) and not isinstance(obj, str):
        val = next(obj, None)
    else:
        val = obj
    if val is None:
        yield ''
    elif isinstance(val, str):
        yield val
    elif isinstance(val, node):
        yield strval(val)
    elif isinstance(val, int) or isinstance(val, float):
        yield str(val)
    elif isinstance(item, bool):
        yield 'true' if item else 'false'
    else:
        raise RuntimeError('Unknown type for string conversion: {}'.format(val))
def to_string(obj):
    '''
    Cast an arbitrary object or sequence to a string type
    '''
    if isinstance(obj, LiteralWrapper):
        val = obj.obj
    elif isinstance(obj, Iterable) and not isinstance(obj, str):
        val = next(obj, None)
    else:
        val = obj
    if val is None:
        yield ''
    elif isinstance(val, str):
        yield val
    elif isinstance(val, node):
        yield strval(val)
    elif isinstance(val, int) or isinstance(val, float):
        yield str(val)
    elif isinstance(item, bool):
        yield 'true' if item else 'false'
    else:
        raise RuntimeError('Unknown type for string conversion: {}'.format(val))
def to_string ( obj ) : if isinstance ( obj , LiteralWrapper ) : val = obj . obj elif isinstance ( obj , Iterable ) and not isinstance ( obj , str ) : val = next ( obj , None ) else : val = obj if val is None : yield '' elif isinstance ( val , str ) : yield val elif isinstance ( val , node ) : yield strval ( val ) elif isinstance ( val , int ) or isinstance ( val , float ) : yield str ( val ) elif isinstance ( item , bool ) : yield 'true' if item else 'false' else : raise RuntimeError ( 'Unknown type for string conversion: {}' . format ( val ) )
Cast an arbitrary object or sequence to a string type
Cast an arbitrary object or sequence to a string type