Lines Matching refs:ExitStack
273 .. class:: ExitStack()
282 with ExitStack() as stack:
351 Transfers the callback stack to a fresh :class:`ExitStack` instance
359 with ExitStack() as stack:
386 The primary use case for :class:`ExitStack` is the one given in the class
393 with ExitStack() as stack:
401 As shown, :class:`ExitStack` also makes it quite easy to use :keyword:`with`
409 In the specific case of a single optional context manager, :class:`ExitStack`
418 return ExitStack()
430 method. By using :class:`ExitStack` the steps in the context management
433 stack = ExitStack()
446 only resource management API provided, then :class:`ExitStack` can make it
454 As noted in the documentation of :meth:`ExitStack.push`, this
462 from contextlib import contextmanager, AbstractContextManager, ExitStack
476 with ExitStack() as stack:
518 :class:`ExitStack` makes it possible to instead register a callback for
522 from contextlib import ExitStack
524 with ExitStack() as stack:
536 from contextlib import ExitStack
538 class Callback(ExitStack):
553 :meth:`ExitStack.callback` to declare the resource cleanup in
556 from contextlib import ExitStack
558 with ExitStack() as stack:
722 :class:`ExitStack`, as it invokes *all* currently registered callbacks
726 >>> from contextlib import ExitStack
727 >>> stack = ExitStack()
757 Using separate :class:`ExitStack` instances instead of reusing a single
760 >>> from contextlib import ExitStack
761 >>> with ExitStack() as outer_stack:
763 ... with ExitStack() as inner_stack: