2121import logging
2222import os
2323import threading
24- from collections .abc import Callable , Generator
24+ from collections .abc import Callable , Generator , Iterator
2525from concurrent .futures import Future , ThreadPoolExecutor , wait
2626from contextlib import contextmanager
2727from contextvars import ContextVar
@@ -126,7 +126,7 @@ class ActorHandle:
126126 Provides a unified interface for calling actor methods with .remote() and .call().
127127 """
128128
129- def __getattr__ (self , method_name : str ):
129+ def __getattr__ (self , method_name : str ) -> "ActorMethod" :
130130 """Get a callable method wrapper for the actor."""
131131 raise NotImplementedError
132132
@@ -150,7 +150,7 @@ def __init__(self, instance: Any, lock: threading.Lock, context):
150150 self ._lock = lock # Serializes all method calls
151151 self ._context = context
152152
153- def __getattr__ (self , method_name : str ):
153+ def __getattr__ (self , method_name : str ) -> "ThreadActorMethod" :
154154 method = getattr (self ._instance , method_name )
155155 return ThreadActorMethod (method , self ._lock , self ._context )
156156
@@ -183,7 +183,7 @@ class _ImmediateFuture:
183183
184184 def __init__ (self , result : Any ):
185185 self ._result = result
186- self ._iterator = None
186+ self ._iterator : Iterator [ Any ] | None = None
187187
188188 def result (self ) -> Any :
189189 return self ._result
@@ -206,7 +206,7 @@ class GeneratorFuture:
206206
207207 def __init__ (self , future : Future ):
208208 self ._future = future
209- self ._iterator = None
209+ self ._iterator : Iterator [ Any ] | None = None
210210
211211 def result (self ) -> Any :
212212 """Get the underlying result from the future."""
@@ -422,7 +422,7 @@ def create_actor(
422422 num_cpus : float | None = None ,
423423 ** kwargs ,
424424 ) -> ActorHandle :
425- options = {}
425+ options : dict [ str , Any ] = {}
426426 if name is not None :
427427 options ["name" ] = name
428428 options ["get_if_exists" ] = get_if_exists
0 commit comments