Skip to content

Commit eb95832

Browse files
authored
fix: operation module is properly aliased if necessary (#615)
Some APIs define their own module named 'operation' that naively clashes with google.api_core.operation. Both modules are imported with a disambiguating alias, but the alias was not always referenced for the api_core submodule. This change fixes that issue. Fix for #610
1 parent 3994cb8 commit eb95832

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

packages/gapic-generator/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/client.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
369369
{%- if method.lro %}
370370

371371
# Wrap the response in an operation future.
372-
response = operation.from_gapic(
372+
response = {{ method.client_output.ident.module_alias or method.client_output.ident.module }}.from_gapic(
373373
response,
374374
self._transport.operations_client,
375375
{{ method.lro.response_type.ident }},

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ class {{ service.async_client_name }}:
240240
{%- if method.lro %}
241241

242242
# Wrap the response in an operation future.
243-
response = operation_async.from_gapic(
243+
response = {{ method.client_output_async.ident.module_alias or method.client_output_async.ident.module }}.from_gapic(
244244
response,
245245
self._client._transport.operations_client,
246246
{{ method.lro.response_type.ident }},

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
381381
{%- if method.lro %}
382382

383383
# Wrap the response in an operation future.
384-
response = operation.from_gapic(
384+
response = {{ method.client_output.ident.module_alias or method.client_output.ident.module }}.from_gapic(
385385
response,
386386
self._transport.operations_client,
387387
{{ method.lro.response_type.ident }},

0 commit comments

Comments
 (0)