#NEWLINE# def traverse_data( value , f = check_err_and_placeholders , initial = ( None , False ) , seen = frozenset ( ) , make_list = True ) : #NEWLINE# #INDENT# if is_result_proxy ( value ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# wait ( value ) #NEWLINE# #UNINDENT# except TaskError : #NEWLINE# #INDENT# return ( value , f ( initial , value ) ) #NEWLINE# #UNINDENT# except SuspendTask : #NEWLINE# #INDENT# return ( value , f ( initial , value ) ) #NEWLINE# #UNINDENT# return ( value . __wrapped__ , f ( initial , value ) ) #NEWLINE# #UNINDENT# if isinstance ( value , ( bytes , uni ) ) : #NEWLINE# #INDENT# return ( value , f ( initial , value ) ) #NEWLINE# #UNINDENT# res = initial #NEWLINE# if isinstance ( value , collections . Iterable ) : #NEWLINE# #INDENT# if ( id ( value ) in seen ) : #NEWLINE# #INDENT# raise ValueError ( 'Recursive structure.' ) #NEWLINE# #UNINDENT# seen = ( seen | frozenset ( [ id ( value ) ] ) ) #NEWLINE# #UNINDENT# if isinstance ( value , collections . Mapping ) : #NEWLINE# #INDENT# d = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for ( k , v ) in value . items ( ) : #NEWLINE# #INDENT# ( k_ , res ) = traverse_data ( k , f , res , seen , make_list = False ) #NEWLINE# ( v_ , res ) = traverse_data ( v , f , res , seen , make_list = make_list ) #NEWLINE# d [ k_ ] = v_ #NEWLINE# #UNINDENT# return ( d , res ) #NEWLINE# #UNINDENT# if ( isinstance ( value , collections . Iterable ) and isinstance ( value , collections . Sized ) ) : #NEWLINE# #INDENT# l = [ ] #NEWLINE# for x in value : #NEWLINE# #INDENT# ( x_ , res ) = traverse_data ( x , f , res , seen , make_list = make_list ) #NEWLINE# l . append ( x_ ) #NEWLINE# #UNINDENT# if make_list : #NEWLINE# #INDENT# return ( l , res ) #NEWLINE# #UNINDENT# return ( tuple ( l ) , res ) #NEWLINE# #UNINDENT# if isinstance ( value , collections . Iterable ) : #NEWLINE# #INDENT# raise ValueError ( 'Unsized iterables not allowed.' ) #NEWLINE# #UNINDENT# return ( value , f ( initial , value ) )