Skip to content

Commit

Permalink
Merge pull request #43 from mahlberg/server-interceptor
Browse files Browse the repository at this point in the history
Fix return type from intercept_service
  • Loading branch information
shabbyrobe committed Sep 29, 2023
2 parents af6addc + 08faba1 commit 41edee8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion grpc-stubs/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ class ServerInterceptor(typing.Generic[TRequest, TResponse]):
typing.Optional[RpcMethodHandler[TRequest, TResponse]]
],
handler_call_details: HandlerCallDetails,
) -> RpcMethodHandler[TRequest, TResponse]:
) -> typing.Optional[RpcMethodHandler[TRequest, TResponse]]:
...


Expand Down
12 changes: 12 additions & 0 deletions typesafety/test_grpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,15 @@
server = typing.cast(aio.Server, None)
enable_server_reflection(["foo"], server, None)
- case: server_interceptor
main: |
import typing
import grpc
class NoopInterceptor(grpc.ServerInterceptor):
def intercept_service(
self,
continuation: typing.Callable[[grpc.HandlerCallDetails], typing.Optional[grpc.RpcMethodHandler]],
handler_call_details: grpc.HandlerCallDetails,
) -> typing.Optional[grpc.RpcMethodHandler]:
return continuation(handler_call_details)

0 comments on commit 41edee8

Please sign in to comment.