From 15f100c4e9959ae9e55addb93195646420198638 Mon Sep 17 00:00:00 2001 From: lukasIO Date: Thu, 16 Jan 2025 10:23:19 +0100 Subject: [PATCH] add explicit return types --- livekit-rtc/livekit/rtc/participant.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/livekit-rtc/livekit/rtc/participant.py b/livekit-rtc/livekit/rtc/participant.py index ffaeaf9b..63f4945d 100644 --- a/livekit-rtc/livekit/rtc/participant.py +++ b/livekit-rtc/livekit/rtc/participant.py @@ -45,7 +45,12 @@ from .log import logger from .rpc import RpcInvocationData -from .data_stream import TextStreamWriter, FileStreamWriter, STREAM_CHUNK_SIZE +from .data_stream import ( + TextStreamWriter, + FileStreamWriter, + FileStreamInfo, + STREAM_CHUNK_SIZE, +) class PublishTrackError(Exception): @@ -550,7 +555,7 @@ async def stream_text( topic: str = "", extensions: Dict[str, str] = {}, reply_to_id: str | None = None, - ): + ) -> TextStreamWriter: writer = TextStreamWriter( self, topic=topic, @@ -571,7 +576,7 @@ async def stream_file( extensions: Dict[str, str] = {}, stream_id: str | None = None, destination_identities: List[str] = [], - ): + ) -> FileStreamWriter: writer = FileStreamWriter( self, file_name=file_name, @@ -592,7 +597,7 @@ async def send_file( destination_identities: List[str] = [], extensions: Dict[str, str] = {}, stream_id: str | None = None, - ): + ) -> FileStreamInfo: file_size = os.path.getsize(file_path) file_name = os.path.basename(file_path) mime_type, _ = mimetypes.guess_type(file_path) @@ -615,6 +620,8 @@ async def send_file( await writer.write(bytes) await writer.close() + return writer.info + async def publish_track( self, track: LocalTrack, options: TrackPublishOptions = TrackPublishOptions() ) -> LocalTrackPublication: