diff --git a/.coveragerc b/.coveragerc index 3bb19f7..8d18d41 100644 --- a/.coveragerc +++ b/.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/google/cloud/shell_v1/gapic_version.py b/google/cloud/shell_v1/gapic_version.py new file mode 100644 index 0000000..178df4b --- /dev/null +++ b/google/cloud/shell_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.4.3" # {x-release-please-version} diff --git a/google/cloud/shell_v1/services/cloud_shell_service/async_client.py b/google/cloud/shell_v1/services/cloud_shell_service/async_client.py index 4e75dfa..7fb73bc 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/async_client.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/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.shell_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -231,7 +232,7 @@ async def get_environment( *, 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]] = (), ) -> cloudshell.Environment: r"""Gets an environment. Returns NOT_FOUND if the environment does @@ -350,7 +351,7 @@ async def start_environment( request: Optional[Union[cloudshell.StartEnvironmentRequest, dict]] = 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"""Starts an existing environment, allowing clients to @@ -386,7 +387,7 @@ async def sample_start_environment(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -451,7 +452,7 @@ async def authorize_environment( request: Optional[Union[cloudshell.AuthorizeEnvironmentRequest, dict]] = 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"""Sends OAuth credentials to a running environment on @@ -484,7 +485,7 @@ async def sample_authorize_environment(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -548,7 +549,7 @@ async def add_public_key( request: Optional[Union[cloudshell.AddPublicKeyRequest, dict]] = 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"""Adds a public SSH key to an environment, allowing clients with @@ -580,7 +581,7 @@ async def sample_add_public_key(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -646,7 +647,7 @@ async def remove_public_key( request: Optional[Union[cloudshell.RemovePublicKeyRequest, dict]] = 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"""Removes a public SSH key from an environment. Clients will no @@ -678,7 +679,7 @@ async def sample_remove_public_key(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) @@ -746,14 +747,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-shell", - ).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__ = ("CloudShellServiceAsyncClient",) diff --git a/google/cloud/shell_v1/services/cloud_shell_service/client.py b/google/cloud/shell_v1/services/cloud_shell_service/client.py index 134029e..8c62d32 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/client.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/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.shell_v1 import gapic_version as package_version try: OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] @@ -451,7 +452,7 @@ def get_environment( *, 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]] = (), ) -> cloudshell.Environment: r"""Gets an environment. Returns NOT_FOUND if the environment does @@ -560,7 +561,7 @@ def start_environment( request: Optional[Union[cloudshell.StartEnvironmentRequest, dict]] = 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"""Starts an existing environment, allowing clients to @@ -662,7 +663,7 @@ def authorize_environment( request: Optional[Union[cloudshell.AuthorizeEnvironmentRequest, dict]] = 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"""Sends OAuth credentials to a running environment on @@ -760,7 +761,7 @@ def add_public_key( request: Optional[Union[cloudshell.AddPublicKeyRequest, dict]] = 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"""Adds a public SSH key to an environment, allowing clients with @@ -859,7 +860,7 @@ def remove_public_key( request: Optional[Union[cloudshell.RemovePublicKeyRequest, dict]] = 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"""Removes a public SSH key from an environment. Clients will no @@ -967,14 +968,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-shell", - ).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__ = ("CloudShellServiceClient",) diff --git a/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py b/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py index e544512..68f016e 100644 --- a/google/cloud/shell_v1/services/cloud_shell_service/transports/base.py +++ b/google/cloud/shell_v1/services/cloud_shell_service/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.shell_v1 import gapic_version as package_version from google.cloud.shell_v1.types import cloudshell -try: - DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution( - "google-cloud-shell", - ).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 CloudShellServiceTransport(abc.ABC): diff --git a/release-please-config.json b/release-please-config.json index c9c4b12..7b241c9 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -5,6 +5,7 @@ "release-type": "python", "extra-files": [ "google/cloud/shell/gapic_version.py", + "google/cloud/shell_v1/gapic_version.py", { "type": "json", "path": "samples/generated_samples/snippet_metadata_google.cloud.shell.v1.json", diff --git a/samples/generated_samples/cloudshell_v1_generated_cloud_shell_service_add_public_key_async.py b/samples/generated_samples/cloudshell_v1_generated_cloud_shell_service_add_public_key_async.py index c38c499..939a040 100644 --- a/samples/generated_samples/cloudshell_v1_generated_cloud_shell_service_add_public_key_async.py +++ b/samples/generated_samples/cloudshell_v1_generated_cloud_shell_service_add_public_key_async.py @@ -47,7 +47,7 @@ async def sample_add_public_key(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/samples/generated_samples/cloudshell_v1_generated_cloud_shell_service_authorize_environment_async.py b/samples/generated_samples/cloudshell_v1_generated_cloud_shell_service_authorize_environment_async.py index 8a663ff..e41e461 100644 --- a/samples/generated_samples/cloudshell_v1_generated_cloud_shell_service_authorize_environment_async.py +++ b/samples/generated_samples/cloudshell_v1_generated_cloud_shell_service_authorize_environment_async.py @@ -47,7 +47,7 @@ async def sample_authorize_environment(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/samples/generated_samples/cloudshell_v1_generated_cloud_shell_service_remove_public_key_async.py b/samples/generated_samples/cloudshell_v1_generated_cloud_shell_service_remove_public_key_async.py index 2d714c6..e6e8325 100644 --- a/samples/generated_samples/cloudshell_v1_generated_cloud_shell_service_remove_public_key_async.py +++ b/samples/generated_samples/cloudshell_v1_generated_cloud_shell_service_remove_public_key_async.py @@ -47,7 +47,7 @@ async def sample_remove_public_key(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/samples/generated_samples/cloudshell_v1_generated_cloud_shell_service_start_environment_async.py b/samples/generated_samples/cloudshell_v1_generated_cloud_shell_service_start_environment_async.py index a13df94..d099497 100644 --- a/samples/generated_samples/cloudshell_v1_generated_cloud_shell_service_start_environment_async.py +++ b/samples/generated_samples/cloudshell_v1_generated_cloud_shell_service_start_environment_async.py @@ -47,7 +47,7 @@ async def sample_start_environment(): print("Waiting for operation to complete...") - response = await operation.result() + response = (await operation).result() # Handle the response print(response) diff --git a/setup.py b/setup.py index 7d52ff9..376cba9 100644 --- a/setup.py +++ b/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/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index 6f3158c..6c44adf 100644 --- a/testing/constraints-3.7.txt +++ b/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