From d69f4bc4e74426511b217b71dbb0117aa9c4d58e Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 8 Dec 2022 10:22:40 -0500 Subject: [PATCH] fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#94) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix(deps): Require google-api-core >=1.34.0, >=2.11.0 fix: Drop usage of pkg_resources fix: Fix timeout default values docs(samples): Snippetgen should call await on the operation coroutine before calling result PiperOrigin-RevId: 493260409 Source-Link: https://github.com/googleapis/googleapis/commit/fea43879f83a8d0dacc9353b3f75f8f46d37162f Source-Link: https://github.com/googleapis/googleapis-gen/commit/387b7344c7529ee44be84e613b19a820508c612b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzg3YjczNDRjNzUyOWVlNDRiZTg0ZTYxM2IxOWE4MjA1MDhjNjEyYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * add gapic_version.py Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- packages/google-cloud-ids/.coveragerc | 5 ---- .../google/cloud/ids_v1/gapic_version.py | 16 ++++++++++++ .../cloud/ids_v1/services/ids/async_client.py | 26 ++++++++----------- .../cloud/ids_v1/services/ids/client.py | 22 +++++++--------- .../ids_v1/services/ids/transports/base.py | 13 +++------- .../release-please-config.json | 1 + ..._v1_generated_ids_create_endpoint_async.py | 2 +- ..._v1_generated_ids_delete_endpoint_async.py | 2 +- packages/google-cloud-ids/setup.py | 2 +- .../testing/constraints-3.7.txt | 2 +- 10 files changed, 45 insertions(+), 46 deletions(-) create mode 100644 packages/google-cloud-ids/google/cloud/ids_v1/gapic_version.py diff --git a/packages/google-cloud-ids/.coveragerc b/packages/google-cloud-ids/.coveragerc index 9bec5b0a71e2..6d40dd016112 100644 --- a/packages/google-cloud-ids/.coveragerc +++ b/packages/google-cloud-ids/.coveragerc @@ -10,8 +10,3 @@ exclude_lines = pragma: NO COVER # Ignore debug-only repr def __repr__ - # Ignore pkg_resources exceptions. - # This is added at the module level as a safeguard for if someone - # generates the code and tries to run it without pip installing. This - # makes it virtually impossible to test properly. - except pkg_resources.DistributionNotFound diff --git a/packages/google-cloud-ids/google/cloud/ids_v1/gapic_version.py b/packages/google-cloud-ids/google/cloud/ids_v1/gapic_version.py new file mode 100644 index 000000000000..82c1d4ca8713 --- /dev/null +++ b/packages/google-cloud-ids/google/cloud/ids_v1/gapic_version.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +__version__ = "1.2.4" # {x-release-please-version} diff --git a/packages/google-cloud-ids/google/cloud/ids_v1/services/ids/async_client.py b/packages/google-cloud-ids/google/cloud/ids_v1/services/ids/async_client.py index 50d2e5dd7566..a77d32f4f088 100644 --- a/packages/google-cloud-ids/google/cloud/ids_v1/services/ids/async_client.py +++ b/packages/google-cloud-ids/google/cloud/ids_v1/services/ids/async_client.py @@ -34,7 +34,8 @@ from google.api_core.client_options import ClientOptions from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.ids_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -214,7 +215,7 @@ async def list_endpoints( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListEndpointsAsyncPager: r"""Lists Endpoints in a given project and location. @@ -335,7 +336,7 @@ async def get_endpoint( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> ids.Endpoint: r"""Gets details of a single Endpoint. @@ -449,7 +450,7 @@ async def create_endpoint( endpoint: Optional[ids.Endpoint] = None, endpoint_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Creates a new Endpoint in a given project and @@ -486,7 +487,7 @@ async def sample_create_endpoint(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -589,7 +590,7 @@ async def delete_endpoint( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deletes a single Endpoint. @@ -619,7 +620,7 @@ async def sample_delete_endpoint(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -713,14 +714,9 @@ async def __aexit__(self, exc_type, exc, tb): await self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-ids", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("IDSAsyncClient",) diff --git a/packages/google-cloud-ids/google/cloud/ids_v1/services/ids/client.py b/packages/google-cloud-ids/google/cloud/ids_v1/services/ids/client.py index 51cd9fd63bc9..b9f51e08b94c 100644 --- a/packages/google-cloud-ids/google/cloud/ids_v1/services/ids/client.py +++ b/packages/google-cloud-ids/google/cloud/ids_v1/services/ids/client.py @@ -38,7 +38,8 @@ from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources + +from google.cloud.ids_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -449,7 +450,7 @@ def list_endpoints( *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListEndpointsPager: r"""Lists Endpoints in a given project and location. @@ -561,7 +562,7 @@ def get_endpoint( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> ids.Endpoint: r"""Gets details of a single Endpoint. @@ -666,7 +667,7 @@ def create_endpoint( endpoint: Optional[ids.Endpoint] = None, endpoint_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Creates a new Endpoint in a given project and @@ -806,7 +807,7 @@ def delete_endpoint( *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Deletes a single Endpoint. @@ -937,14 +938,9 @@ def __exit__(self, type, value, traceback): self.transport.close() -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-ids", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) __all__ = ("IDSClient",) diff --git a/packages/google-cloud-ids/google/cloud/ids_v1/services/ids/transports/base.py b/packages/google-cloud-ids/google/cloud/ids_v1/services/ids/transports/base.py index 2761240cd6f5..139931896bc5 100644 --- a/packages/google-cloud-ids/google/cloud/ids_v1/services/ids/transports/base.py +++ b/packages/google-cloud-ids/google/cloud/ids_v1/services/ids/transports/base.py @@ -24,18 +24,13 @@ from google.auth import credentials as ga_credentials # type: ignore from google.longrunning import operations_pb2 # type: ignore from google.oauth2 import service_account # type: ignore -import pkg_resources +from google.cloud.ids_v1 import gapic_version as package_version from google.cloud.ids_v1.types import ids -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-ids", - ).version, - ) -except pkg_resources.DistributionNotFound: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() +DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( + gapic_version=package_version.__version__ +) class IDSTransport(abc.ABC): diff --git a/packages/google-cloud-ids/release-please-config.json b/packages/google-cloud-ids/release-please-config.json index 766d3550f683..fd1551ba518d 100644 --- a/packages/google-cloud-ids/release-please-config.json +++ b/packages/google-cloud-ids/release-please-config.json @@ -5,6 +5,7 @@ "release-type": "python", "extra-files": [ "google/cloud/ids/gapic_version.py", + "google/cloud/ids_v1/gapic_version.py", { "type": "json", "path": "samples/generated_samples/snippet_metadata_google.cloud.ids.v1.json", diff --git a/packages/google-cloud-ids/samples/generated_samples/ids_v1_generated_ids_create_endpoint_async.py b/packages/google-cloud-ids/samples/generated_samples/ids_v1_generated_ids_create_endpoint_async.py index bbf1d054e833..5a56991211ac 100644 --- a/packages/google-cloud-ids/samples/generated_samples/ids_v1_generated_ids_create_endpoint_async.py +++ b/packages/google-cloud-ids/samples/generated_samples/ids_v1_generated_ids_create_endpoint_async.py @@ -54,7 +54,7 @@ async def sample_create_endpoint(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/packages/google-cloud-ids/samples/generated_samples/ids_v1_generated_ids_delete_endpoint_async.py b/packages/google-cloud-ids/samples/generated_samples/ids_v1_generated_ids_delete_endpoint_async.py index a99e74d272e0..24d14056002a 100644 --- a/packages/google-cloud-ids/samples/generated_samples/ids_v1_generated_ids_delete_endpoint_async.py +++ b/packages/google-cloud-ids/samples/generated_samples/ids_v1_generated_ids_delete_endpoint_async.py @@ -48,7 +48,7 @@ async def sample_delete_endpoint(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/packages/google-cloud-ids/setup.py b/packages/google-cloud-ids/setup.py index 220ff886112c..c4ed7fa94c55 100644 --- a/packages/google-cloud-ids/setup.py +++ b/packages/google-cloud-ids/setup.py @@ -36,7 +36,7 @@ release_status = "Development Status :: 5 - Production/Stable" dependencies = [ - "google-api-core[grpc] >= 1.33.2, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", + "google-api-core[grpc] >= 1.34.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*,!=2.8.*,!=2.9.*,!=2.10.*", "proto-plus >= 1.22.0, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] diff --git a/packages/google-cloud-ids/testing/constraints-3.7.txt b/packages/google-cloud-ids/testing/constraints-3.7.txt index 6f3158cc2034..6c44adfea7ee 100644 --- a/packages/google-cloud-ids/testing/constraints-3.7.txt +++ b/packages/google-cloud-ids/testing/constraints-3.7.txt @@ -4,6 +4,6 @@ # Pin the version to the lower bound. # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 -google-api-core==1.33.2 +google-api-core==1.34.0 proto-plus==1.22.0 protobuf==3.19.5