#NEWLINE# def _write_source( self , file = None ) : #NEWLINE# #INDENT# if ( file is not None ) : #NEWLINE# #INDENT# self . _write_source_to ( file ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# f = NativeIO ( ) #NEWLINE# self . _write_source_to ( f ) #NEWLINE# source_data = f . getvalue ( ) #NEWLINE# if os . path . exists ( self . sourcefilename ) : #NEWLINE# #INDENT# with open ( self . sourcefilename , 'r' ) as fp : #NEWLINE# #INDENT# needs_written = ( not ( fp . read ( ) == source_data ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# needs_written = True #NEWLINE# #UNINDENT# if needs_written : #NEWLINE# #INDENT# _ensure_dir ( self . sourcefilename ) #NEWLINE# with open ( self . sourcefilename , 'w' ) as fp : #NEWLINE# #INDENT# fp . write ( source_data ) #NEWLINE# #UNINDENT# #UNINDENT# self . _has_source = True