Download shared/asyncio_utils.py from 1ripon1/ColabWan: direct link, hf CLI and curl.
- Browser
- Download file 667 Bytes
-
https://huggingface.co/spaces/1ripon1/ColabWan/resolve/main/shared/asyncio_utils.py
- Command line
-
hf download hf://spaces/1ripon1/ColabWan/shared/asyncio_utils.py
-
curl -L -o asyncio_utils.py https://huggingface.co/spaces/1ripon1/ColabWan/resolve/main/shared/asyncio_utils.py
667 Bytes
| import os | |
| def silence_proactor_connection_reset() -> None: | |
| if os.name != "nt": | |
| return | |
| from asyncio import proactor_events as _proactor | |
| transport_cls = _proactor._ProactorBasePipeTransport | |
| if getattr(transport_cls, "_wan2gp_patch", False): | |
| return | |
| original = transport_cls._call_connection_lost | |
| def _call_connection_lost(self, exc): | |
| if isinstance(exc, ConnectionResetError): | |
| exc = None | |
| try: | |
| return original(self, exc) | |
| except ConnectionResetError: | |
| return None | |
| transport_cls._call_connection_lost = _call_connection_lost | |
| transport_cls._wan2gp_patch = True | |