From 355f21ae36307bb3ff743f43c5532ac57ce59de0 Mon Sep 17 00:00:00 2001 From: dpcollins-google <40498610+dpcollins-google@users.noreply.github.com> Date: Thu, 8 Oct 2020 16:21:47 -0400 Subject: [PATCH 1/2] fix: Fix types on server and bidi streaming callables --- .../%name_%version/%sub/services/%service/async_client.py.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 index 14be05325d..4f67361167 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 @@ -4,7 +4,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, {% if service.any_server_streaming %}AsyncIterable, {% endif %}{% if service.any_client_streaming %}AsyncIterator, {% endif %}Sequence, Tuple, Type, Union +from typing import Dict, {% if service.any_server_streaming %}AsyncIterable, AsyncIterator, Awaitable{% endif %}Sequence, Tuple, Type, Union import pkg_resources import google.api_core.client_options as ClientOptions # type: ignore @@ -117,7 +117,7 @@ class {{ service.async_client_name }}: {%- if not method.server_streaming %} ) -> {{ method.client_output_async.ident }}: {%- else %} - ) -> AsyncIterable[{{ method.client_output_async.ident }}]: + ) -> Awaitable[AsyncIterable[{{ method.client_output_async.ident }}]]: {%- endif %} r"""{{ method.meta.doc|rst(width=72, indent=8) }} From e27b9a30c66fc68375c28038f390d4102dae46d6 Mon Sep 17 00:00:00 2001 From: dpcollins-google <40498610+dpcollins-google@users.noreply.github.com> Date: Thu, 8 Oct 2020 16:23:54 -0400 Subject: [PATCH 2/2] fix: Fix imports --- .../%name_%version/%sub/services/%service/async_client.py.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 index 4f67361167..bdc7ce4d0d 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 @@ -4,7 +4,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, {% if service.any_server_streaming %}AsyncIterable, AsyncIterator, Awaitable{% endif %}Sequence, Tuple, Type, Union +from typing import Dict, {% if service.any_server_streaming %}AsyncIterable, Awaitable, {% endif %}{% if service.any_client_streaming %}AsyncIterator, {% endif %}Sequence, Tuple, Type, Union import pkg_resources import google.api_core.client_options as ClientOptions # type: ignore