mirror of https://github.com/MagicStack/uvloop.git
Add `uvloop.install()` helper function.
This commit is contained in:
parent
f24c8223b9
commit
a3d8d4011f
|
@ -1,4 +1,4 @@
|
|||
import asyncio
|
||||
import asyncio as __asyncio
|
||||
|
||||
from asyncio.events import BaseDefaultEventLoopPolicy as __BasePolicy
|
||||
|
||||
|
@ -8,10 +8,10 @@ from .loop import Loop as __BaseLoop # NOQA
|
|||
|
||||
|
||||
__version__ = '0.12.0.dev0'
|
||||
__all__ = ('new_event_loop', 'EventLoopPolicy')
|
||||
__all__ = ('new_event_loop', 'install', 'EventLoopPolicy')
|
||||
|
||||
|
||||
class Loop(__BaseLoop, asyncio.AbstractEventLoop):
|
||||
class Loop(__BaseLoop, __asyncio.AbstractEventLoop):
|
||||
pass
|
||||
|
||||
|
||||
|
@ -20,6 +20,11 @@ def new_event_loop():
|
|||
return Loop()
|
||||
|
||||
|
||||
def install():
|
||||
"""A helper function to install uvloop policy."""
|
||||
__asyncio.set_event_loop_policy(EventLoopPolicy())
|
||||
|
||||
|
||||
class EventLoopPolicy(__BasePolicy):
|
||||
"""Event loop policy.
|
||||
|
||||
|
|
Loading…
Reference in New Issue