Skip to content

Commit 4577db6

Browse files
authored
Fix grpc aio handler typing
1 parent ef1a1a1 commit 4577db6

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

stubs/grpcio/@tests/test_cases/check_server_interceptor.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,20 @@ async def intercept_service(
3434

3535
grpc.aio.server(interceptors=[NoopAioInterceptor()])
3636

37-
aio_handler = grpc.aio.RpcMethodHandler[RequestT, ResponseT]()
38-
aio_handler.unary_unary = cast(Callable[[RequestT, grpc.aio.ServicerContext[RequestT, ResponseT]], Awaitable[ResponseT]], None)
37+
aio_handler: grpc.aio.RpcMethodHandler[bytes, bytes] = grpc.aio.RpcMethodHandler()
38+
aio_handler.unary_unary = cast(
39+
Callable[[bytes, grpc.aio.ServicerContext[bytes, bytes]], Awaitable[bytes]],
40+
None,
41+
)
3942
aio_handler.unary_stream = cast(
40-
Callable[[RequestT, grpc.aio.ServicerContext[RequestT, ResponseT]], AsyncIterator[ResponseT]], None
43+
Callable[[bytes, grpc.aio.ServicerContext[bytes, bytes]], AsyncIterator[bytes]],
44+
None,
4145
)
4246
aio_handler.stream_unary = cast(
43-
Callable[[AsyncIterator[RequestT], grpc.aio.ServicerContext[RequestT, ResponseT]], Awaitable[ResponseT]], None
47+
Callable[[AsyncIterator[bytes], grpc.aio.ServicerContext[bytes, bytes]], Awaitable[bytes]],
48+
None,
4449
)
4550
aio_handler.stream_stream = cast(
46-
Callable[[AsyncIterator[RequestT], grpc.aio.ServicerContext[RequestT, ResponseT]], AsyncIterator[ResponseT]], None
51+
Callable[[AsyncIterator[bytes], grpc.aio.ServicerContext[bytes, bytes]], AsyncIterator[bytes]],
52+
None,
4753
)

0 commit comments

Comments
 (0)