#NEWLINE# def readline( self , n = None ) : #NEWLINE# #INDENT# buffer = [ ] #NEWLINE# while 1 : #NEWLINE# #INDENT# ch = self . read ( 1 ) #NEWLINE# if ( len ( self ) == 0 ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# if ( ( ch == '\n' ) or ( ch == '\r' ) ) : #NEWLINE# #INDENT# if ( self . latest == '\r' ) : #NEWLINE# #INDENT# self . latest = '' #NEWLINE# continue #NEWLINE# #UNINDENT# buffer . append ( '\n' ) #NEWLINE# break #NEWLINE# #UNINDENT# if ( ( ch == '\x7f' ) or ( ch == '\x08' ) ) : #NEWLINE# #INDENT# del buffer [ ( - 1 ) : ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# buffer . append ( ch ) #NEWLINE# #UNINDENT# if ( n and ( len ( buffer ) >= n ) ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# self . latest = ch #NEWLINE# return '' . join ( buffer )