Skip to content

Commit a9246fa

Browse files
authored
Revert "fix(generator): use flat_ref_types in test templates and delete remove-unused-imports" (#18088)
Reverts #17900
1 parent b9f0747 commit a9246fa

11 files changed

Lines changed: 31 additions & 2 deletions

File tree

packages/gapic-generator/gapic/ads-templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ from google.longrunning import operations_pb2 # type: ignore
5757
{% endif %}
5858
from google.api_core import gapic_v1
5959
{% for method in service.methods.values() %}
60-
{% for ref_type in method.flat_ref_types
60+
{% for ref_type in method.ref_types
6161
if not ((ref_type.ident.python_import.package == ('google', 'api_core') and ref_type.ident.python_import.module == 'operation')
6262
or ref_type.ident.python_import.package == ('google', 'protobuf') and ref_type.ident.python_import.module == 'empty_pb2') %}
6363
{{ ref_type.ident.python_import }}

packages/gapic-generator/gapic/templates/tests/unit/gapic/%name_%version/%sub/test_%service.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ from google.longrunning import operations_pb2 # type: ignore
8686
{% endif %}
8787
from google.api_core import gapic_v1
8888
{% for method in service.methods.values() %}
89-
{% for ref_type in method.flat_ref_types
89+
{% for ref_type in method.ref_types
9090
if not (ref_type.ident.python_import.package == ('google', 'api_core') and ref_type.ident.python_import.module == 'operation') %}
9191
{{ ref_type.ident.python_import }}
9292
{% endfor %}

packages/gapic-generator/tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
from google.oauth2 import service_account
6363
import google.api_core.operation_async as operation_async # type: ignore
6464
import google.auth
65+
import google.protobuf.duration_pb2 as duration_pb2 # type: ignore
6566
import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
6667
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
6768
import google.rpc.status_pb2 as status_pb2 # type: ignore

packages/gapic-generator/tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
from google.cloud.eventarc_v1.types import logging_config
7272
from google.cloud.eventarc_v1.types import message_bus
7373
from google.cloud.eventarc_v1.types import message_bus as gce_message_bus
74+
from google.cloud.eventarc_v1.types import network_config
7475
from google.cloud.eventarc_v1.types import pipeline
7576
from google.cloud.eventarc_v1.types import pipeline as gce_pipeline
7677
from google.cloud.eventarc_v1.types import trigger
@@ -83,8 +84,10 @@
8384
from google.oauth2 import service_account
8485
import google.api_core.operation_async as operation_async # type: ignore
8586
import google.auth
87+
import google.protobuf.duration_pb2 as duration_pb2 # type: ignore
8688
import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
8789
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
90+
import google.rpc.code_pb2 as code_pb2 # type: ignore
8891

8992

9093

packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@
5353
from google.oauth2 import service_account
5454
import google.api.monitored_resource_pb2 as monitored_resource_pb2 # type: ignore
5555
import google.auth
56+
import google.logging.type.http_request_pb2 as http_request_pb2 # type: ignore
57+
import google.logging.type.log_severity_pb2 as log_severity_pb2 # type: ignore
58+
import google.protobuf.any_pb2 as any_pb2 # type: ignore
59+
import google.protobuf.duration_pb2 as duration_pb2 # type: ignore
60+
import google.protobuf.struct_pb2 as struct_pb2 # type: ignore
61+
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
5662

5763

5864

packages/gapic-generator/tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_metrics_service_v2.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@
5151
from google.longrunning import operations_pb2 # type: ignore
5252
from google.oauth2 import service_account
5353
import google.api.distribution_pb2 as distribution_pb2 # type: ignore
54+
import google.api.label_pb2 as label_pb2 # type: ignore
55+
import google.api.launch_stage_pb2 as launch_stage_pb2 # type: ignore
5456
import google.api.metric_pb2 as metric_pb2 # type: ignore
5557
import google.auth
58+
import google.protobuf.duration_pb2 as duration_pb2 # type: ignore
5659
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
5760

5861

packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_logging_service_v2.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@
5353
from google.oauth2 import service_account
5454
import google.api.monitored_resource_pb2 as monitored_resource_pb2 # type: ignore
5555
import google.auth
56+
import google.logging.type.http_request_pb2 as http_request_pb2 # type: ignore
57+
import google.logging.type.log_severity_pb2 as log_severity_pb2 # type: ignore
58+
import google.protobuf.any_pb2 as any_pb2 # type: ignore
59+
import google.protobuf.duration_pb2 as duration_pb2 # type: ignore
60+
import google.protobuf.struct_pb2 as struct_pb2 # type: ignore
61+
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
5662

5763

5864

packages/gapic-generator/tests/integration/goldens/logging_internal/tests/unit/gapic/logging_v2/test_metrics_service_v2.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@
5151
from google.longrunning import operations_pb2 # type: ignore
5252
from google.oauth2 import service_account
5353
import google.api.distribution_pb2 as distribution_pb2 # type: ignore
54+
import google.api.label_pb2 as label_pb2 # type: ignore
55+
import google.api.launch_stage_pb2 as launch_stage_pb2 # type: ignore
5456
import google.api.metric_pb2 as metric_pb2 # type: ignore
5557
import google.auth
58+
import google.protobuf.duration_pb2 as duration_pb2 # type: ignore
5659
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
5760

5861

packages/gapic-generator/tests/integration/goldens/redis/tests/unit/gapic/redis_v1/test_cloud_redis.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,12 @@
6969
from google.oauth2 import service_account
7070
import google.api_core.operation_async as operation_async # type: ignore
7171
import google.auth
72+
import google.protobuf.duration_pb2 as duration_pb2 # type: ignore
7273
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
7374
import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
7475
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
76+
import google.type.dayofweek_pb2 as dayofweek_pb2 # type: ignore
77+
import google.type.timeofday_pb2 as timeofday_pb2 # type: ignore
7578

7679

7780

packages/gapic-generator/tests/integration/goldens/redis_selective/tests/unit/gapic/redis_v1/test_cloud_redis.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,12 @@
6969
from google.oauth2 import service_account
7070
import google.api_core.operation_async as operation_async # type: ignore
7171
import google.auth
72+
import google.protobuf.duration_pb2 as duration_pb2 # type: ignore
7273
import google.protobuf.empty_pb2 as empty_pb2 # type: ignore
7374
import google.protobuf.field_mask_pb2 as field_mask_pb2 # type: ignore
7475
import google.protobuf.timestamp_pb2 as timestamp_pb2 # type: ignore
76+
import google.type.dayofweek_pb2 as dayofweek_pb2 # type: ignore
77+
import google.type.timeofday_pb2 as timeofday_pb2 # type: ignore
7578

7679

7780

0 commit comments

Comments
 (0)