mirror of
https://github.com/home-assistant/core.git
synced 2025-07-21 12:17:07 +00:00
commit
07972c84a1
@ -22,16 +22,31 @@ from homeassistant.const import (
|
|||||||
def set_loop() -> None:
|
def set_loop() -> None:
|
||||||
"""Attempt to use uvloop."""
|
"""Attempt to use uvloop."""
|
||||||
import asyncio
|
import asyncio
|
||||||
|
from asyncio.events import BaseDefaultEventLoopPolicy
|
||||||
|
|
||||||
|
policy = None
|
||||||
|
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
asyncio.set_event_loop(asyncio.ProactorEventLoop())
|
if hasattr(asyncio, 'WindowsProactorEventLoopPolicy'):
|
||||||
|
# pylint: disable=no-member
|
||||||
|
policy = asyncio.WindowsProactorEventLoopPolicy()
|
||||||
|
else:
|
||||||
|
class ProactorPolicy(BaseDefaultEventLoopPolicy):
|
||||||
|
"""Event loop policy to create proactor loops."""
|
||||||
|
|
||||||
|
_loop_factory = asyncio.ProactorEventLoop
|
||||||
|
|
||||||
|
policy = ProactorPolicy()
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
import uvloop
|
import uvloop
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
|
policy = uvloop.EventLoopPolicy()
|
||||||
|
|
||||||
|
if policy is not None:
|
||||||
|
asyncio.set_event_loop_policy(policy)
|
||||||
|
|
||||||
|
|
||||||
def validate_python() -> None:
|
def validate_python() -> None:
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"""Constants used by Home Assistant components."""
|
"""Constants used by Home Assistant components."""
|
||||||
MAJOR_VERSION = 0
|
MAJOR_VERSION = 0
|
||||||
MINOR_VERSION = 79
|
MINOR_VERSION = 79
|
||||||
PATCH_VERSION = '2'
|
PATCH_VERSION = '3'
|
||||||
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
|
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
|
||||||
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
|
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
|
||||||
REQUIRED_PYTHON_VER = (3, 5, 3)
|
REQUIRED_PYTHON_VER = (3, 5, 3)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user