Download lam2/lib/python3.8/site-packages/httpcore/backends/auto.py from anusfoil/LLaQo-ckpts: direct link, hf CLI and curl.
- Browser
- Download file 1.32 kB
-
https://huggingface.co/anusfoil/LLaQo-ckpts/resolve/main/lam2/lib/python3.8/site-packages/httpcore/backends/auto.py
- Command line
-
hf download hf://anusfoil/LLaQo-ckpts/lam2/lib/python3.8/site-packages/httpcore/backends/auto.py
-
curl -L -o auto.py https://huggingface.co/anusfoil/LLaQo-ckpts/resolve/main/lam2/lib/python3.8/site-packages/httpcore/backends/auto.py
1.32 kB
| from typing import Optional | |
| import sniffio | |
| from .base import AsyncNetworkBackend, AsyncNetworkStream | |
| class AutoBackend(AsyncNetworkBackend): | |
| async def _init_backend(self) -> None: | |
| if not (hasattr(self, "_backend")): | |
| backend = sniffio.current_async_library() | |
| if backend == "trio": | |
| from .trio import TrioBackend | |
| self._backend: AsyncNetworkBackend = TrioBackend() | |
| else: | |
| from .asyncio import AsyncIOBackend | |
| self._backend = AsyncIOBackend() | |
| async def connect_tcp( | |
| self, | |
| host: str, | |
| port: int, | |
| timeout: Optional[float] = None, | |
| local_address: Optional[str] = None, | |
| ) -> AsyncNetworkStream: | |
| await self._init_backend() | |
| return await self._backend.connect_tcp( | |
| host, port, timeout=timeout, local_address=local_address | |
| ) | |
| async def connect_unix_socket( | |
| self, path: str, timeout: Optional[float] = None | |
| ) -> AsyncNetworkStream: # pragma: nocover | |
| await self._init_backend() | |
| return await self._backend.connect_unix_socket(path, timeout=timeout) | |
| async def sleep(self, seconds: float) -> None: # pragma: nocover | |
| await self._init_backend() | |
| return await self._backend.sleep(seconds) | |