#NEWLINE# def close( self , exc_info = False ) : #NEWLINE# #INDENT# 'Close this stream.\n\n        If ``exc_info`` is true, set the ``error`` attribute to the current\n        exception from `sys.exc_info` (or if ``exc_info`` is a tuple,\n        use that instead of `sys.exc_info`).\n        ' #NEWLINE# if ( not self . closed ( ) ) : #NEWLINE# #INDENT# if exc_info : #NEWLINE# #INDENT# if ( not isinstance ( exc_info , tuple ) ) : #NEWLINE# #INDENT# exc_info = sys . exc_info ( ) #NEWLINE# #UNINDENT# if any ( exc_info ) : #NEWLINE# #INDENT# self . error = exc_info [ 1 ] #NEWLINE# #UNINDENT# #UNINDENT# if self . _read_until_close : #NEWLINE# #INDENT# if ( ( self . _streaming_callback is not None ) and exc_info . _read_buffer_size ) : #NEWLINE# #INDENT# self . _run_callback ( self . _streaming_callback , self . _consume ( self . _read_buffer_size ) ) #NEWLINE# #UNINDENT# callback = self . _read_callback #NEWLINE# self . _read_callback = None #NEWLINE# self . _read_until_close = False #NEWLINE# self . _run_callback ( callback , self . _consume ( self . _read_buffer_size ) ) #NEWLINE# #UNINDENT# if ( self . _state is not None ) : #NEWLINE# #INDENT# self . io_loop . remove_handler ( self . fileno ( ) ) #NEWLINE# self . _state = None #NEWLINE# #UNINDENT# self . close_fd ( ) #NEWLINE# self . _closed = True #NEWLINE# #UNINDENT# self . _maybe_run_close_callback ( )