MCPcopy Index your code
hub / github.com/huggingface/diffusers / ContextManagers

Class ContextManagers

src/diffusers/models/modeling_utils.py:80–95  ·  view source on GitHub ↗

Wrapper for `contextlib.ExitStack` which enters a collection of context managers. Adaptation of `ContextManagers` in the `fastcore` library.

Source from the content-addressed store, hash-verified

78
79
80class ContextManagers:
81 """
82 Wrapper for `contextlib.ExitStack` which enters a collection of context managers. Adaptation of `ContextManagers`
83 in the `fastcore` library.
84 """
85
86 def __init__(self, context_managers: list[ContextManager]):
87 self.context_managers = context_managers
88 self.stack = ExitStack()
89
90 def __enter__(self):
91 for context_manager in self.context_managers:
92 self.stack.enter_context(context_manager)
93
94 def __exit__(self, *args, **kwargs):
95 self.stack.__exit__(*args, **kwargs)
96
97
98logger = logging.get_logger(__name__)

Callers 8

mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
mainFunction · 0.90
from_pretrainedMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…