From 03a240c82a3a7f8ed1479a3e915d36342a977dd0 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 16 Feb 2023 17:22:45 +0000 Subject: [PATCH 1/9] fix: run mypy on golden files --- .github/workflows/tests.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index f5d93d6fe2..999505e5da 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -313,11 +313,11 @@ jobs: python -m pip install nox - name: Run blacken and lint on the generated output. run: | - nox -f tests/integration/goldens/asset/noxfile.py -s blacken lint_setup_py lint - nox -f tests/integration/goldens/credentials/noxfile.py -s blacken lint_setup_py lint - nox -f tests/integration/goldens/eventarc/noxfile.py -s blacken lint_setup_py lint - nox -f tests/integration/goldens/logging/noxfile.py -s blacken lint_setup_py lint - nox -f tests/integration/goldens/redis/noxfile.py -s blacken lint_setup_py lint + nox -f tests/integration/goldens/asset/noxfile.py -s mypy blacken lint_setup_py lint + nox -f tests/integration/goldens/credentials/noxfile.py -s mypy blacken lint_setup_py lint + nox -f tests/integration/goldens/eventarc/noxfile.py -s mypy blacken lint_setup_py lint + nox -f tests/integration/goldens/logging/noxfile.py -s mypy blacken lint_setup_py lint + nox -f tests/integration/goldens/redis/noxfile.py -s mypy blacken lint_setup_py lint style-check: runs-on: ubuntu-latest steps: From e0d938bac8b7487d262502e27b874751f2d375a1 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 16 Feb 2023 18:11:50 +0000 Subject: [PATCH 2/9] fix mypy error --- .../%name/%version/%sub/services/%service/transports/rest.py.j2 | 2 +- .../%name_%version/%sub/services/%service/transports/rest.py.j2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/rest.py.j2 b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/rest.py.j2 index bf8946c529..b917e7a43f 100644 --- a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/rest.py.j2 +++ b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/rest.py.j2 @@ -269,7 +269,7 @@ class {{service.name}}RestTransport({{service.name}}Transport): {% if not method.client_streaming %} {% if method.input.required_fields %} - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { {% for req_field in method.input.required_fields if req_field.name in method.query_params %} "{{ req_field.name | camel_case }}" : {% if req_field.field_pb.type == 9 %}"{{req_field.field_pb.default_value }}"{% elif req_field.field_pb.type in [11, 14] %}{}{% else %}{{ req_field.type.python_type(req_field.field_pb.default_value or 0) }}{% endif %},{# default is str #} {% endfor %} diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 index 8d3661c0fc..786aa49954 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 @@ -299,7 +299,7 @@ class {{service.name}}RestTransport({{service.name}}Transport): {% if not method.client_streaming %} {% if method.input.required_fields %} - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { {% for req_field in method.input.required_fields if req_field.name in method.query_params %} "{{ req_field.name | camel_case }}" : {% if req_field.field_pb.type == 9 %}"{{req_field.field_pb.default_value }}"{% elif req_field.field_pb.type in [11, 14] %}{}{% else %}{{ req_field.type.python_type(req_field.field_pb.default_value or 0) }}{% endif %},{# default is str #} {% endfor %} From 10cc57cffffdb80b7794fe834c4705b759873d78 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 16 Feb 2023 18:21:04 +0000 Subject: [PATCH 3/9] update golden files --- .../services/asset_service/transports/rest.py | 24 +++++----- .../iam_credentials/transports/rest.py | 8 ++-- .../services/eventarc/transports/rest.py | 10 ++-- .../config_service_v2/transports/rest.py | 46 +++++++++---------- .../logging_service_v2/transports/rest.py | 8 ++-- .../metrics_service_v2/transports/rest.py | 10 ++-- .../services/cloud_redis/transports/rest.py | 18 ++++---- 7 files changed, 62 insertions(+), 62 deletions(-) diff --git a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/rest.py b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/rest.py index 529d6614a3..3f5899ee70 100755 --- a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/rest.py +++ b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/rest.py @@ -481,7 +481,7 @@ class _AnalyzeIamPolicy(AssetServiceRestStub): def __hash__(self): return hash("AnalyzeIamPolicy") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { "analysisQuery" : {}, } @classmethod @@ -561,7 +561,7 @@ class _AnalyzeIamPolicyLongrunning(AssetServiceRestStub): def __hash__(self): return hash("AnalyzeIamPolicyLongrunning") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -650,7 +650,7 @@ class _BatchGetAssetsHistory(AssetServiceRestStub): def __hash__(self): return hash("BatchGetAssetsHistory") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -726,7 +726,7 @@ class _CreateFeed(AssetServiceRestStub): def __hash__(self): return hash("CreateFeed") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -818,7 +818,7 @@ class _DeleteFeed(AssetServiceRestStub): def __hash__(self): return hash("DeleteFeed") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -882,7 +882,7 @@ class _ExportAssets(AssetServiceRestStub): def __hash__(self): return hash("ExportAssets") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -968,7 +968,7 @@ class _GetFeed(AssetServiceRestStub): def __hash__(self): return hash("GetFeed") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -1051,7 +1051,7 @@ class _ListAssets(AssetServiceRestStub): def __hash__(self): return hash("ListAssets") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -1127,7 +1127,7 @@ class _ListFeeds(AssetServiceRestStub): def __hash__(self): return hash("ListFeeds") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -1203,7 +1203,7 @@ class _SearchAllIamPolicies(AssetServiceRestStub): def __hash__(self): return hash("SearchAllIamPolicies") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -1279,7 +1279,7 @@ class _SearchAllResources(AssetServiceRestStub): def __hash__(self): return hash("SearchAllResources") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -1355,7 +1355,7 @@ class _UpdateFeed(AssetServiceRestStub): def __hash__(self): return hash("UpdateFeed") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod diff --git a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/rest.py b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/rest.py index 6bb11e7d48..1a6985e2b0 100755 --- a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/rest.py +++ b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/rest.py @@ -281,7 +281,7 @@ class _GenerateAccessToken(IAMCredentialsRestStub): def __hash__(self): return hash("GenerateAccessToken") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -366,7 +366,7 @@ class _GenerateIdToken(IAMCredentialsRestStub): def __hash__(self): return hash("GenerateIdToken") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -451,7 +451,7 @@ class _SignBlob(IAMCredentialsRestStub): def __hash__(self): return hash("SignBlob") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -536,7 +536,7 @@ class _SignJwt(IAMCredentialsRestStub): def __hash__(self): return hash("SignJwt") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod diff --git a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/rest.py b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/rest.py index d107065ba7..79cd1a6176 100755 --- a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/rest.py +++ b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/rest.py @@ -327,7 +327,7 @@ class _CreateTrigger(EventarcRestStub): def __hash__(self): return hash("CreateTrigger") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { "triggerId" : "", "validateOnly" : False, } @classmethod @@ -415,7 +415,7 @@ class _DeleteTrigger(EventarcRestStub): def __hash__(self): return hash("DeleteTrigger") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { "validateOnly" : False, } @classmethod @@ -494,7 +494,7 @@ class _GetTrigger(EventarcRestStub): def __hash__(self): return hash("GetTrigger") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -574,7 +574,7 @@ class _ListTriggers(EventarcRestStub): def __hash__(self): return hash("ListTriggers") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -654,7 +654,7 @@ class _UpdateTrigger(EventarcRestStub): def __hash__(self): return hash("UpdateTrigger") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { "validateOnly" : False, } @classmethod diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/rest.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/rest.py index d414a966e5..0f2c0ea503 100755 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/rest.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/rest.py @@ -669,7 +669,7 @@ class _CreateBucket(ConfigServiceV2RestStub): def __hash__(self): return hash("CreateBucket") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { "bucketId" : "", } @classmethod @@ -774,7 +774,7 @@ class _CreateExclusion(ConfigServiceV2RestStub): def __hash__(self): return hash("CreateExclusion") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -890,7 +890,7 @@ class _CreateSink(ConfigServiceV2RestStub): def __hash__(self): return hash("CreateSink") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -1004,7 +1004,7 @@ class _CreateView(ConfigServiceV2RestStub): def __hash__(self): return hash("CreateView") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { "viewId" : "", } @classmethod @@ -1111,7 +1111,7 @@ class _DeleteBucket(ConfigServiceV2RestStub): def __hash__(self): return hash("DeleteBucket") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -1191,7 +1191,7 @@ class _DeleteExclusion(ConfigServiceV2RestStub): def __hash__(self): return hash("DeleteExclusion") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -1271,7 +1271,7 @@ class _DeleteSink(ConfigServiceV2RestStub): def __hash__(self): return hash("DeleteSink") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -1351,7 +1351,7 @@ class _DeleteView(ConfigServiceV2RestStub): def __hash__(self): return hash("DeleteView") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -1431,7 +1431,7 @@ class _GetBucket(ConfigServiceV2RestStub): def __hash__(self): return hash("GetBucket") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -1523,7 +1523,7 @@ class _GetCmekSettings(ConfigServiceV2RestStub): def __hash__(self): return hash("GetCmekSettings") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -1621,7 +1621,7 @@ class _GetExclusion(ConfigServiceV2RestStub): def __hash__(self): return hash("GetExclusion") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -1724,7 +1724,7 @@ class _GetSink(ConfigServiceV2RestStub): def __hash__(self): return hash("GetSink") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -1825,7 +1825,7 @@ class _GetView(ConfigServiceV2RestStub): def __hash__(self): return hash("GetView") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -1919,7 +1919,7 @@ class _ListBuckets(ConfigServiceV2RestStub): def __hash__(self): return hash("ListBuckets") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -2011,7 +2011,7 @@ class _ListExclusions(ConfigServiceV2RestStub): def __hash__(self): return hash("ListExclusions") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -2103,7 +2103,7 @@ class _ListSinks(ConfigServiceV2RestStub): def __hash__(self): return hash("ListSinks") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -2195,7 +2195,7 @@ class _ListViews(ConfigServiceV2RestStub): def __hash__(self): return hash("ListViews") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -2287,7 +2287,7 @@ class _UndeleteBucket(ConfigServiceV2RestStub): def __hash__(self): return hash("UndeleteBucket") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -2380,7 +2380,7 @@ class _UpdateBucket(ConfigServiceV2RestStub): def __hash__(self): return hash("UpdateBucket") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { "updateMask" : {}, } @classmethod @@ -2485,7 +2485,7 @@ class _UpdateCmekSettings(ConfigServiceV2RestStub): def __hash__(self): return hash("UpdateCmekSettings") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -2593,7 +2593,7 @@ class _UpdateExclusion(ConfigServiceV2RestStub): def __hash__(self): return hash("UpdateExclusion") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { "updateMask" : {}, } @classmethod @@ -2709,7 +2709,7 @@ class _UpdateSink(ConfigServiceV2RestStub): def __hash__(self): return hash("UpdateSink") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -2843,7 +2843,7 @@ class _UpdateView(ConfigServiceV2RestStub): def __hash__(self): return hash("UpdateView") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/rest.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/rest.py index 6dca3bcbb9..36c21e676c 100755 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/rest.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/rest.py @@ -285,7 +285,7 @@ class _DeleteLog(LoggingServiceV2RestStub): def __hash__(self): return hash("DeleteLog") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -365,7 +365,7 @@ class _ListLogEntries(LoggingServiceV2RestStub): def __hash__(self): return hash("ListLogEntries") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -450,7 +450,7 @@ class _ListLogs(LoggingServiceV2RestStub): def __hash__(self): return hash("ListLogs") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -628,7 +628,7 @@ class _WriteLogEntries(LoggingServiceV2RestStub): def __hash__(self): return hash("WriteLogEntries") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/rest.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/rest.py index a7d2de532b..42c49b21ba 100755 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/rest.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/rest.py @@ -285,7 +285,7 @@ class _CreateLogMetric(MetricsServiceV2RestStub): def __hash__(self): return hash("CreateLogMetric") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -381,7 +381,7 @@ class _DeleteLogMetric(MetricsServiceV2RestStub): def __hash__(self): return hash("DeleteLogMetric") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -445,7 +445,7 @@ class _GetLogMetric(MetricsServiceV2RestStub): def __hash__(self): return hash("GetLogMetric") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -532,7 +532,7 @@ class _ListLogMetrics(MetricsServiceV2RestStub): def __hash__(self): return hash("ListLogMetrics") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -608,7 +608,7 @@ class _UpdateLogMetric(MetricsServiceV2RestStub): def __hash__(self): return hash("UpdateLogMetric") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod diff --git a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/rest.py b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/rest.py index c9bda09ab8..73d3f1cbef 100755 --- a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/rest.py +++ b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/rest.py @@ -440,7 +440,7 @@ class _CreateInstance(CloudRedisRestStub): def __hash__(self): return hash("CreateInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { "instanceId" : "", } @classmethod @@ -528,7 +528,7 @@ class _DeleteInstance(CloudRedisRestStub): def __hash__(self): return hash("DeleteInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -607,7 +607,7 @@ class _ExportInstance(CloudRedisRestStub): def __hash__(self): return hash("ExportInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -695,7 +695,7 @@ class _FailoverInstance(CloudRedisRestStub): def __hash__(self): return hash("FailoverInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -783,7 +783,7 @@ class _GetInstance(CloudRedisRestStub): def __hash__(self): return hash("GetInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -861,7 +861,7 @@ class _ImportInstance(CloudRedisRestStub): def __hash__(self): return hash("ImportInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -949,7 +949,7 @@ class _ListInstances(CloudRedisRestStub): def __hash__(self): return hash("ListInstances") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod @@ -1029,7 +1029,7 @@ class _UpdateInstance(CloudRedisRestStub): def __hash__(self): return hash("UpdateInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { "updateMask" : {}, } @classmethod @@ -1117,7 +1117,7 @@ class _UpgradeInstance(CloudRedisRestStub): def __hash__(self): return hash("UpgradeInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, str] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { } @classmethod From ae7fe21a0c7613106a17bec29141edcab35746f2 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 16 Feb 2023 18:36:37 +0000 Subject: [PATCH 4/9] use type Any --- .../%version/%sub/services/%service/transports/rest.py.j2 | 4 ++-- .../%sub/services/%service/transports/rest.py.j2 | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/rest.py.j2 b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/rest.py.j2 index b917e7a43f..5c2d102f48 100644 --- a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/rest.py.j2 +++ b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/rest.py.j2 @@ -22,7 +22,7 @@ from google.api_core import operations_v1 from requests import __version__ as requests_version import dataclasses import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -269,7 +269,7 @@ class {{service.name}}RestTransport({{service.name}}Transport): {% if not method.client_streaming %} {% if method.input.required_fields %} - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { {% for req_field in method.input.required_fields if req_field.name in method.query_params %} "{{ req_field.name | camel_case }}" : {% if req_field.field_pb.type == 9 %}"{{req_field.field_pb.default_value }}"{% elif req_field.field_pb.type in [11, 14] %}{}{% else %}{{ req_field.type.python_type(req_field.field_pb.default_value or 0) }}{% endif %},{# default is str #} {% endfor %} diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 index 786aa49954..7d8e72846e 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 @@ -32,7 +32,7 @@ from google.longrunning import operations_pb2 from requests import __version__ as requests_version import dataclasses import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -299,7 +299,7 @@ class {{service.name}}RestTransport({{service.name}}Transport): {% if not method.client_streaming %} {% if method.input.required_fields %} - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { {% for req_field in method.input.required_fields if req_field.name in method.query_params %} "{{ req_field.name | camel_case }}" : {% if req_field.field_pb.type == 9 %}"{{req_field.field_pb.default_value }}"{% elif req_field.field_pb.type in [11, 14] %}{}{% else %}{{ req_field.type.python_type(req_field.field_pb.default_value or 0) }}{% endif %},{# default is str #} {% endfor %} From 904500b7d97fc32c5d197abd2492988053c714e7 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 16 Feb 2023 18:36:43 +0000 Subject: [PATCH 5/9] update goldens --- .../services/asset_service/transports/rest.py | 26 +++++----- .../iam_credentials/transports/rest.py | 10 ++-- .../services/eventarc/transports/rest.py | 12 ++--- .../config_service_v2/transports/rest.py | 48 +++++++++---------- .../logging_service_v2/transports/rest.py | 10 ++-- .../metrics_service_v2/transports/rest.py | 12 ++--- .../services/cloud_redis/transports/rest.py | 20 ++++---- 7 files changed, 69 insertions(+), 69 deletions(-) diff --git a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/rest.py b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/rest.py index 3f5899ee70..ef684a1424 100755 --- a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/rest.py +++ b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/rest.py @@ -31,7 +31,7 @@ from requests import __version__ as requests_version import dataclasses import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -481,7 +481,7 @@ class _AnalyzeIamPolicy(AssetServiceRestStub): def __hash__(self): return hash("AnalyzeIamPolicy") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { "analysisQuery" : {}, } @classmethod @@ -561,7 +561,7 @@ class _AnalyzeIamPolicyLongrunning(AssetServiceRestStub): def __hash__(self): return hash("AnalyzeIamPolicyLongrunning") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -650,7 +650,7 @@ class _BatchGetAssetsHistory(AssetServiceRestStub): def __hash__(self): return hash("BatchGetAssetsHistory") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -726,7 +726,7 @@ class _CreateFeed(AssetServiceRestStub): def __hash__(self): return hash("CreateFeed") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -818,7 +818,7 @@ class _DeleteFeed(AssetServiceRestStub): def __hash__(self): return hash("DeleteFeed") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -882,7 +882,7 @@ class _ExportAssets(AssetServiceRestStub): def __hash__(self): return hash("ExportAssets") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -968,7 +968,7 @@ class _GetFeed(AssetServiceRestStub): def __hash__(self): return hash("GetFeed") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1051,7 +1051,7 @@ class _ListAssets(AssetServiceRestStub): def __hash__(self): return hash("ListAssets") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1127,7 +1127,7 @@ class _ListFeeds(AssetServiceRestStub): def __hash__(self): return hash("ListFeeds") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1203,7 +1203,7 @@ class _SearchAllIamPolicies(AssetServiceRestStub): def __hash__(self): return hash("SearchAllIamPolicies") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1279,7 +1279,7 @@ class _SearchAllResources(AssetServiceRestStub): def __hash__(self): return hash("SearchAllResources") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1355,7 +1355,7 @@ class _UpdateFeed(AssetServiceRestStub): def __hash__(self): return hash("UpdateFeed") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod diff --git a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/rest.py b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/rest.py index 1a6985e2b0..32eff78924 100755 --- a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/rest.py +++ b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/rest.py @@ -30,7 +30,7 @@ from requests import __version__ as requests_version import dataclasses import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -281,7 +281,7 @@ class _GenerateAccessToken(IAMCredentialsRestStub): def __hash__(self): return hash("GenerateAccessToken") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -366,7 +366,7 @@ class _GenerateIdToken(IAMCredentialsRestStub): def __hash__(self): return hash("GenerateIdToken") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -451,7 +451,7 @@ class _SignBlob(IAMCredentialsRestStub): def __hash__(self): return hash("SignBlob") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -536,7 +536,7 @@ class _SignJwt(IAMCredentialsRestStub): def __hash__(self): return hash("SignJwt") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod diff --git a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/rest.py b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/rest.py index 79cd1a6176..956df80956 100755 --- a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/rest.py +++ b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/rest.py @@ -31,7 +31,7 @@ from requests import __version__ as requests_version import dataclasses import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -327,7 +327,7 @@ class _CreateTrigger(EventarcRestStub): def __hash__(self): return hash("CreateTrigger") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { "triggerId" : "", "validateOnly" : False, } @classmethod @@ -415,7 +415,7 @@ class _DeleteTrigger(EventarcRestStub): def __hash__(self): return hash("DeleteTrigger") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { "validateOnly" : False, } @classmethod @@ -494,7 +494,7 @@ class _GetTrigger(EventarcRestStub): def __hash__(self): return hash("GetTrigger") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -574,7 +574,7 @@ class _ListTriggers(EventarcRestStub): def __hash__(self): return hash("ListTriggers") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -654,7 +654,7 @@ class _UpdateTrigger(EventarcRestStub): def __hash__(self): return hash("UpdateTrigger") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { "validateOnly" : False, } @classmethod diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/rest.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/rest.py index 0f2c0ea503..9fb4a17a30 100755 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/rest.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/rest.py @@ -30,7 +30,7 @@ from requests import __version__ as requests_version import dataclasses import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -669,7 +669,7 @@ class _CreateBucket(ConfigServiceV2RestStub): def __hash__(self): return hash("CreateBucket") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { "bucketId" : "", } @classmethod @@ -774,7 +774,7 @@ class _CreateExclusion(ConfigServiceV2RestStub): def __hash__(self): return hash("CreateExclusion") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -890,7 +890,7 @@ class _CreateSink(ConfigServiceV2RestStub): def __hash__(self): return hash("CreateSink") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1004,7 +1004,7 @@ class _CreateView(ConfigServiceV2RestStub): def __hash__(self): return hash("CreateView") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { "viewId" : "", } @classmethod @@ -1111,7 +1111,7 @@ class _DeleteBucket(ConfigServiceV2RestStub): def __hash__(self): return hash("DeleteBucket") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1191,7 +1191,7 @@ class _DeleteExclusion(ConfigServiceV2RestStub): def __hash__(self): return hash("DeleteExclusion") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1271,7 +1271,7 @@ class _DeleteSink(ConfigServiceV2RestStub): def __hash__(self): return hash("DeleteSink") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1351,7 +1351,7 @@ class _DeleteView(ConfigServiceV2RestStub): def __hash__(self): return hash("DeleteView") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1431,7 +1431,7 @@ class _GetBucket(ConfigServiceV2RestStub): def __hash__(self): return hash("GetBucket") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1523,7 +1523,7 @@ class _GetCmekSettings(ConfigServiceV2RestStub): def __hash__(self): return hash("GetCmekSettings") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1621,7 +1621,7 @@ class _GetExclusion(ConfigServiceV2RestStub): def __hash__(self): return hash("GetExclusion") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1724,7 +1724,7 @@ class _GetSink(ConfigServiceV2RestStub): def __hash__(self): return hash("GetSink") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1825,7 +1825,7 @@ class _GetView(ConfigServiceV2RestStub): def __hash__(self): return hash("GetView") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1919,7 +1919,7 @@ class _ListBuckets(ConfigServiceV2RestStub): def __hash__(self): return hash("ListBuckets") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -2011,7 +2011,7 @@ class _ListExclusions(ConfigServiceV2RestStub): def __hash__(self): return hash("ListExclusions") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -2103,7 +2103,7 @@ class _ListSinks(ConfigServiceV2RestStub): def __hash__(self): return hash("ListSinks") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -2195,7 +2195,7 @@ class _ListViews(ConfigServiceV2RestStub): def __hash__(self): return hash("ListViews") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -2287,7 +2287,7 @@ class _UndeleteBucket(ConfigServiceV2RestStub): def __hash__(self): return hash("UndeleteBucket") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -2380,7 +2380,7 @@ class _UpdateBucket(ConfigServiceV2RestStub): def __hash__(self): return hash("UpdateBucket") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { "updateMask" : {}, } @classmethod @@ -2485,7 +2485,7 @@ class _UpdateCmekSettings(ConfigServiceV2RestStub): def __hash__(self): return hash("UpdateCmekSettings") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -2593,7 +2593,7 @@ class _UpdateExclusion(ConfigServiceV2RestStub): def __hash__(self): return hash("UpdateExclusion") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { "updateMask" : {}, } @classmethod @@ -2709,7 +2709,7 @@ class _UpdateSink(ConfigServiceV2RestStub): def __hash__(self): return hash("UpdateSink") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -2843,7 +2843,7 @@ class _UpdateView(ConfigServiceV2RestStub): def __hash__(self): return hash("UpdateView") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/rest.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/rest.py index 36c21e676c..309e5179fc 100755 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/rest.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/rest.py @@ -30,7 +30,7 @@ from requests import __version__ as requests_version import dataclasses import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -285,7 +285,7 @@ class _DeleteLog(LoggingServiceV2RestStub): def __hash__(self): return hash("DeleteLog") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -365,7 +365,7 @@ class _ListLogEntries(LoggingServiceV2RestStub): def __hash__(self): return hash("ListLogEntries") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -450,7 +450,7 @@ class _ListLogs(LoggingServiceV2RestStub): def __hash__(self): return hash("ListLogs") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -628,7 +628,7 @@ class _WriteLogEntries(LoggingServiceV2RestStub): def __hash__(self): return hash("WriteLogEntries") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/rest.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/rest.py index 42c49b21ba..059ddf19d4 100755 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/rest.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/rest.py @@ -30,7 +30,7 @@ from requests import __version__ as requests_version import dataclasses import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -285,7 +285,7 @@ class _CreateLogMetric(MetricsServiceV2RestStub): def __hash__(self): return hash("CreateLogMetric") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -381,7 +381,7 @@ class _DeleteLogMetric(MetricsServiceV2RestStub): def __hash__(self): return hash("DeleteLogMetric") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -445,7 +445,7 @@ class _GetLogMetric(MetricsServiceV2RestStub): def __hash__(self): return hash("GetLogMetric") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -532,7 +532,7 @@ class _ListLogMetrics(MetricsServiceV2RestStub): def __hash__(self): return hash("ListLogMetrics") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -608,7 +608,7 @@ class _UpdateLogMetric(MetricsServiceV2RestStub): def __hash__(self): return hash("UpdateLogMetric") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod diff --git a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/rest.py b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/rest.py index 73d3f1cbef..e27a5b5374 100755 --- a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/rest.py +++ b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/rest.py @@ -31,7 +31,7 @@ from requests import __version__ as requests_version import dataclasses import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -440,7 +440,7 @@ class _CreateInstance(CloudRedisRestStub): def __hash__(self): return hash("CreateInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { "instanceId" : "", } @classmethod @@ -528,7 +528,7 @@ class _DeleteInstance(CloudRedisRestStub): def __hash__(self): return hash("DeleteInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -607,7 +607,7 @@ class _ExportInstance(CloudRedisRestStub): def __hash__(self): return hash("ExportInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -695,7 +695,7 @@ class _FailoverInstance(CloudRedisRestStub): def __hash__(self): return hash("FailoverInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -783,7 +783,7 @@ class _GetInstance(CloudRedisRestStub): def __hash__(self): return hash("GetInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -861,7 +861,7 @@ class _ImportInstance(CloudRedisRestStub): def __hash__(self): return hash("ImportInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -949,7 +949,7 @@ class _ListInstances(CloudRedisRestStub): def __hash__(self): return hash("ListInstances") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1029,7 +1029,7 @@ class _UpdateInstance(CloudRedisRestStub): def __hash__(self): return hash("UpdateInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { "updateMask" : {}, } @classmethod @@ -1117,7 +1117,7 @@ class _UpgradeInstance(CloudRedisRestStub): def __hash__(self): return hash("UpgradeInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Union[str, Dict]] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod From 4f4897b51cb11754f65881d60a4800ec5219ff64 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 16 Feb 2023 18:39:47 +0000 Subject: [PATCH 6/9] fix test --- .github/workflows/tests.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 999505e5da..775861986c 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -313,11 +313,11 @@ jobs: python -m pip install nox - name: Run blacken and lint on the generated output. run: | - nox -f tests/integration/goldens/asset/noxfile.py -s mypy blacken lint_setup_py lint - nox -f tests/integration/goldens/credentials/noxfile.py -s mypy blacken lint_setup_py lint - nox -f tests/integration/goldens/eventarc/noxfile.py -s mypy blacken lint_setup_py lint - nox -f tests/integration/goldens/logging/noxfile.py -s mypy blacken lint_setup_py lint - nox -f tests/integration/goldens/redis/noxfile.py -s mypy blacken lint_setup_py lint + nox -f tests/integration/goldens/asset/noxfile.py -s mypy-3.11 blacken lint_setup_py lint + nox -f tests/integration/goldens/credentials/noxfile.py -s mypy-3.11 blacken lint_setup_py lint + nox -f tests/integration/goldens/eventarc/noxfile.py -s mypy-3.11 blacken lint_setup_py lint + nox -f tests/integration/goldens/logging/noxfile.py -s mypy-3.11 blacken lint_setup_py lint + nox -f tests/integration/goldens/redis/noxfile.py -s mypy-3.11 blacken lint_setup_py lint style-check: runs-on: ubuntu-latest steps: From 85af54289234d0ed80e6dc6ec43764a21569e92f Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 16 Feb 2023 19:53:27 +0000 Subject: [PATCH 7/9] fix mypy error in types --- .../%namespace/%name/%version/%sub/types/%proto.py.j2 | 2 +- .../templates/%namespace/%name_%version/%sub/types/%proto.py.j2 | 2 +- .../google/iam/credentials_v1/types/iamcredentials.py | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/gapic/ads-templates/%namespace/%name/%version/%sub/types/%proto.py.j2 b/gapic/ads-templates/%namespace/%name/%version/%sub/types/%proto.py.j2 index 81a0755195..8418d42959 100644 --- a/gapic/ads-templates/%namespace/%name/%version/%sub/types/%proto.py.j2 +++ b/gapic/ads-templates/%namespace/%name/%version/%sub/types/%proto.py.j2 @@ -6,8 +6,8 @@ {% if proto.messages|length or proto.all_enums|length %} from typing import MutableMapping, MutableSequence -import proto{% if p != 'proto' %} as {{ p }}{% endif %} # type: ignore {% endif %} +import proto{% if p != 'proto' %} as {{ p }}{% endif %} # type: ignore {% filter sort_lines %} {% for import_ in proto.python_modules %} diff --git a/gapic/templates/%namespace/%name_%version/%sub/types/%proto.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/types/%proto.py.j2 index f5aebf7364..1d94e5a135 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/types/%proto.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/types/%proto.py.j2 @@ -6,8 +6,8 @@ {% if proto.messages|length or proto.all_enums|length %} from typing import MutableMapping, MutableSequence -import proto{% if p != 'proto' %} as {{ p }}{% endif %} # type: ignore {% endif %} +import proto{% if p != 'proto' %} as {{ p }}{% endif %} # type: ignore {% filter sort_lines %} {% for import_ in proto.python_modules %} diff --git a/tests/integration/goldens/credentials/google/iam/credentials_v1/types/iamcredentials.py b/tests/integration/goldens/credentials/google/iam/credentials_v1/types/iamcredentials.py index 3cdecabdc9..ade7a6e16e 100755 --- a/tests/integration/goldens/credentials/google/iam/credentials_v1/types/iamcredentials.py +++ b/tests/integration/goldens/credentials/google/iam/credentials_v1/types/iamcredentials.py @@ -13,6 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import proto # type: ignore __protobuf__ = proto.module( From 2f074630b7d892e103c6598bf0bb7b68c86ced53 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Fri, 17 Feb 2023 00:03:45 +0000 Subject: [PATCH 8/9] remove typing Any --- .../services/%service/transports/rest.py.j2 | 4 +- .../services/%service/transports/rest.py.j2 | 4 +- .../services/asset_service/transports/rest.py | 26 +++++----- .../iam_credentials/transports/rest.py | 10 ++-- .../services/eventarc/transports/rest.py | 12 ++--- .../config_service_v2/transports/rest.py | 48 +++++++++---------- .../logging_service_v2/transports/rest.py | 10 ++-- .../metrics_service_v2/transports/rest.py | 12 ++--- .../services/cloud_redis/transports/rest.py | 20 ++++---- 9 files changed, 73 insertions(+), 73 deletions(-) diff --git a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/rest.py.j2 b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/rest.py.j2 index 5c2d102f48..f5017704d4 100644 --- a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/rest.py.j2 +++ b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/rest.py.j2 @@ -22,7 +22,7 @@ from google.api_core import operations_v1 from requests import __version__ as requests_version import dataclasses import re -from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -269,7 +269,7 @@ class {{service.name}}RestTransport({{service.name}}Transport): {% if not method.client_streaming %} {% if method.input.required_fields %} - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { {% for req_field in method.input.required_fields if req_field.name in method.query_params %} "{{ req_field.name | camel_case }}" : {% if req_field.field_pb.type == 9 %}"{{req_field.field_pb.default_value }}"{% elif req_field.field_pb.type in [11, 14] %}{}{% else %}{{ req_field.type.python_type(req_field.field_pb.default_value or 0) }}{% endif %},{# default is str #} {% endfor %} diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 index 7d8e72846e..b1b756543b 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 @@ -32,7 +32,7 @@ from google.longrunning import operations_pb2 from requests import __version__ as requests_version import dataclasses import re -from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -299,7 +299,7 @@ class {{service.name}}RestTransport({{service.name}}Transport): {% if not method.client_streaming %} {% if method.input.required_fields %} - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { {% for req_field in method.input.required_fields if req_field.name in method.query_params %} "{{ req_field.name | camel_case }}" : {% if req_field.field_pb.type == 9 %}"{{req_field.field_pb.default_value }}"{% elif req_field.field_pb.type in [11, 14] %}{}{% else %}{{ req_field.type.python_type(req_field.field_pb.default_value or 0) }}{% endif %},{# default is str #} {% endfor %} diff --git a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/rest.py b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/rest.py index ef684a1424..2ef50f0c23 100755 --- a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/rest.py +++ b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/rest.py @@ -31,7 +31,7 @@ from requests import __version__ as requests_version import dataclasses import re -from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -481,7 +481,7 @@ class _AnalyzeIamPolicy(AssetServiceRestStub): def __hash__(self): return hash("AnalyzeIamPolicy") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { "analysisQuery" : {}, } @classmethod @@ -561,7 +561,7 @@ class _AnalyzeIamPolicyLongrunning(AssetServiceRestStub): def __hash__(self): return hash("AnalyzeIamPolicyLongrunning") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -650,7 +650,7 @@ class _BatchGetAssetsHistory(AssetServiceRestStub): def __hash__(self): return hash("BatchGetAssetsHistory") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -726,7 +726,7 @@ class _CreateFeed(AssetServiceRestStub): def __hash__(self): return hash("CreateFeed") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -818,7 +818,7 @@ class _DeleteFeed(AssetServiceRestStub): def __hash__(self): return hash("DeleteFeed") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -882,7 +882,7 @@ class _ExportAssets(AssetServiceRestStub): def __hash__(self): return hash("ExportAssets") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -968,7 +968,7 @@ class _GetFeed(AssetServiceRestStub): def __hash__(self): return hash("GetFeed") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -1051,7 +1051,7 @@ class _ListAssets(AssetServiceRestStub): def __hash__(self): return hash("ListAssets") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -1127,7 +1127,7 @@ class _ListFeeds(AssetServiceRestStub): def __hash__(self): return hash("ListFeeds") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -1203,7 +1203,7 @@ class _SearchAllIamPolicies(AssetServiceRestStub): def __hash__(self): return hash("SearchAllIamPolicies") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -1279,7 +1279,7 @@ class _SearchAllResources(AssetServiceRestStub): def __hash__(self): return hash("SearchAllResources") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -1355,7 +1355,7 @@ class _UpdateFeed(AssetServiceRestStub): def __hash__(self): return hash("UpdateFeed") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod diff --git a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/rest.py b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/rest.py index 32eff78924..70d9bba2d6 100755 --- a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/rest.py +++ b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/rest.py @@ -30,7 +30,7 @@ from requests import __version__ as requests_version import dataclasses import re -from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -281,7 +281,7 @@ class _GenerateAccessToken(IAMCredentialsRestStub): def __hash__(self): return hash("GenerateAccessToken") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -366,7 +366,7 @@ class _GenerateIdToken(IAMCredentialsRestStub): def __hash__(self): return hash("GenerateIdToken") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -451,7 +451,7 @@ class _SignBlob(IAMCredentialsRestStub): def __hash__(self): return hash("SignBlob") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -536,7 +536,7 @@ class _SignJwt(IAMCredentialsRestStub): def __hash__(self): return hash("SignJwt") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod diff --git a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/rest.py b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/rest.py index 956df80956..9baa7745f9 100755 --- a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/rest.py +++ b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/rest.py @@ -31,7 +31,7 @@ from requests import __version__ as requests_version import dataclasses import re -from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -327,7 +327,7 @@ class _CreateTrigger(EventarcRestStub): def __hash__(self): return hash("CreateTrigger") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { "triggerId" : "", "validateOnly" : False, } @classmethod @@ -415,7 +415,7 @@ class _DeleteTrigger(EventarcRestStub): def __hash__(self): return hash("DeleteTrigger") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { "validateOnly" : False, } @classmethod @@ -494,7 +494,7 @@ class _GetTrigger(EventarcRestStub): def __hash__(self): return hash("GetTrigger") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -574,7 +574,7 @@ class _ListTriggers(EventarcRestStub): def __hash__(self): return hash("ListTriggers") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -654,7 +654,7 @@ class _UpdateTrigger(EventarcRestStub): def __hash__(self): return hash("UpdateTrigger") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { "validateOnly" : False, } @classmethod diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/rest.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/rest.py index 9fb4a17a30..d7d2391661 100755 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/rest.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/rest.py @@ -30,7 +30,7 @@ from requests import __version__ as requests_version import dataclasses import re -from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -669,7 +669,7 @@ class _CreateBucket(ConfigServiceV2RestStub): def __hash__(self): return hash("CreateBucket") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { "bucketId" : "", } @classmethod @@ -774,7 +774,7 @@ class _CreateExclusion(ConfigServiceV2RestStub): def __hash__(self): return hash("CreateExclusion") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -890,7 +890,7 @@ class _CreateSink(ConfigServiceV2RestStub): def __hash__(self): return hash("CreateSink") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -1004,7 +1004,7 @@ class _CreateView(ConfigServiceV2RestStub): def __hash__(self): return hash("CreateView") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { "viewId" : "", } @classmethod @@ -1111,7 +1111,7 @@ class _DeleteBucket(ConfigServiceV2RestStub): def __hash__(self): return hash("DeleteBucket") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -1191,7 +1191,7 @@ class _DeleteExclusion(ConfigServiceV2RestStub): def __hash__(self): return hash("DeleteExclusion") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -1271,7 +1271,7 @@ class _DeleteSink(ConfigServiceV2RestStub): def __hash__(self): return hash("DeleteSink") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -1351,7 +1351,7 @@ class _DeleteView(ConfigServiceV2RestStub): def __hash__(self): return hash("DeleteView") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -1431,7 +1431,7 @@ class _GetBucket(ConfigServiceV2RestStub): def __hash__(self): return hash("GetBucket") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -1523,7 +1523,7 @@ class _GetCmekSettings(ConfigServiceV2RestStub): def __hash__(self): return hash("GetCmekSettings") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -1621,7 +1621,7 @@ class _GetExclusion(ConfigServiceV2RestStub): def __hash__(self): return hash("GetExclusion") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -1724,7 +1724,7 @@ class _GetSink(ConfigServiceV2RestStub): def __hash__(self): return hash("GetSink") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -1825,7 +1825,7 @@ class _GetView(ConfigServiceV2RestStub): def __hash__(self): return hash("GetView") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -1919,7 +1919,7 @@ class _ListBuckets(ConfigServiceV2RestStub): def __hash__(self): return hash("ListBuckets") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -2011,7 +2011,7 @@ class _ListExclusions(ConfigServiceV2RestStub): def __hash__(self): return hash("ListExclusions") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -2103,7 +2103,7 @@ class _ListSinks(ConfigServiceV2RestStub): def __hash__(self): return hash("ListSinks") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -2195,7 +2195,7 @@ class _ListViews(ConfigServiceV2RestStub): def __hash__(self): return hash("ListViews") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -2287,7 +2287,7 @@ class _UndeleteBucket(ConfigServiceV2RestStub): def __hash__(self): return hash("UndeleteBucket") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -2380,7 +2380,7 @@ class _UpdateBucket(ConfigServiceV2RestStub): def __hash__(self): return hash("UpdateBucket") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { "updateMask" : {}, } @classmethod @@ -2485,7 +2485,7 @@ class _UpdateCmekSettings(ConfigServiceV2RestStub): def __hash__(self): return hash("UpdateCmekSettings") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -2593,7 +2593,7 @@ class _UpdateExclusion(ConfigServiceV2RestStub): def __hash__(self): return hash("UpdateExclusion") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { "updateMask" : {}, } @classmethod @@ -2709,7 +2709,7 @@ class _UpdateSink(ConfigServiceV2RestStub): def __hash__(self): return hash("UpdateSink") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -2843,7 +2843,7 @@ class _UpdateView(ConfigServiceV2RestStub): def __hash__(self): return hash("UpdateView") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/rest.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/rest.py index 309e5179fc..176299783b 100755 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/rest.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/rest.py @@ -30,7 +30,7 @@ from requests import __version__ as requests_version import dataclasses import re -from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -285,7 +285,7 @@ class _DeleteLog(LoggingServiceV2RestStub): def __hash__(self): return hash("DeleteLog") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -365,7 +365,7 @@ class _ListLogEntries(LoggingServiceV2RestStub): def __hash__(self): return hash("ListLogEntries") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -450,7 +450,7 @@ class _ListLogs(LoggingServiceV2RestStub): def __hash__(self): return hash("ListLogs") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -628,7 +628,7 @@ class _WriteLogEntries(LoggingServiceV2RestStub): def __hash__(self): return hash("WriteLogEntries") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/rest.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/rest.py index 059ddf19d4..97724d83e5 100755 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/rest.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/rest.py @@ -30,7 +30,7 @@ from requests import __version__ as requests_version import dataclasses import re -from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -285,7 +285,7 @@ class _CreateLogMetric(MetricsServiceV2RestStub): def __hash__(self): return hash("CreateLogMetric") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -381,7 +381,7 @@ class _DeleteLogMetric(MetricsServiceV2RestStub): def __hash__(self): return hash("DeleteLogMetric") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -445,7 +445,7 @@ class _GetLogMetric(MetricsServiceV2RestStub): def __hash__(self): return hash("GetLogMetric") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -532,7 +532,7 @@ class _ListLogMetrics(MetricsServiceV2RestStub): def __hash__(self): return hash("ListLogMetrics") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -608,7 +608,7 @@ class _UpdateLogMetric(MetricsServiceV2RestStub): def __hash__(self): return hash("UpdateLogMetric") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod diff --git a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/rest.py b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/rest.py index e27a5b5374..affd358c58 100755 --- a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/rest.py +++ b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/rest.py @@ -31,7 +31,7 @@ from requests import __version__ as requests_version import dataclasses import re -from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -440,7 +440,7 @@ class _CreateInstance(CloudRedisRestStub): def __hash__(self): return hash("CreateInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { "instanceId" : "", } @classmethod @@ -528,7 +528,7 @@ class _DeleteInstance(CloudRedisRestStub): def __hash__(self): return hash("DeleteInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -607,7 +607,7 @@ class _ExportInstance(CloudRedisRestStub): def __hash__(self): return hash("ExportInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -695,7 +695,7 @@ class _FailoverInstance(CloudRedisRestStub): def __hash__(self): return hash("FailoverInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -783,7 +783,7 @@ class _GetInstance(CloudRedisRestStub): def __hash__(self): return hash("GetInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -861,7 +861,7 @@ class _ImportInstance(CloudRedisRestStub): def __hash__(self): return hash("ImportInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -949,7 +949,7 @@ class _ListInstances(CloudRedisRestStub): def __hash__(self): return hash("ListInstances") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod @@ -1029,7 +1029,7 @@ class _UpdateInstance(CloudRedisRestStub): def __hash__(self): return hash("UpdateInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { "updateMask" : {}, } @classmethod @@ -1117,7 +1117,7 @@ class _UpgradeInstance(CloudRedisRestStub): def __hash__(self): return hash("UpgradeInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { } @classmethod From 7a0051cb7c16134e33eda78391fbc592317e6425 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Fri, 17 Feb 2023 14:13:59 +0000 Subject: [PATCH 9/9] Revert "remove typing Any" This reverts commit 2f074630b7d892e103c6598bf0bb7b68c86ced53. --- .../services/%service/transports/rest.py.j2 | 4 +- .../services/%service/transports/rest.py.j2 | 4 +- .../services/asset_service/transports/rest.py | 26 +++++----- .../iam_credentials/transports/rest.py | 10 ++-- .../services/eventarc/transports/rest.py | 12 ++--- .../config_service_v2/transports/rest.py | 48 +++++++++---------- .../logging_service_v2/transports/rest.py | 10 ++-- .../metrics_service_v2/transports/rest.py | 12 ++--- .../services/cloud_redis/transports/rest.py | 20 ++++---- 9 files changed, 73 insertions(+), 73 deletions(-) diff --git a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/rest.py.j2 b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/rest.py.j2 index f5017704d4..5c2d102f48 100644 --- a/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/rest.py.j2 +++ b/gapic/ads-templates/%namespace/%name/%version/%sub/services/%service/transports/rest.py.j2 @@ -22,7 +22,7 @@ from google.api_core import operations_v1 from requests import __version__ as requests_version import dataclasses import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -269,7 +269,7 @@ class {{service.name}}RestTransport({{service.name}}Transport): {% if not method.client_streaming %} {% if method.input.required_fields %} - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { {% for req_field in method.input.required_fields if req_field.name in method.query_params %} "{{ req_field.name | camel_case }}" : {% if req_field.field_pb.type == 9 %}"{{req_field.field_pb.default_value }}"{% elif req_field.field_pb.type in [11, 14] %}{}{% else %}{{ req_field.type.python_type(req_field.field_pb.default_value or 0) }}{% endif %},{# default is str #} {% endfor %} diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 index b1b756543b..7d8e72846e 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 @@ -32,7 +32,7 @@ from google.longrunning import operations_pb2 from requests import __version__ as requests_version import dataclasses import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -299,7 +299,7 @@ class {{service.name}}RestTransport({{service.name}}Transport): {% if not method.client_streaming %} {% if method.input.required_fields %} - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { {% for req_field in method.input.required_fields if req_field.name in method.query_params %} "{{ req_field.name | camel_case }}" : {% if req_field.field_pb.type == 9 %}"{{req_field.field_pb.default_value }}"{% elif req_field.field_pb.type in [11, 14] %}{}{% else %}{{ req_field.type.python_type(req_field.field_pb.default_value or 0) }}{% endif %},{# default is str #} {% endfor %} diff --git a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/rest.py b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/rest.py index 2ef50f0c23..ef684a1424 100755 --- a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/rest.py +++ b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/transports/rest.py @@ -31,7 +31,7 @@ from requests import __version__ as requests_version import dataclasses import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -481,7 +481,7 @@ class _AnalyzeIamPolicy(AssetServiceRestStub): def __hash__(self): return hash("AnalyzeIamPolicy") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { "analysisQuery" : {}, } @classmethod @@ -561,7 +561,7 @@ class _AnalyzeIamPolicyLongrunning(AssetServiceRestStub): def __hash__(self): return hash("AnalyzeIamPolicyLongrunning") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -650,7 +650,7 @@ class _BatchGetAssetsHistory(AssetServiceRestStub): def __hash__(self): return hash("BatchGetAssetsHistory") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -726,7 +726,7 @@ class _CreateFeed(AssetServiceRestStub): def __hash__(self): return hash("CreateFeed") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -818,7 +818,7 @@ class _DeleteFeed(AssetServiceRestStub): def __hash__(self): return hash("DeleteFeed") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -882,7 +882,7 @@ class _ExportAssets(AssetServiceRestStub): def __hash__(self): return hash("ExportAssets") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -968,7 +968,7 @@ class _GetFeed(AssetServiceRestStub): def __hash__(self): return hash("GetFeed") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1051,7 +1051,7 @@ class _ListAssets(AssetServiceRestStub): def __hash__(self): return hash("ListAssets") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1127,7 +1127,7 @@ class _ListFeeds(AssetServiceRestStub): def __hash__(self): return hash("ListFeeds") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1203,7 +1203,7 @@ class _SearchAllIamPolicies(AssetServiceRestStub): def __hash__(self): return hash("SearchAllIamPolicies") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1279,7 +1279,7 @@ class _SearchAllResources(AssetServiceRestStub): def __hash__(self): return hash("SearchAllResources") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1355,7 +1355,7 @@ class _UpdateFeed(AssetServiceRestStub): def __hash__(self): return hash("UpdateFeed") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod diff --git a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/rest.py b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/rest.py index 70d9bba2d6..32eff78924 100755 --- a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/rest.py +++ b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/transports/rest.py @@ -30,7 +30,7 @@ from requests import __version__ as requests_version import dataclasses import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -281,7 +281,7 @@ class _GenerateAccessToken(IAMCredentialsRestStub): def __hash__(self): return hash("GenerateAccessToken") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -366,7 +366,7 @@ class _GenerateIdToken(IAMCredentialsRestStub): def __hash__(self): return hash("GenerateIdToken") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -451,7 +451,7 @@ class _SignBlob(IAMCredentialsRestStub): def __hash__(self): return hash("SignBlob") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -536,7 +536,7 @@ class _SignJwt(IAMCredentialsRestStub): def __hash__(self): return hash("SignJwt") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod diff --git a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/rest.py b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/rest.py index 9baa7745f9..956df80956 100755 --- a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/rest.py +++ b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/transports/rest.py @@ -31,7 +31,7 @@ from requests import __version__ as requests_version import dataclasses import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -327,7 +327,7 @@ class _CreateTrigger(EventarcRestStub): def __hash__(self): return hash("CreateTrigger") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { "triggerId" : "", "validateOnly" : False, } @classmethod @@ -415,7 +415,7 @@ class _DeleteTrigger(EventarcRestStub): def __hash__(self): return hash("DeleteTrigger") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { "validateOnly" : False, } @classmethod @@ -494,7 +494,7 @@ class _GetTrigger(EventarcRestStub): def __hash__(self): return hash("GetTrigger") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -574,7 +574,7 @@ class _ListTriggers(EventarcRestStub): def __hash__(self): return hash("ListTriggers") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -654,7 +654,7 @@ class _UpdateTrigger(EventarcRestStub): def __hash__(self): return hash("UpdateTrigger") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { "validateOnly" : False, } @classmethod diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/rest.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/rest.py index d7d2391661..9fb4a17a30 100755 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/rest.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/transports/rest.py @@ -30,7 +30,7 @@ from requests import __version__ as requests_version import dataclasses import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -669,7 +669,7 @@ class _CreateBucket(ConfigServiceV2RestStub): def __hash__(self): return hash("CreateBucket") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { "bucketId" : "", } @classmethod @@ -774,7 +774,7 @@ class _CreateExclusion(ConfigServiceV2RestStub): def __hash__(self): return hash("CreateExclusion") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -890,7 +890,7 @@ class _CreateSink(ConfigServiceV2RestStub): def __hash__(self): return hash("CreateSink") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1004,7 +1004,7 @@ class _CreateView(ConfigServiceV2RestStub): def __hash__(self): return hash("CreateView") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { "viewId" : "", } @classmethod @@ -1111,7 +1111,7 @@ class _DeleteBucket(ConfigServiceV2RestStub): def __hash__(self): return hash("DeleteBucket") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1191,7 +1191,7 @@ class _DeleteExclusion(ConfigServiceV2RestStub): def __hash__(self): return hash("DeleteExclusion") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1271,7 +1271,7 @@ class _DeleteSink(ConfigServiceV2RestStub): def __hash__(self): return hash("DeleteSink") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1351,7 +1351,7 @@ class _DeleteView(ConfigServiceV2RestStub): def __hash__(self): return hash("DeleteView") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1431,7 +1431,7 @@ class _GetBucket(ConfigServiceV2RestStub): def __hash__(self): return hash("GetBucket") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1523,7 +1523,7 @@ class _GetCmekSettings(ConfigServiceV2RestStub): def __hash__(self): return hash("GetCmekSettings") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1621,7 +1621,7 @@ class _GetExclusion(ConfigServiceV2RestStub): def __hash__(self): return hash("GetExclusion") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1724,7 +1724,7 @@ class _GetSink(ConfigServiceV2RestStub): def __hash__(self): return hash("GetSink") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1825,7 +1825,7 @@ class _GetView(ConfigServiceV2RestStub): def __hash__(self): return hash("GetView") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1919,7 +1919,7 @@ class _ListBuckets(ConfigServiceV2RestStub): def __hash__(self): return hash("ListBuckets") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -2011,7 +2011,7 @@ class _ListExclusions(ConfigServiceV2RestStub): def __hash__(self): return hash("ListExclusions") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -2103,7 +2103,7 @@ class _ListSinks(ConfigServiceV2RestStub): def __hash__(self): return hash("ListSinks") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -2195,7 +2195,7 @@ class _ListViews(ConfigServiceV2RestStub): def __hash__(self): return hash("ListViews") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -2287,7 +2287,7 @@ class _UndeleteBucket(ConfigServiceV2RestStub): def __hash__(self): return hash("UndeleteBucket") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -2380,7 +2380,7 @@ class _UpdateBucket(ConfigServiceV2RestStub): def __hash__(self): return hash("UpdateBucket") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { "updateMask" : {}, } @classmethod @@ -2485,7 +2485,7 @@ class _UpdateCmekSettings(ConfigServiceV2RestStub): def __hash__(self): return hash("UpdateCmekSettings") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -2593,7 +2593,7 @@ class _UpdateExclusion(ConfigServiceV2RestStub): def __hash__(self): return hash("UpdateExclusion") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { "updateMask" : {}, } @classmethod @@ -2709,7 +2709,7 @@ class _UpdateSink(ConfigServiceV2RestStub): def __hash__(self): return hash("UpdateSink") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -2843,7 +2843,7 @@ class _UpdateView(ConfigServiceV2RestStub): def __hash__(self): return hash("UpdateView") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/rest.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/rest.py index 176299783b..309e5179fc 100755 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/rest.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/transports/rest.py @@ -30,7 +30,7 @@ from requests import __version__ as requests_version import dataclasses import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -285,7 +285,7 @@ class _DeleteLog(LoggingServiceV2RestStub): def __hash__(self): return hash("DeleteLog") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -365,7 +365,7 @@ class _ListLogEntries(LoggingServiceV2RestStub): def __hash__(self): return hash("ListLogEntries") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -450,7 +450,7 @@ class _ListLogs(LoggingServiceV2RestStub): def __hash__(self): return hash("ListLogs") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -628,7 +628,7 @@ class _WriteLogEntries(LoggingServiceV2RestStub): def __hash__(self): return hash("WriteLogEntries") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/rest.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/rest.py index 97724d83e5..059ddf19d4 100755 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/rest.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/transports/rest.py @@ -30,7 +30,7 @@ from requests import __version__ as requests_version import dataclasses import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -285,7 +285,7 @@ class _CreateLogMetric(MetricsServiceV2RestStub): def __hash__(self): return hash("CreateLogMetric") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -381,7 +381,7 @@ class _DeleteLogMetric(MetricsServiceV2RestStub): def __hash__(self): return hash("DeleteLogMetric") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -445,7 +445,7 @@ class _GetLogMetric(MetricsServiceV2RestStub): def __hash__(self): return hash("GetLogMetric") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -532,7 +532,7 @@ class _ListLogMetrics(MetricsServiceV2RestStub): def __hash__(self): return hash("ListLogMetrics") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -608,7 +608,7 @@ class _UpdateLogMetric(MetricsServiceV2RestStub): def __hash__(self): return hash("UpdateLogMetric") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod diff --git a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/rest.py b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/rest.py index affd358c58..e27a5b5374 100755 --- a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/rest.py +++ b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/transports/rest.py @@ -31,7 +31,7 @@ from requests import __version__ as requests_version import dataclasses import re -from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union +from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Union import warnings try: @@ -440,7 +440,7 @@ class _CreateInstance(CloudRedisRestStub): def __hash__(self): return hash("CreateInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { "instanceId" : "", } @classmethod @@ -528,7 +528,7 @@ class _DeleteInstance(CloudRedisRestStub): def __hash__(self): return hash("DeleteInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -607,7 +607,7 @@ class _ExportInstance(CloudRedisRestStub): def __hash__(self): return hash("ExportInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -695,7 +695,7 @@ class _FailoverInstance(CloudRedisRestStub): def __hash__(self): return hash("FailoverInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -783,7 +783,7 @@ class _GetInstance(CloudRedisRestStub): def __hash__(self): return hash("GetInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -861,7 +861,7 @@ class _ImportInstance(CloudRedisRestStub): def __hash__(self): return hash("ImportInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -949,7 +949,7 @@ class _ListInstances(CloudRedisRestStub): def __hash__(self): return hash("ListInstances") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod @@ -1029,7 +1029,7 @@ class _UpdateInstance(CloudRedisRestStub): def __hash__(self): return hash("UpdateInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { "updateMask" : {}, } @classmethod @@ -1117,7 +1117,7 @@ class _UpgradeInstance(CloudRedisRestStub): def __hash__(self): return hash("UpgradeInstance") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict = { + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { } @classmethod