Skip to content

Commit

Permalink
✨ support aio
Browse files Browse the repository at this point in the history
1. add grpc.aio.Server to generated `Servicer_to_server` stub

Signed-off-by: weiwee <[email protected]>
  • Loading branch information
sagewe committed Mar 30, 2021
1 parent f8ccdf3 commit e8b81df
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mypy_protobuf/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -683,10 +683,12 @@ def write_grpc_services(self, services: Iterable[d.ServiceDescriptorProto]) -> N
self.write_grpc_methods(service)
l("")
l(
"def add_{}Servicer_to_server(servicer: {}Servicer, server: {}) -> None: ...",
"def add_{}Servicer_to_server(servicer: {}Servicer, server: {}[{}, {}]) -> None: ...",
service.name,
service.name,
self._import("typing", "Union"),
self._import("grpc", "Server"),
self._import("grpc.aio", "Server"),
)
l("")

Expand Down

0 comments on commit e8b81df

Please sign in to comment.