File tree Expand file tree Collapse file tree 7 files changed +30
-3
lines changed
generated_async_only/testproto/grpc
generated_sync_only/testproto/grpc Expand file tree Collapse file tree 7 files changed +30
-3
lines changed Original file line number Diff line number Diff line change @@ -1022,6 +1022,18 @@ def write_grpc_services(
10221022 self ._import ("grpc.aio" , "Channel" ),
10231023 )
10241024 wl ("" )
1025+ elif self .grpc_type == GRPCType .SYNC :
1026+ wl (
1027+ "def __init__(self, channel: {}) -> None: ..." ,
1028+ self ._import ("grpc" , "Channel" ),
1029+ )
1030+ wl ("" )
1031+ elif self .grpc_type == GRPCType .ASYNC :
1032+ wl (
1033+ "def __init__(self, channel: {}) -> None: ..." ,
1034+ self ._import ("grpc.aio" , "Channel" ),
1035+ )
1036+ wl ("" )
10251037
10261038 self .write_grpc_stub_methods (service , scl )
10271039
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ async def UnaryUnary(
2424 return dummy_pb2 .DummyReply (value = request .value [::- 1 ])
2525
2626
27- async def main ():
27+ async def noop () -> None :
28+ """Don't actually run anything; this is just for type-checking."""
2829 stub = dummy_pb2_grpc .DummyServiceStub (channel = grpc .aio .insecure_channel ("localhost:50051" ))
2930 await stub .UnaryUnary (dummy_pb2 .DummyRequest (value = "test" ))
Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ _DummyServiceStreamStreamType: typing_extensions.TypeAlias = grpc.aio.StreamStre
4242class DummyServiceStub :
4343 """DummyService"""
4444
45+ def __init__ (self , channel : grpc .aio .Channel ) -> None : ...
46+
4547 UnaryUnary : _DummyServiceUnaryUnaryType
4648 """UnaryUnary"""
4749
@@ -103,6 +105,8 @@ _DeprecatedServiceDeprecatedMethodNotDeprecatedRequestType: typing_extensions.Ty
103105class DeprecatedServiceStub :
104106 """Marking the service as deprecated"""
105107
108+ def __init__ (self , channel : grpc .aio .Channel ) -> None : ...
109+
106110 DeprecatedMethod : _DeprecatedServiceDeprecatedMethodType
107111 """DeprecatedMethod"""
108112
Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ _SimpleServiceNoCommentType: typing_extensions.TypeAlias = grpc.aio.UnaryUnaryMu
3434class SimpleServiceStub :
3535 """SimpleService"""
3636
37+ def __init__ (self , channel : grpc .aio .Channel ) -> None : ...
38+
3739 UnaryUnary : _SimpleServiceUnaryUnaryType
3840 """UnaryUnary"""
3941
Original file line number Diff line number Diff line change @@ -42,6 +42,8 @@ _DummyServiceStreamStreamType: typing_extensions.TypeAlias = grpc.StreamStreamMu
4242class DummyServiceStub :
4343 """DummyService"""
4444
45+ def __init__ (self , channel : grpc .Channel ) -> None : ...
46+
4547 UnaryUnary : _DummyServiceUnaryUnaryType
4648 """UnaryUnary"""
4749
@@ -103,6 +105,8 @@ _DeprecatedServiceDeprecatedMethodNotDeprecatedRequestType: typing_extensions.Ty
103105class DeprecatedServiceStub :
104106 """Marking the service as deprecated"""
105107
108+ def __init__ (self , channel : grpc .Channel ) -> None : ...
109+
106110 DeprecatedMethod : _DeprecatedServiceDeprecatedMethodType
107111 """DeprecatedMethod"""
108112
Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ _SimpleServiceNoCommentType: typing_extensions.TypeAlias = grpc.UnaryUnaryMultiC
3434class SimpleServiceStub :
3535 """SimpleService"""
3636
37+ def __init__ (self , channel : grpc .Channel ) -> None : ...
38+
3739 UnaryUnary : _SimpleServiceUnaryUnaryType
3840 """UnaryUnary"""
3941
Original file line number Diff line number Diff line change @@ -21,5 +21,7 @@ def UnaryUnary(
2121 return dummy_pb2 .DummyReply (value = request .value [::- 1 ])
2222
2323
24- stub = dummy_pb2_grpc .DummyServiceStub (channel = grpc .insecure_channel ("localhost:50051" ))
25- stub .UnaryUnary (dummy_pb2 .DummyRequest (value = "test" ))
24+ def noop () -> None :
25+ """Don't actually run anything; this is just for type-checking."""
26+ stub = dummy_pb2_grpc .DummyServiceStub (channel = grpc .insecure_channel ("localhost:50051" ))
27+ stub .UnaryUnary (dummy_pb2 .DummyRequest (value = "test" ))
You can’t perform that action at this time.
0 commit comments