-
-
Notifications
You must be signed in to change notification settings - Fork 757
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
27 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,23 @@ | ||
from __future__ import annotations | ||
|
||
import asyncio | ||
import sys | ||
from collections.abc import Callable | ||
|
||
|
||
def auto_loop_factory(use_subprocess: bool = False) -> Callable[[], asyncio.AbstractEventLoop]: | ||
def auto_loop_factory(use_subprocess: bool = False) -> Callable[[], asyncio.AbstractEventLoop]: # pragma: no cover | ||
try: | ||
import uvloop # noqa | ||
except ImportError: # pragma: no cover | ||
from uvicorn.loops.asyncio import asyncio_loop_factory as loop_factory | ||
|
||
return loop_factory(use_subprocess=use_subprocess) | ||
pass | ||
except AttributeError: # pragma: no cover | ||
if sys.version_info < (3, 14): | ||
raise | ||
else: # pragma: no cover | ||
from uvicorn.loops.uvloop import uvloop_loop_factory | ||
|
||
return uvloop_loop_factory(use_subprocess=use_subprocess) | ||
|
||
from uvicorn.loops.asyncio import asyncio_loop_factory as loop_factory | ||
|
||
return loop_factory(use_subprocess=use_subprocess) |