<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import asyncio as __asyncio
import typing as _typing

from asyncio.events import BaseDefaultEventLoopPolicy as __BasePolicy

from . import includes as __includes  # NOQA
from .loop import Loop as __BaseLoop  # NOQA
from ._version import __version__  # NOQA


__all__ = ('new_event_loop', 'install', 'EventLoopPolicy')


class Loop(__BaseLoop, __asyncio.AbstractEventLoop):  # type: ignore[misc]
    pass


def new_event_loop() -&gt; Loop:
    """Return a new event loop."""
    return Loop()


def install() -&gt; None:
    """A helper function to install uvloop policy."""
    __asyncio.set_event_loop_policy(EventLoopPolicy())


class EventLoopPolicy(__BasePolicy):
    """Event loop policy.

    The preferred way to make your application use uvloop:

    &gt;&gt;&gt; import asyncio
    &gt;&gt;&gt; import uvloop
    &gt;&gt;&gt; asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
    &gt;&gt;&gt; asyncio.get_event_loop()
    &lt;uvloop.Loop running=False closed=False debug=False&gt;
    """

    def _loop_factory(self) -&gt; Loop:
        return new_event_loop()

    if _typing.TYPE_CHECKING:
        # EventLoopPolicy doesn't implement these, but since they are marked
        # as abstract in typeshed, we have to put them in so mypy thinks
        # the base methods are overridden. This is the same approach taken
        # for the Windows event loop policy classes in typeshed.
        def get_child_watcher(self) -&gt; _typing.NoReturn:
            ...

        def set_child_watcher(
            self, watcher: _typing.Any
        ) -&gt; _typing.NoReturn:
            ...
</pre></body></html>