MCPcopy Create free account
hub / github.com/dagger/dagger / SyncResource

Class SyncResource

sdk/python/src/dagger/_managers.py:34–44  ·  view source on GitHub ↗

Wrap a blocking sync context manager in a non-blocking async context manager.

Source from the content-addressed store, hash-verified

32
33
34class SyncResource(contextlib.AbstractAsyncContextManager[T], typing.Generic[T]):
35 """Wrap a blocking sync context manager in a non-blocking async context manager."""
36
37 def __init__(self, cm: typing.ContextManager[T]):
38 self.sync_cm = cm
39
40 async def __aenter__(self) -> T:
41 return await asyncify(self.sync_cm.__enter__)
42
43 async def __aexit__(self, *exc_details) -> None:
44 await asyncify(self.sync_cm.__exit__, *exc_details)

Callers 1

start_cli_sessionFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected