#NEWLINE# def visit_Assign( self , node , frame ) : #NEWLINE# #INDENT# self . newline ( node ) #NEWLINE# if frame . toplevel : #NEWLINE# #INDENT# assignment_frame = frame . copy ( ) #NEWLINE# assignment_frame . toplevel_assignments = set ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# assignment_frame = frame #NEWLINE# #UNINDENT# self . visit ( node . target , assignment_frame ) #NEWLINE# self . write ( ' = ' ) #NEWLINE# self . visit ( node . node , frame ) #NEWLINE# if frame . toplevel : #NEWLINE# #INDENT# public_names = [ x for x in assignment_frame . toplevel_assignments if ( not x . startswith ( '_' ) ) ] #NEWLINE# if ( len ( assignment_frame . toplevel_assignments ) == 1 ) : #NEWLINE# #INDENT# name = next ( iter ( assignment_frame . toplevel_assignments ) ) #NEWLINE# self . writeline ( ( 'context.vars[%r] = l_%s' % ( name , name ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . writeline ( 'context.vars.update({' ) #NEWLINE# for ( idx , name ) in enumerate ( assignment_frame . toplevel_assignments ) : #NEWLINE# #INDENT# if idx : #NEWLINE# #INDENT# self . write ( ', ' ) #NEWLINE# #UNINDENT# self . write ( ( '%r: l_%s' % ( public_names , name ) ) ) #NEWLINE# #UNINDENT# self . write ( '})' ) #NEWLINE# #UNINDENT# if public_names : #NEWLINE# #INDENT# if ( len ( public_names ) == 1 ) : #NEWLINE# #INDENT# self . writeline ( ( 'context.exported_vars.add(%r)' % public_names [ 0 ] ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . writeline ( ( 'context.exported_vars.update((%s))' % ', ' . join ( imap ( repr , public_names ) ) ) )