Skip to content

Commit

Permalink
Add uvloop.install() helper function.
Browse files Browse the repository at this point in the history
  • Loading branch information
1st1 committed Aug 2, 2018
1 parent f24c822 commit a3d8d40
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions uvloop/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import asyncio
import asyncio as __asyncio

from asyncio.events import BaseDefaultEventLoopPolicy as __BasePolicy

Expand All @@ -8,10 +8,10 @@


__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


Expand All @@ -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.
Expand Down

0 comments on commit a3d8d40

Please sign in to comment.