@@ -100,20 +100,20 @@ class {{ service.py_name }}Stub(betterproto2.ServiceStub):
100100 {% - if not method .client_streaming -%}
101101 , message:
102102 {% - if method .is_input_msg_empty -%}
103- "{{ output_file.settings.typing_compiler.optional( method.py_input_message_type) }}" = None
103+ "{{ method.py_input_message_type }} | None " = None
104104 {% - else -%}
105105 "{{ method.py_input_message_type }}"
106106 {% - endif -%}
107107 {% - else -%}
108108 {# Client streaming: need a request iterator instead #}
109- , messages: "{{ output_file.settings.typing_compiler.union(output_file.settings.typing_compiler.async_iterable( method.py_input_message_type), output_file.settings.typing_compiler.iterable( method.py_input_message_type)) }}"
109+ , messages: "AsyncIterable[ {{ method.py_input_message_type }}] | Iterable[{{ method.py_input_message_type }}] "
110110 {% - endif -%}
111111 ,
112112 *
113- , timeout: {{ output_file.settings.typing_compiler.optional( "float") }} = None
114- , deadline: "{{ output_file.settings.typing_compiler.optional(" Deadline") }} " = None
115- , metadata: "{{ output_file.settings.typing_compiler.optional(" MetadataLike") }} " = None
116- ) -> "{% if method .server_streaming %} {{ output_file.settings.typing_compiler.async_iterator( method.py_output_message_type ) }} {% else %} {{ method.py_output_message_type }}{% endif %} ":
113+ , timeout: "float | None" = None
114+ , deadline: "Deadline | None " = None
115+ , metadata: "MetadataLike | None " = None
116+ ) -> "{% if method .server_streaming %} AsyncIterator[ {{ method.py_output_message_type }}] {% else %} {{ method.py_output_message_type }}{% endif %} ":
117117 {% if method .comment %}
118118 """
119119 {{ method.comment | indent(8) }}
@@ -202,9 +202,9 @@ class {{ service.py_name }}Base(ServiceBase):
202202 , message: "{{ method.py_input_message_type }}"
203203 {% - else -%}
204204 {# Client streaming: need a request iterator instead #}
205- , messages: {{ output_file.settings.typing_compiler.async_iterator( method.py_input_message_type) }}
205+ , messages: "AsyncIterator[ {{ method.py_input_message_type }}]"
206206 {% - endif -%}
207- ) -> {% if method .server_streaming %} {{ output_file.settings.typing_compiler.async_iterator( method.py_output_message_type) }}{% else %} "{{ method.py_output_message_type }}"{% endif %} :
207+ ) -> {% if method .server_streaming %} "AsyncIterator[ {{ method.py_output_message_type }}]" {% else %} "{{ method.py_output_message_type }}"{% endif %} :
208208 {% if method .comment %}
209209 """
210210 {{ method.comment | indent(8) }}
@@ -235,7 +235,7 @@ class {{ service.py_name }}Base(ServiceBase):
235235
236236 {% endfor %}
237237
238- def __mapping__(self) -> {{ output_file.settings.typing_compiler.dict(" str", " grpclib.const.Handler") }} :
238+ def __mapping__(self) -> "dict[ str, grpclib.const.Handler":
239239 return {
240240 {% for method in service .methods %}
241241 "{{ method.route }}": grpclib.const.Handler(
0 commit comments