(self)
Flush the current output file.
Flush the current output file.
Flush the current output file .
def EndFile(self):
    """Flush the current output file."""
    if self._current_file_data:
      data = self._current_file_data.getvalue()
      self._current_file_data.close()
      self._current_file_data = None
      # File contents may be utf-8
      if not isinstance(data, bytes):
        data = data.encode('utf-8')
      # Replace CRLF with LF because in the C# .xml files, some have CRLF but
      # others do not. This causes confusion because depending on how you do
      # a diff on golden output, you get either a change or not.
      self._files[self._current_file_name] = data.replace('\r\n', '\n')
def EndFile ( self ) : if self . _current_file_data : data = self . _current_file_data . getvalue ( ) self . _current_file_data . close ( ) self . _current_file_data = None # File contents may be utf-8 if not isinstance ( data , bytes ) : data = data . encode ( 'utf-8' ) # Replace CRLF with LF because in the C# .xml files, some have CRLF but # others do not. This causes confusion because depending on how you do # a diff on golden output, you get either a change or not. self . _files [ self . _current_file_name ] = data . replace ( '\r\n' , '\n' )