From fb6499da6f5f3416b1f0232ed8c27b7fafec4a9a Mon Sep 17 00:00:00 2001 From: henribru <6639509+henribru@users.noreply.github.com> Date: Sat, 20 May 2023 07:54:01 +0200 Subject: [PATCH] fix: add async context manager return types --- .../%name_%version/%sub/services/%service/async_client.py.j2 | 2 +- .../cloud/asset_v1/services/asset_service/async_client.py | 2 +- .../iam/credentials_v1/services/iam_credentials/async_client.py | 2 +- .../google/cloud/eventarc_v1/services/eventarc/async_client.py | 2 +- .../cloud/logging_v2/services/config_service_v2/async_client.py | 2 +- .../logging_v2/services/logging_service_v2/async_client.py | 2 +- .../logging_v2/services/metrics_service_v2/async_client.py | 2 +- .../google/cloud/redis_v1/services/cloud_redis/async_client.py | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 index 8f10ab7ede..c2fd3d57d4 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/async_client.py.j2 @@ -672,7 +672,7 @@ class {{ service.async_client_name }}: return response {% endif %} - async def __aenter__(self): + async def __aenter__(self) -> "{{ service.async_client_name }}": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/async_client.py b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/async_client.py index 8c3355ca89..5941066887 100755 --- a/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/async_client.py +++ b/tests/integration/goldens/asset/google/cloud/asset_v1/services/asset_service/async_client.py @@ -1674,7 +1674,7 @@ async def sample_analyze_iam_policy_longrunning(): # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "AssetServiceAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/async_client.py b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/async_client.py index 7b4ecc386b..e1550e3665 100755 --- a/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/async_client.py +++ b/tests/integration/goldens/credentials/google/iam/credentials_v1/services/iam_credentials/async_client.py @@ -792,7 +792,7 @@ async def sample_sign_jwt(): # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "IAMCredentialsAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/async_client.py b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/async_client.py index a6aa557c76..6febf4f1cc 100755 --- a/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/async_client.py +++ b/tests/integration/goldens/eventarc/google/cloud/eventarc_v1/services/eventarc/async_client.py @@ -825,7 +825,7 @@ async def sample_delete_trigger(): # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "EventarcAsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/async_client.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/async_client.py index aa607edd40..10966d07a3 100755 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/async_client.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/config_service_v2/async_client.py @@ -2648,7 +2648,7 @@ async def sample_update_cmek_settings(): # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "ConfigServiceV2AsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/async_client.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/async_client.py index 3c38c790b7..d8ff79b4b5 100755 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/async_client.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/logging_service_v2/async_client.py @@ -971,7 +971,7 @@ def request_generator(): # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "LoggingServiceV2AsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/async_client.py b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/async_client.py index 891f40ddab..931dccbb15 100755 --- a/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/async_client.py +++ b/tests/integration/goldens/logging/google/cloud/logging_v2/services/metrics_service_v2/async_client.py @@ -799,7 +799,7 @@ async def sample_delete_log_metric(): metadata=metadata, ) - async def __aenter__(self): + async def __aenter__(self) -> "MetricsServiceV2AsyncClient": return self async def __aexit__(self, exc_type, exc, tb): diff --git a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/async_client.py b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/async_client.py index eb6b14d8b3..fb4688580e 100755 --- a/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/async_client.py +++ b/tests/integration/goldens/redis/google/cloud/redis_v1/services/cloud_redis/async_client.py @@ -1399,7 +1399,7 @@ async def sample_delete_instance(): # Done; return the response. return response - async def __aenter__(self): + async def __aenter__(self) -> "CloudRedisAsyncClient": return self async def __aexit__(self, exc_type, exc, tb):