Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions stubs/grpcio/@tests/test_cases/check_server_interceptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ def intercept_service(
class NoopAioInterceptor(grpc.aio.ServerInterceptor):
async def intercept_service(
self,
continuation: Callable[[grpc.HandlerCallDetails], Awaitable[grpc.RpcMethodHandler[RequestT, ResponseT]]],
continuation: Callable[[grpc.HandlerCallDetails], Awaitable[grpc.RpcMethodHandler[RequestT, ResponseT] | None]],
handler_call_details: grpc.HandlerCallDetails,
) -> grpc.RpcMethodHandler[RequestT, ResponseT]:
) -> grpc.RpcMethodHandler[RequestT, ResponseT] | None:
return await continuation(handler_call_details)


Expand Down
7 changes: 5 additions & 2 deletions stubs/grpcio/grpc/aio/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -375,12 +375,15 @@ class ServerInterceptor(metaclass=abc.ABCMeta):
# This method (not the class) is generic over _TRequest and _TResponse
# and the types must satisfy the no-op implementation of
# `return await continuation(handler_call_details)`.
# The return is Optional: per the runtime docstring, an interceptor
# may return None to signal that the RPC is not serviced, and the
# continuation propagates that None down the chain.
@abc.abstractmethod
async def intercept_service(
self,
continuation: Callable[[HandlerCallDetails], Awaitable[RpcMethodHandler[_TRequest, _TResponse]]],
continuation: Callable[[HandlerCallDetails], Awaitable[RpcMethodHandler[_TRequest, _TResponse] | None]],
handler_call_details: HandlerCallDetails,
) -> RpcMethodHandler[_TRequest, _TResponse]: ...
) -> RpcMethodHandler[_TRequest, _TResponse] | None: ...

# Multi-Callable Interfaces:

Expand Down
Loading