Skip to content

Commit 003c427

Browse files
authored
fix: Fix mypy errors on trtllm examples (#1277)
1 parent 3e3c3b1 commit 003c427

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

examples/tensorrt_llm/common/utils.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import weakref
2222
from enum import Enum
2323
from queue import Queue
24-
from typing import Callable, Optional, TypedDict, Union
24+
from typing import Any, Callable, Coroutine, Optional, TypedDict, Union
2525

2626
logger = logging.getLogger(__name__)
2727

@@ -54,7 +54,9 @@ class ConversationMessage(TypedDict):
5454
class ManagedThread(threading.Thread):
5555
def __init__(
5656
self,
57-
task: Optional[Union[Callable[..., bool], weakref.WeakMethod]],
57+
task: Optional[
58+
Union[Callable[..., Coroutine[Any, Any, bool]], weakref.WeakMethod]
59+
],
5860
error_queue: Optional[Queue] = None,
5961
name: Optional[str] = None,
6062
loop: Optional[asyncio.AbstractEventLoop] = None,
@@ -74,7 +76,9 @@ def set_loop(self, loop: asyncio.AbstractEventLoop):
7476

7577
def run(self):
7678
while not self.stop_event.is_set():
77-
task: Optional[Union[Callable[..., bool], weakref.WeakMethod]] = self.task
79+
task: Optional[
80+
Union[Callable[..., Coroutine[Any, Any, bool]], weakref.WeakMethod]
81+
] = self.task
7882
if isinstance(task, weakref.WeakMethod):
7983
task = task()
8084
if task is None:

0 commit comments

Comments
 (0)