Skip to content

Commit 3916b0f

Browse files
committed
Fix mypy error
1 parent 1c3b81c commit 3916b0f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

rosbridge_server/src/rosbridge_server/websocket_handler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import threading
3838
import traceback
3939
import uuid
40+
from asyncio.events import AbstractEventLoop
4041
from collections import deque
4142
from functools import wraps
4243
from typing import TYPE_CHECKING, ClassVar, ParamSpec, TypeVar
@@ -48,7 +49,6 @@
4849
from tornado.websocket import WebSocketClosedError, WebSocketHandler
4950

5051
if TYPE_CHECKING:
51-
from asyncio.events import AbstractEventLoop
5252
from collections.abc import Callable
5353

5454
from .client_manager import ClientManager
@@ -192,6 +192,7 @@ def on_close(self) -> None:
192192

193193
def send_message(self, message: bson.BSON | bytearray | str, compression: str = "none") -> None:
194194
cls = self.__class__
195+
assert isinstance(cls.event_loop, AbstractEventLoop), "Event loop was not set"
195196

196197
if isinstance(message, bson.BSON) or compression in ["cbor", "cbor-raw"]:
197198
binary = True

0 commit comments

Comments
 (0)