#NEWLINE# def get_example_tree( ) : #NEWLINE# #INDENT# ' generate a quick 100 leaf tree for demo purposes ' #NEWLINE# f = open ( 'comments.data' , 'r' ) . read ( ) #NEWLINE# info = json . loads ( s ) [ 0 ] #NEWLINE# s = ( '%s %s\n%s\n' % ( info [ 'username' ] , info [ 'time' ] , info [ 'comment' ] ) ) #NEWLINE# retval = { #NEWLINE# #INDENT# 'name' : s , #NEWLINE# 'children' : [ ] , #NEWLINE# #UNINDENT# } #NEWLINE# for i in range ( len ( info [ 'children' ] ) ) : #NEWLINE# #INDENT# l = get_example_tree_recursion ( info [ 'children' ] [ i ] ) #NEWLINE# retval [ 'children' ] . append ( l ) #NEWLINE# #UNINDENT# return retval