|
2 | 2 | import sys
|
3 | 3 | import warnings
|
4 | 4 |
|
5 |
| -if sys.implementation.name == "cpython" and platform.system() == "Windows" and sys.version_info[:2] == (3, 9): |
| 5 | +if sys.implementation.name == "cpython" and platform.system() == "Windows": |
6 | 6 | import asyncio
|
7 |
| - from asyncio.proactor_events import _ProactorBasePipeTransport |
8 | 7 |
|
9 |
| - from semantic_kernel.orchestration import sk_function as _ # noqa: F401 |
| 8 | + if sys.version_info[:2] == (3, 9): |
| 9 | + from asyncio.proactor_events import _ProactorBasePipeTransport |
10 | 10 |
|
11 |
| - # https://github.com/python/cpython/pull/92842 |
12 |
| - def pacth_del(self, _warn=warnings.warn): |
13 |
| - if self._sock is not None: |
14 |
| - _warn(f"unclosed transport {self!r}", ResourceWarning, source=self) |
15 |
| - self._sock.close() |
| 11 | + # https://github.com/python/cpython/pull/92842 |
| 12 | + def pacth_del(self, _warn=warnings.warn): |
| 13 | + if self._sock is not None: |
| 14 | + _warn(f"unclosed transport {self!r}", ResourceWarning, source=self) |
| 15 | + self._sock.close() |
16 | 16 |
|
17 |
| - _ProactorBasePipeTransport.__del__ = pacth_del |
| 17 | + _ProactorBasePipeTransport.__del__ = pacth_del |
18 | 18 |
|
19 |
| - # caused by https://github.com/microsoft/semantic-kernel/pull/1416 |
20 |
| - asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy()) |
| 19 | + if sys.version_info >= (3, 9, 0): |
| 20 | + from semantic_kernel.orchestration import sk_function as _ # noqa: F401 |
| 21 | + |
| 22 | + # caused by https://github.com/microsoft/semantic-kernel/pull/1416 |
| 23 | + asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy()) |
0 commit comments