@@ -66,10 +66,10 @@ def __init__(
6666 )
6767 self ._queue : asyncio .Queue [proto_DataStream .Chunk | None ] = asyncio .Queue ()
6868
69- async def _on_chunk_update (self , chunk : proto_DataStream .Chunk ):
69+ async def _on_chunk_update (self , chunk : proto_DataStream .Chunk ) -> None :
7070 await self ._queue .put (chunk )
7171
72- async def _on_stream_close (self , trailer : proto_DataStream .Trailer ):
72+ async def _on_stream_close (self , trailer : proto_DataStream .Trailer ) -> None :
7373 self .info .attributes = self .info .attributes or {}
7474 self .info .attributes .update (trailer .attributes )
7575 await self ._queue .put (None )
@@ -114,10 +114,10 @@ def __init__(self, header: proto_DataStream.Header, capacity: int = 0) -> None:
114114 )
115115 self ._queue : asyncio .Queue [proto_DataStream .Chunk | None ] = asyncio .Queue (capacity )
116116
117- async def _on_chunk_update (self , chunk : proto_DataStream .Chunk ):
117+ async def _on_chunk_update (self , chunk : proto_DataStream .Chunk ) -> None :
118118 await self ._queue .put (chunk )
119119
120- async def _on_stream_close (self , trailer : proto_DataStream .Trailer ):
120+ async def _on_stream_close (self , trailer : proto_DataStream .Trailer ) -> None :
121121 self .info .attributes = self .info .attributes or {}
122122 self .info .attributes .update (trailer .attributes )
123123 await self ._queue .put (None )
@@ -166,7 +166,7 @@ def __init__(
166166 self ._sender_identity = sender_identity or self ._local_participant .identity
167167 self ._closed = False
168168
169- async def _send_header (self ):
169+ async def _send_header (self ) -> None :
170170 req = proto_ffi .FfiRequest (
171171 send_stream_header = proto_room .SendStreamHeaderRequest (
172172 header = self ._header ,
@@ -188,7 +188,7 @@ async def _send_header(self):
188188 if cb .send_stream_header .error :
189189 raise ConnectionError (cb .send_stream_header .error )
190190
191- async def _send_chunk (self , chunk : proto_DataStream .Chunk ):
191+ async def _send_chunk (self , chunk : proto_DataStream .Chunk ) -> None :
192192 if self ._closed :
193193 raise RuntimeError (f"Cannot send chunk after stream is closed: { chunk } " )
194194 req = proto_ffi .FfiRequest (
@@ -212,7 +212,7 @@ async def _send_chunk(self, chunk: proto_DataStream.Chunk):
212212 if cb .send_stream_chunk .error :
213213 raise ConnectionError (cb .send_stream_chunk .error )
214214
215- async def _send_trailer (self , trailer : proto_DataStream .Trailer ):
215+ async def _send_trailer (self , trailer : proto_DataStream .Trailer ) -> None :
216216 req = proto_ffi .FfiRequest (
217217 send_stream_trailer = proto_room .SendStreamTrailerRequest (
218218 trailer = trailer ,
@@ -230,10 +230,12 @@ async def _send_trailer(self, trailer: proto_DataStream.Trailer):
230230 finally :
231231 FfiClient .instance .queue .unsubscribe (queue )
232232
233- if cb .send_stream_chunk .error :
233+ if cb .send_stream_trailer .error :
234234 raise ConnectionError (cb .send_stream_trailer .error )
235235
236- async def aclose (self , * , reason : str = "" , attributes : Optional [Dict [str , str ]] = None ):
236+ async def aclose (
237+ self , * , reason : str = "" , attributes : Optional [Dict [str , str ]] = None
238+ ) -> None :
237239 if self ._closed :
238240 raise RuntimeError ("Stream already closed" )
239241 self ._closed = True
@@ -281,7 +283,7 @@ def __init__(
281283 )
282284 self ._write_lock = asyncio .Lock ()
283285
284- async def write (self , text : str ):
286+ async def write (self , text : str ) -> None :
285287 async with self ._write_lock :
286288 for chunk in split_utf8 (text , STREAM_CHUNK_SIZE ):
287289 content = chunk
@@ -333,7 +335,7 @@ def __init__(
333335 )
334336 self ._write_lock = asyncio .Lock ()
335337
336- async def write (self , data : bytes ):
338+ async def write (self , data : bytes ) -> None :
337339 async with self ._write_lock :
338340 chunked_data = [
339341 data [i : i + STREAM_CHUNK_SIZE ] for i in range (0 , len (data ), STREAM_CHUNK_SIZE )
0 commit comments