Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions pyaml_cs_oa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import asyncio
import contextlib
import sys
from typing import Any, Awaitable

from ._version import __version__
Expand All @@ -27,9 +28,14 @@ def loop() -> asyncio.AbstractEventLoop:
# We found a running loop (Jupyter case)
if not _nest_asyncio_applied:
try:
import nest_asyncio
if sys.version_info >= (3, 13):
import nest_asyncio2

nest_asyncio.apply(running_loop)
nest_asyncio2.apply(running_loop)
else:
import nest_asyncio

nest_asyncio.apply(running_loop)
_nest_asyncio_applied = True
except ImportError:
pass
Expand All @@ -45,9 +51,14 @@ def loop() -> asyncio.AbstractEventLoop:
# Apply nest_asyncio to our new loop
if not _nest_asyncio_applied:
try:
import nest_asyncio
if sys.version_info >= (3, 13):
import nest_asyncio2

nest_asyncio2.apply(_loop)
else:
import nest_asyncio

nest_asyncio.apply(_loop)
nest_asyncio.apply(_loop)
_nest_asyncio_applied = True
except ImportError:
pass
Expand Down
Loading