diff --git a/src/betterproto/plugin/models.py b/src/betterproto/plugin/models.py index 03834a7ee..6356f906d 100644 --- a/src/betterproto/plugin/models.py +++ b/src/betterproto/plugin/models.py @@ -755,30 +755,6 @@ def route(self) -> str: ) 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 diff --git a/src/betterproto/templates/template.py.j2 b/src/betterproto/templates/template.py.j2 index 61e7edb2d..e8ed3d8f4 100644 --- a/src/betterproto/templates/template.py.j2 +++ b/src/betterproto/templates/template.py.j2 @@ -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) }}