@@ -55,7 +55,7 @@ async def main():
5555 await asyncio .create_task (perform_long_calculation (callers_room ))
5656 except Exception as error :
5757 print ("Error:" , error )
58-
58+
5959 try :
6060 print ("\n \n Running long calculation with disconnect..." )
6161 # Start the long calculation
@@ -82,7 +82,9 @@ async def main():
8282 finally :
8383 # Clean up all rooms
8484 print ("Disconnecting all participants..." )
85- await asyncio .gather (* (room .disconnect () for room in rooms ), return_exceptions = True )
85+ await asyncio .gather (
86+ * (room .disconnect () for room in rooms ), return_exceptions = True
87+ )
8688 print ("Cleanup complete" )
8789
8890
@@ -143,7 +145,9 @@ async def long_calculation_method(
143145 response_timeout : float ,
144146 ):
145147 print (f"[Math Genius] Starting a very long calculation for { caller_identity } " )
146- print (f"[Math Genius] This will take 30 seconds even though you're only giving me { response_timeout } seconds" )
148+ print (
149+ f"[Math Genius] This will take 30 seconds even though you're only giving me { response_timeout } seconds"
150+ )
147151 await asyncio .sleep (30 )
148152 return json .dumps ({"result" : "Calculation complete!" })
149153
@@ -152,9 +156,7 @@ async def perform_greeting(room: rtc.Room):
152156 print ("[Caller] Letting the greeter know that I've arrived" )
153157 try :
154158 response = await room .local_participant .perform_rpc (
155- destination_identity = "greeter" ,
156- method = "arrival" ,
157- payload = "Hello"
159+ destination_identity = "greeter" , method = "arrival" , payload = "Hello"
158160 )
159161 print (f'[Caller] That\' s nice, the greeter said: "{ response } "' )
160162 except Exception as error :
@@ -168,7 +170,7 @@ async def perform_square_root(room: rtc.Room):
168170 response = await room .local_participant .perform_rpc (
169171 destination_identity = "math-genius" ,
170172 method = "square-root" ,
171- payload = json .dumps ({"number" : 16 })
173+ payload = json .dumps ({"number" : 16 }),
172174 )
173175 parsed_response = json .loads (response )
174176 print (f"[Caller] Nice, the answer was { parsed_response ['result' ]} " )
@@ -183,7 +185,7 @@ async def perform_quantum_hypergeometric_series(room: rtc.Room):
183185 response = await room .local_participant .perform_rpc (
184186 destination_identity = "math-genius" ,
185187 method = "quantum-hypergeometric-series" ,
186- payload = json .dumps ({"number" : 42 })
188+ payload = json .dumps ({"number" : 42 }),
187189 )
188190 parsed_response = json .loads (response )
189191 print (f"[Caller] genius says { parsed_response ['result' ]} !" )
@@ -204,7 +206,7 @@ async def perform_divide(room: rtc.Room):
204206 response = await room .local_participant .perform_rpc (
205207 destination_identity = "math-genius" ,
206208 method = "divide" ,
207- payload = json .dumps ({"dividend" : 10 , "divisor" : 0 })
209+ payload = json .dumps ({"dividend" : 10 , "divisor" : 0 }),
208210 )
209211 parsed_response = json .loads (response )
210212 print (f"[Caller] The result is { parsed_response ['result' ]} " )
@@ -226,7 +228,7 @@ async def perform_long_calculation(room: rtc.Room):
226228 destination_identity = "math-genius" ,
227229 method = "long-calculation" ,
228230 payload = json .dumps ({}),
229- response_timeout = 10
231+ response_timeout = 10 ,
230232 )
231233 parsed_response = json .loads (response )
232234 print (f"[Caller] Result: { parsed_response ['result' ]} " )
0 commit comments