Coverage for /pythoncovmergedfiles/medio/medio/src/grpc/examples/python/helloworld/helloworld_pb2_grpc.py: 62%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

47 statements  

1# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! 

2"""Client and server classes corresponding to protobuf-defined services.""" 

3import grpc 

4import warnings 

5 

6import helloworld_pb2 as helloworld__pb2 

7 

8GRPC_GENERATED_VERSION = '1.66.0' 

9GRPC_VERSION = grpc.__version__ 

10_version_not_supported = False 

11 

12try: 

13 from grpc._utilities import first_version_is_lower 

14 _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION) 

15except ImportError: 

16 _version_not_supported = True 

17 

18if _version_not_supported: 

19 raise RuntimeError( 

20 f'The grpc package installed is at version {GRPC_VERSION},' 

21 + f' but the generated code in helloworld_pb2_grpc.py depends on' 

22 + f' grpcio>={GRPC_GENERATED_VERSION}.' 

23 + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}' 

24 + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.' 

25 ) 

26 

27 

28class GreeterStub(object): 

29 """The greeting service definition. 

30 """ 

31 

32 def __init__(self, channel): 

33 """Constructor. 

34 

35 Args: 

36 channel: A grpc.Channel. 

37 """ 

38 self.SayHello = channel.unary_unary( 

39 '/helloworld.Greeter/SayHello', 

40 request_serializer=helloworld__pb2.HelloRequest.SerializeToString, 

41 response_deserializer=helloworld__pb2.HelloReply.FromString, 

42 _registered_method=True) 

43 self.SayHelloStreamReply = channel.unary_stream( 

44 '/helloworld.Greeter/SayHelloStreamReply', 

45 request_serializer=helloworld__pb2.HelloRequest.SerializeToString, 

46 response_deserializer=helloworld__pb2.HelloReply.FromString, 

47 _registered_method=True) 

48 self.SayHelloBidiStream = channel.stream_stream( 

49 '/helloworld.Greeter/SayHelloBidiStream', 

50 request_serializer=helloworld__pb2.HelloRequest.SerializeToString, 

51 response_deserializer=helloworld__pb2.HelloReply.FromString, 

52 _registered_method=True) 

53 

54 

55class GreeterServicer(object): 

56 """The greeting service definition. 

57 """ 

58 

59 def SayHello(self, request, context): 

60 """Sends a greeting 

61 """ 

62 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 

63 context.set_details('Method not implemented!') 

64 raise NotImplementedError('Method not implemented!') 

65 

66 def SayHelloStreamReply(self, request, context): 

67 """Missing associated documentation comment in .proto file.""" 

68 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 

69 context.set_details('Method not implemented!') 

70 raise NotImplementedError('Method not implemented!') 

71 

72 def SayHelloBidiStream(self, request_iterator, context): 

73 """Missing associated documentation comment in .proto file.""" 

74 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 

75 context.set_details('Method not implemented!') 

76 raise NotImplementedError('Method not implemented!') 

77 

78 

79def add_GreeterServicer_to_server(servicer, server): 

80 rpc_method_handlers = { 

81 'SayHello': grpc.unary_unary_rpc_method_handler( 

82 servicer.SayHello, 

83 request_deserializer=helloworld__pb2.HelloRequest.FromString, 

84 response_serializer=helloworld__pb2.HelloReply.SerializeToString, 

85 ), 

86 'SayHelloStreamReply': grpc.unary_stream_rpc_method_handler( 

87 servicer.SayHelloStreamReply, 

88 request_deserializer=helloworld__pb2.HelloRequest.FromString, 

89 response_serializer=helloworld__pb2.HelloReply.SerializeToString, 

90 ), 

91 'SayHelloBidiStream': grpc.stream_stream_rpc_method_handler( 

92 servicer.SayHelloBidiStream, 

93 request_deserializer=helloworld__pb2.HelloRequest.FromString, 

94 response_serializer=helloworld__pb2.HelloReply.SerializeToString, 

95 ), 

96 } 

97 generic_handler = grpc.method_handlers_generic_handler( 

98 'helloworld.Greeter', rpc_method_handlers) 

99 server.add_generic_rpc_handlers((generic_handler,)) 

100 server.add_registered_method_handlers('helloworld.Greeter', rpc_method_handlers) 

101 

102 

103 # This class is part of an EXPERIMENTAL API. 

104class Greeter(object): 

105 """The greeting service definition. 

106 """ 

107 

108 @staticmethod 

109 def SayHello(request, 

110 target, 

111 options=(), 

112 channel_credentials=None, 

113 call_credentials=None, 

114 insecure=False, 

115 compression=None, 

116 wait_for_ready=None, 

117 timeout=None, 

118 metadata=None): 

119 return grpc.experimental.unary_unary( 

120 request, 

121 target, 

122 '/helloworld.Greeter/SayHello', 

123 helloworld__pb2.HelloRequest.SerializeToString, 

124 helloworld__pb2.HelloReply.FromString, 

125 options, 

126 channel_credentials, 

127 insecure, 

128 call_credentials, 

129 compression, 

130 wait_for_ready, 

131 timeout, 

132 metadata, 

133 _registered_method=True) 

134 

135 @staticmethod 

136 def SayHelloStreamReply(request, 

137 target, 

138 options=(), 

139 channel_credentials=None, 

140 call_credentials=None, 

141 insecure=False, 

142 compression=None, 

143 wait_for_ready=None, 

144 timeout=None, 

145 metadata=None): 

146 return grpc.experimental.unary_stream( 

147 request, 

148 target, 

149 '/helloworld.Greeter/SayHelloStreamReply', 

150 helloworld__pb2.HelloRequest.SerializeToString, 

151 helloworld__pb2.HelloReply.FromString, 

152 options, 

153 channel_credentials, 

154 insecure, 

155 call_credentials, 

156 compression, 

157 wait_for_ready, 

158 timeout, 

159 metadata, 

160 _registered_method=True) 

161 

162 @staticmethod 

163 def SayHelloBidiStream(request_iterator, 

164 target, 

165 options=(), 

166 channel_credentials=None, 

167 call_credentials=None, 

168 insecure=False, 

169 compression=None, 

170 wait_for_ready=None, 

171 timeout=None, 

172 metadata=None): 

173 return grpc.experimental.stream_stream( 

174 request_iterator, 

175 target, 

176 '/helloworld.Greeter/SayHelloBidiStream', 

177 helloworld__pb2.HelloRequest.SerializeToString, 

178 helloworld__pb2.HelloReply.FromString, 

179 options, 

180 channel_credentials, 

181 insecure, 

182 call_credentials, 

183 compression, 

184 wait_for_ready, 

185 timeout, 

186 metadata, 

187 _registered_method=True)