Skip to content

Commit c56be2f

Browse files
committed
fmt
1 parent 6bf4749 commit c56be2f

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

livekit-rtc/livekit/rtc/participant.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,20 +293,22 @@ async def perform_rpc(
293293
def register_rpc_method(
294294
self,
295295
method_name: str,
296-
handler: Optional[Callable[[RpcInvocationData], Union[Awaitable[str], str]]] = None,
296+
handler: Optional[
297+
Callable[[RpcInvocationData], Union[Awaitable[str], str]]
298+
] = None,
297299
) -> Union[None, Callable]:
298300
"""
299301
Establishes the participant as a receiver for calls of the specified RPC method.
300302
Can be used either as a decorator or a regular method.
301-
303+
302304
The handler will recieve one argument of type `RpcInvocationData` and should return a string response which will be forwarded back to the caller.
303-
305+
304306
The handler may be synchronous or asynchronous.
305307
306308
If unable to respond within `response_timeout`, the caller will hang up and receive an error on their side.
307309
308310
You may raise errors of type `RpcError` in the handler, and they will be forwarded to the caller.
309-
311+
310312
Other errors raised in your handler will be caught and forwarded to the caller as "1500 Application Error".
311313
312314
Args:
@@ -322,7 +324,7 @@ def register_rpc_method(
322324
async def greet_handler(data: RpcInvocationData) -> str:
323325
print(f"Received greeting from {data.caller_identity}: {data.payload}")
324326
return f"Hello, {data.caller_identity}!"
325-
327+
326328
# As a regular method:
327329
async def greet_handler(data: RpcInvocationData) -> str:
328330
print(f"Received greeting from {data.caller_identity}: {data.payload}")
@@ -382,7 +384,9 @@ async def _handle_rpc_method_invocation(
382384
else:
383385
try:
384386
if asyncio.iscoroutinefunction(handler):
385-
async_handler = cast(Callable[[RpcInvocationData], Awaitable[str]], handler)
387+
async_handler = cast(
388+
Callable[[RpcInvocationData], Awaitable[str]], handler
389+
)
386390

387391
async def run_handler():
388392
try:

livekit-rtc/livekit/rtc/rpc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class RpcError(Exception):
4141
4242
Instances of this type, when thrown in a method handler, will have their `message`
4343
serialized and sent across the wire. The caller will receive an equivalent error on the other side.
44-
44+
4545
Built-in errors are included (codes 1001-1999) but developers may use the code, message, and data fields to create their own errors.
4646
"""
4747

@@ -83,7 +83,7 @@ def __init__(
8383
Creates an error object with the given code and message, plus an optional data payload.
8484
8585
If thrown in an RPC method handler, the error will be sent back to the caller.
86-
86+
8787
Args:
8888
code (int): Your error code (Error codes 1001-1999 are reserved for built-in errors)
8989
message (str): A readable error message.
@@ -97,7 +97,7 @@ def __init__(
9797
@property
9898
def code(self) -> int:
9999
"""Error code value. Codes 1001-1999 are reserved for built-in errors (see RpcError.ErrorCode for their meanings)."""
100-
return self._code
100+
return self._code
101101

102102
@property
103103
def message(self) -> str:

0 commit comments

Comments
 (0)