MCPcopy Create free account
hub / github.com/EasyIME/PIME / close

Method close

python/python3/tornado/iostream.py:567–613  ·  view source on GitHub ↗

Close this stream. If ``exc_info`` is true, set the ``error`` attribute to the current exception from `sys.exc_info` (or if ``exc_info`` is a tuple, use that instead of `sys.exc_info`).

(
        self,
        exc_info: Union[
            None,
            bool,
            BaseException,
            Tuple[
                "Optional[Type[BaseException]]",
                Optional[BaseException],
                Optional[TracebackType],
            ],
        ] = False,
    )

Source from the content-addressed store, hash-verified

565 self._maybe_add_error_listener()
566
567 def close(
568 self,
569 exc_info: Union[
570 None,
571 bool,
572 BaseException,
573 Tuple[
574 "Optional[Type[BaseException]]",
575 Optional[BaseException],
576 Optional[TracebackType],
577 ],
578 ] = False,
579 ) -> None:
580 """Close this stream.
581
582 If ``exc_info`` is true, set the ``error`` attribute to the current
583 exception from `sys.exc_info` (or if ``exc_info`` is a tuple,
584 use that instead of `sys.exc_info`).
585 """
586 if not self.closed():
587 if exc_info:
588 if isinstance(exc_info, tuple):
589 self.error = exc_info[1]
590 elif isinstance(exc_info, BaseException):
591 self.error = exc_info
592 else:
593 exc_info = sys.exc_info()
594 if any(exc_info):
595 self.error = exc_info[1]
596 if self._read_until_close:
597 self._read_until_close = False
598 self._finish_read(self._read_buffer_size)
599 elif self._read_future is not None:
600 # resolve reads that are pending and ready to complete
601 try:
602 pos = self._find_read_pos()
603 except UnsatisfiableReadError:
604 pass
605 else:
606 if pos is not None:
607 self._read_from_buffer(pos)
608 if self._state is not None:
609 self.io_loop.remove_handler(self.fileno())
610 self._state = None
611 self.close_fd()
612 self._closed = True
613 self._signal_closed()
614
615 def _signal_closed(self) -> None:
616 futures = [] # type: List[Future]

Callers 12

read_until_regexMethod · 0.95
read_untilMethod · 0.95
_handle_eventsMethod · 0.95
_handle_readMethod · 0.95
_read_to_bufferMethod · 0.95
_handle_writeMethod · 0.95
close_fdMethod · 0.45
connectMethod · 0.45
_handle_connectMethod · 0.45
_do_ssl_handshakeMethod · 0.45
close_fdMethod · 0.45
read_from_fdMethod · 0.45

Calls 8

closedMethod · 0.95
_finish_readMethod · 0.95
_find_read_posMethod · 0.95
_read_from_bufferMethod · 0.95
filenoMethod · 0.95
close_fdMethod · 0.95
_signal_closedMethod · 0.95
remove_handlerMethod · 0.45

Tested by

no test coverage detected