mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 21:32:15 +01:00
hound
This commit is contained in:
parent
4e005bfd57
commit
7dc19ec759
1 changed files with 5 additions and 2 deletions
|
|
@ -5,7 +5,9 @@ if getattr(contextlib, "nested", None):
|
|||
else:
|
||||
import sys
|
||||
from collections import deque
|
||||
class ExitStack(object)
|
||||
|
||||
class ExitStack(object):
|
||||
|
||||
"""Context manager for dynamic management of a stack of exit callbacks
|
||||
|
||||
For example:
|
||||
|
|
@ -22,7 +24,8 @@ else:
|
|||
self._exit_callbacks = deque()
|
||||
|
||||
def pop_all(self):
|
||||
"""Preserve the context stack by transferring it to a new instance"""
|
||||
"""Preserve the context stack by transferring
|
||||
it to a new instance"""
|
||||
new_stack = type(self)()
|
||||
new_stack._exit_callbacks = self._exit_callbacks
|
||||
self._exit_callbacks = deque()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue