Fix imports for micropython
This commit is contained in:
+7
-3
@@ -1,6 +1,10 @@
|
||||
import time
|
||||
import asyncio
|
||||
import inspect
|
||||
try:
|
||||
import asyncio
|
||||
import inspect
|
||||
ASYNCIO = True
|
||||
except ImportError:
|
||||
ASYNCIO = False
|
||||
|
||||
class AlertManager:
|
||||
def __init__(self):
|
||||
@@ -12,7 +16,7 @@ class AlertManager:
|
||||
|
||||
def call_on_alert_callback(self, alert):
|
||||
if self.on_alert_callback:
|
||||
if inspect.iscoroutinefunction(self.on_alert_callback):
|
||||
if ASYNCIO and inspect.iscoroutinefunction(self.on_alert_callback):
|
||||
# Schedule coroutine on the running loop without blocking
|
||||
try:
|
||||
loop = asyncio.get_running_loop()
|
||||
|
||||
Reference in New Issue
Block a user