Spaces:
Running
Running
Download tests/runtime/catalog_support.py from dherain24/claude-proxy: direct link, hf CLI and curl.
- Browser
- Download file 1.1 kB
-
https://huggingface.co/spaces/dherain24/claude-proxy/resolve/main/tests/runtime/catalog_support.py
- Command line
-
hf download hf://spaces/dherain24/claude-proxy/tests/runtime/catalog_support.py
-
curl -L -o catalog_support.py https://huggingface.co/spaces/dherain24/claude-proxy/resolve/main/tests/runtime/catalog_support.py
1.1 kB
| """Wait for owned work in tests without imposing it on catalog consumers.""" | |
| import asyncio | |
| from contextlib import asynccontextmanager | |
| from free_claude_code.core.async_rwlock import AsyncReadWriteLock | |
| from free_claude_code.runtime.provider_manager import ProviderRuntimeManager | |
| async def finish_discovery(manager: ProviderRuntimeManager) -> None: | |
| await manager._start_pass(manager._current) | |
| async def finish_publication(manager: ProviderRuntimeManager) -> None: | |
| task = manager._publication_task | |
| if task is not None: | |
| await task | |
| def pause_next_write(monkeypatch, lock: AsyncReadWriteLock): | |
| """Pause one operation before ownership, allowing a later action to overtake it.""" | |
| entered, release = asyncio.Event(), asyncio.Event() | |
| original = lock.write | |
| first = True | |
| async def held(): | |
| nonlocal first | |
| if first: | |
| first = False | |
| entered.set() | |
| await release.wait() | |
| async with original(): | |
| yield | |
| monkeypatch.setattr(lock, "write", held) | |
| return entered, release | |