Simplify code: delete py_input_message (#614)
This commit is contained in:
		| @@ -755,30 +755,6 @@ class ServiceMethodCompiler(ProtoContentBase): | ||||
|         ) | ||||
|         return f"/{package_part}{self.parent.proto_name}/{self.proto_name}" | ||||
|  | ||||
|     @property | ||||
|     def py_input_message(self) -> Optional[MessageCompiler]: | ||||
|         """Find the input message object. | ||||
|  | ||||
|         Returns | ||||
|         ------- | ||||
|         Optional[MessageCompiler] | ||||
|             Method instance representing the input message. | ||||
|             If not input message could be found or there are no | ||||
|             input messages, None is returned. | ||||
|         """ | ||||
|         package, name = parse_source_type_name(self.proto_obj.input_type) | ||||
|  | ||||
|         # Nested types are currently flattened without dots. | ||||
|         # Todo: keep a fully quantified name in types, that is | ||||
|         # comparable with method.input_type | ||||
|         for msg in self.request.all_messages: | ||||
|             if ( | ||||
|                 msg.py_name == pythonize_class_name(name.replace(".", "")) | ||||
|                 and msg.output_file.package == package | ||||
|             ): | ||||
|                 return msg | ||||
|         return None | ||||
|  | ||||
|     @property | ||||
|     def py_input_message_type(self) -> str: | ||||
|         """String representation of the Python type corresponding to the | ||||
|   | ||||
| @@ -74,7 +74,7 @@ class {{ service.py_name }}Stub(betterproto.ServiceStub): | ||||
|     {% for method in service.methods %} | ||||
|     async def {{ method.py_name }}(self | ||||
|         {%- if not method.client_streaming -%} | ||||
|             {%- if method.py_input_message -%}, {{ method.py_input_message_param }}: "{{ method.py_input_message_type }}"{%- endif -%} | ||||
|             , {{ method.py_input_message_param }}: "{{ method.py_input_message_type }}" | ||||
|         {%- else -%} | ||||
|             {# Client streaming: need a request iterator instead #} | ||||
|             , {{ method.py_input_message_param }}_iterator: {{ output_file.typing_compiler.union(output_file.typing_compiler.async_iterable(method.py_input_message_type), output_file.typing_compiler.iterable(method.py_input_message_type)) }} | ||||
| @@ -153,7 +153,7 @@ class {{ service.py_name }}Base(ServiceBase): | ||||
|     {% for method in service.methods %} | ||||
|     async def {{ method.py_name }}(self | ||||
|         {%- if not method.client_streaming -%} | ||||
|             {%- if method.py_input_message -%}, {{ method.py_input_message_param }}: "{{ method.py_input_message_type }}"{%- endif -%} | ||||
|             , {{ method.py_input_message_param }}: "{{ method.py_input_message_type }}" | ||||
|         {%- else -%} | ||||
|             {# Client streaming: need a request iterator instead #} | ||||
|             , {{ method.py_input_message_param }}_iterator: {{ output_file.typing_compiler.async_iterator(method.py_input_message_type) }} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user