#NEWLINE# def readline( self , size = ( - 1 ) ) : #NEWLINE# #INDENT# self . _close_check ( ) #NEWLINE# while ( ( b'\n' not in self . buf ) and ( ( size < 0 ) or ( len ( self . buf ) < size ) ) ) : #NEWLINE# #INDENT# if ( size < 0 ) : #NEWLINE# #INDENT# chunk = self . read ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# chunk = self . read ( ( size - len ( self . buf ) ) ) #NEWLINE# #UNINDENT# if ( not chunk ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# self . buf += chunk #NEWLINE# #UNINDENT# ( data , sep , rest ) = self . buf . partition ( b'\n' ) #NEWLINE# data += sep #NEWLINE# self . buf = rest #NEWLINE# if ( ( size >= 0 ) and ( len ( data ) > size ) ) : #NEWLINE# #INDENT# self . buf = ( data [ size : ] + self . buf ) #NEWLINE# data = data [ : size ] #NEWLINE# #UNINDENT# return data