Suppress runtime warnings (#3354)

This commit is contained in:
Nikhil Rao 2024-05-21 12:34:25 -07:00 committed by GitHub
parent ec72448b8b
commit ff985aee22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,6 +5,7 @@ from __future__ import annotations
import asyncio
import multiprocessing
import platform
import warnings
try:
from datetime import UTC, datetime
@ -192,6 +193,7 @@ def send(event: str, telemetry_enabled: bool | None = None, **kwargs):
asyncio.create_task(async_send(event, telemetry_enabled, **kwargs))
except RuntimeError:
# If there is no event loop, send the event synchronously.
warnings.filterwarnings("ignore", category=RuntimeWarning)
_send(event, telemetry_enabled, **kwargs)