Skip to content

Commit 02bfacc

Browse files
committed
address review feedback
1 parent b4b8c20 commit 02bfacc

4 files changed

Lines changed: 9 additions & 9 deletions

File tree

  • packages/gapic-generator

‎packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/base.py.j2‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{% block content %}
44

55
import abc
6-
from typing import {% if service.any_extended_operations_methods or service.has_resumable_upload_methods %}Any, {% endif %}Awaitable, Callable, Dict, Optional, Sequence, Union
6+
from typing import {% if service.any_extended_operations_methods %}Any, {% endif %}Awaitable, Callable, Dict, Optional, Sequence, Union
77

88
{% set package_path = api.naming.module_namespace|join('.') + "." + api.naming.versioned_module_name %}
99
from {{package_path}} import gapic_version as package_version
@@ -141,12 +141,9 @@ class {{ service.name }}Transport(abc.ABC):
141141
credentials = credentials.with_always_use_jwt_access(True)
142142

143143
# Save the credentials.
144-
{% if service.has_resumable_upload_methods %}
145-
#self._credentials: Any = credentials
146144
self._credentials = credentials
145+
{% if service.has_resumable_upload_methods %}
147146
self._client_info = client_info
148-
{% else %}
149-
self._credentials = credentials
150147
{% endif %}
151148

152149
# Save the hostname. Default to port 443 (HTTPS) if none is specified.

‎packages/gapic-generator/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/grpc_asyncio.py.j2‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,13 @@ class {{ service.grpc_asyncio_transport_name }}({{ service.name }}Transport):
393393
class _AsyncRestStub:
394394
def __call__(self, *args, **kwargs):
395395
if transport._rest_transport is None:
396+
{# Note: Type for creds is ignored due to the type hint mismatch for credentials in the base transport.
397+
# TODO(https://github.com/googleapis/google-cloud-python/issues/16268): Remove `# type: ignore` once
398+
# the type hints for credentials are updated to include asynchronous credentials.
399+
#}
396400
transport._rest_transport = Async{{ service.name }}RestTransport(
397401
host=transport._host,
398-
credentials=transport._credentials,
402+
credentials=transport._credentials, # type: ignore
399403
client_info=transport._client_info,
400404
)
401405
return transport._rest_transport.{{ method.transport_safe_name|snake_case }}(*args, **kwargs)

‎packages/gapic-generator/tests/integration/goldens/showcase/google/showcase_v1beta1/services/resumable_upload_service/transports/base.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616
import abc
17-
from typing import Any, Awaitable, Callable, Dict, Optional, Sequence, Union
17+
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
1818

1919
from google.showcase_v1beta1 import gapic_version as package_version
2020

@@ -116,7 +116,6 @@ def __init__(
116116
credentials = credentials.with_always_use_jwt_access(True)
117117

118118
# Save the credentials.
119-
#self._credentials: Any = credentials
120119
self._credentials = credentials
121120
self._client_info = client_info
122121

‎packages/gapic-generator/tests/integration/goldens/showcase/google/showcase_v1beta1/services/resumable_upload_service/transports/grpc_asyncio.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ def __call__(self, *args, **kwargs):
373373
if transport._rest_transport is None:
374374
transport._rest_transport = AsyncResumableUploadServiceRestTransport(
375375
host=transport._host,
376-
credentials=transport._credentials,
376+
credentials=transport._credentials, # type: ignore
377377
client_info=transport._client_info,
378378
)
379379
return transport._rest_transport.upload_media(*args, **kwargs)

0 commit comments

Comments
 (0)