#NEWLINE# @ staticmethod #NEWLINE# def _normalize_data_whitespace( data , prev_was_py , next_is_py ) : #NEWLINE# #INDENT# if ( not prev_was_py ) : #NEWLINE# #INDENT# return '' #NEWLINE# #UNINDENT# if ( ( '\n' in data ) and ( not data . strip ( ) ) ) : #NEWLINE# #INDENT# if ( prev_was_py and next_is_py ) : #NEWLINE# #INDENT# return ' ' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return '' #NEWLINE# #UNINDENT# #UNINDENT# if ( prev_was_py and data . startswith ( '\n' ) ) : #NEWLINE# #INDENT# data = ( ' ' + data . lstrip ( '\n' ) ) #NEWLINE# #UNINDENT# if ( next_is_py and data . endswith ( '\n' ) ) : #NEWLINE# #INDENT# data = ( data . rstrip ( '\n' ) + ' ' ) #NEWLINE# #UNINDENT# data = data . strip ( '\n' ) #NEWLINE# data = data . replace ( '\r' , ' ' ) #NEWLINE# data = data . replace ( '\n' , ' ' ) #NEWLINE# return data