Spaces:
Running
Running
sync: upstream 9194f15 + custom addons (KeyRotator, RotatingChatTransport, sol/terra/luna, ScannerTrap, health, Py3.12 compat)
e99df76 Download src/free_claude_code/providers/github_copilot/lifecycle.py from dherain24/claude-proxy: direct link, hf CLI and curl.
- Browser
- Download file 502 Bytes
-
https://huggingface.co/spaces/dherain24/claude-proxy/resolve/main/src/free_claude_code/providers/github_copilot/lifecycle.py
- Command line
-
hf download hf://spaces/dherain24/claude-proxy/src/free_claude_code/providers/github_copilot/lifecycle.py
-
curl -L -o lifecycle.py https://huggingface.co/spaces/dherain24/claude-proxy/resolve/main/src/free_claude_code/providers/github_copilot/lifecycle.py
502 Bytes
| from __future__ import annotations | |
| """Drain Copilot-owned work before propagating caller cancellation.""" | |
| import asyncio | |
| async def drain_owned[T](task: asyncio.Task[T]) -> T: | |
| cancelled = False | |
| while not task.done(): | |
| try: | |
| await asyncio.shield(task) | |
| except asyncio.CancelledError: | |
| if task.cancelled(): | |
| raise | |
| cancelled = True | |
| result = task.result() | |
| if cancelled: | |
| raise asyncio.CancelledError | |
| return result | |