Skip to content
This repository was archived by the owner on Jul 6, 2023. It is now read-only.

Commit 563be00

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#146)
* 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: googleapis/googleapis@fea4387 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 <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent 82fc2bc commit 563be00

12 files changed

+51
-52
lines changed

.coveragerc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,3 @@ exclude_lines =
1010
pragma: NO COVER
1111
# Ignore debug-only repr
1212
def __repr__
13-
# Ignore pkg_resources exceptions.
14-
# This is added at the module level as a safeguard for if someone
15-
# generates the code and tries to run it without pip installing. This
16-
# makes it virtually impossible to test properly.
17-
except pkg_resources.DistributionNotFound
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
__version__ = "1.4.3" # {x-release-please-version}

google/cloud/shell_v1/services/cloud_shell_service/async_client.py

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
from google.api_core.client_options import ClientOptions
3535
from google.auth import credentials as ga_credentials # type: ignore
3636
from google.oauth2 import service_account # type: ignore
37-
import pkg_resources
37+
38+
from google.cloud.shell_v1 import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -231,7 +232,7 @@ async def get_environment(
231232
*,
232233
name: Optional[str] = None,
233234
retry: OptionalRetry = gapic_v1.method.DEFAULT,
234-
timeout: Optional[float] = None,
235+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
235236
metadata: Sequence[Tuple[str, str]] = (),
236237
) -> cloudshell.Environment:
237238
r"""Gets an environment. Returns NOT_FOUND if the environment does
@@ -350,7 +351,7 @@ async def start_environment(
350351
request: Optional[Union[cloudshell.StartEnvironmentRequest, dict]] = None,
351352
*,
352353
retry: OptionalRetry = gapic_v1.method.DEFAULT,
353-
timeout: Optional[float] = None,
354+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
354355
metadata: Sequence[Tuple[str, str]] = (),
355356
) -> operation_async.AsyncOperation:
356357
r"""Starts an existing environment, allowing clients to
@@ -386,7 +387,7 @@ async def sample_start_environment():
386387
387388
print("Waiting for operation to complete...")
388389
389-
response = await operation.result()
390+
response = (await operation).result()
390391
391392
# Handle the response
392393
print(response)
@@ -451,7 +452,7 @@ async def authorize_environment(
451452
request: Optional[Union[cloudshell.AuthorizeEnvironmentRequest, dict]] = None,
452453
*,
453454
retry: OptionalRetry = gapic_v1.method.DEFAULT,
454-
timeout: Optional[float] = None,
455+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
455456
metadata: Sequence[Tuple[str, str]] = (),
456457
) -> operation_async.AsyncOperation:
457458
r"""Sends OAuth credentials to a running environment on
@@ -484,7 +485,7 @@ async def sample_authorize_environment():
484485
485486
print("Waiting for operation to complete...")
486487
487-
response = await operation.result()
488+
response = (await operation).result()
488489
489490
# Handle the response
490491
print(response)
@@ -548,7 +549,7 @@ async def add_public_key(
548549
request: Optional[Union[cloudshell.AddPublicKeyRequest, dict]] = None,
549550
*,
550551
retry: OptionalRetry = gapic_v1.method.DEFAULT,
551-
timeout: Optional[float] = None,
552+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
552553
metadata: Sequence[Tuple[str, str]] = (),
553554
) -> operation_async.AsyncOperation:
554555
r"""Adds a public SSH key to an environment, allowing clients with
@@ -580,7 +581,7 @@ async def sample_add_public_key():
580581
581582
print("Waiting for operation to complete...")
582583
583-
response = await operation.result()
584+
response = (await operation).result()
584585
585586
# Handle the response
586587
print(response)
@@ -646,7 +647,7 @@ async def remove_public_key(
646647
request: Optional[Union[cloudshell.RemovePublicKeyRequest, dict]] = None,
647648
*,
648649
retry: OptionalRetry = gapic_v1.method.DEFAULT,
649-
timeout: Optional[float] = None,
650+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
650651
metadata: Sequence[Tuple[str, str]] = (),
651652
) -> operation_async.AsyncOperation:
652653
r"""Removes a public SSH key from an environment. Clients will no
@@ -678,7 +679,7 @@ async def sample_remove_public_key():
678679
679680
print("Waiting for operation to complete...")
680681
681-
response = await operation.result()
682+
response = (await operation).result()
682683
683684
# Handle the response
684685
print(response)
@@ -746,14 +747,9 @@ async def __aexit__(self, exc_type, exc, tb):
746747
await self.transport.close()
747748

748749

749-
try:
750-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
751-
gapic_version=pkg_resources.get_distribution(
752-
"google-cloud-shell",
753-
).version,
754-
)
755-
except pkg_resources.DistributionNotFound:
756-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
750+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
751+
gapic_version=package_version.__version__
752+
)
757753

758754

759755
__all__ = ("CloudShellServiceAsyncClient",)

google/cloud/shell_v1/services/cloud_shell_service/client.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
from google.auth.transport import mtls # type: ignore
3939
from google.auth.transport.grpc import SslCredentials # type: ignore
4040
from google.oauth2 import service_account # type: ignore
41-
import pkg_resources
41+
42+
from google.cloud.shell_v1 import gapic_version as package_version
4243

4344
try:
4445
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -451,7 +452,7 @@ def get_environment(
451452
*,
452453
name: Optional[str] = None,
453454
retry: OptionalRetry = gapic_v1.method.DEFAULT,
454-
timeout: Optional[float] = None,
455+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
455456
metadata: Sequence[Tuple[str, str]] = (),
456457
) -> cloudshell.Environment:
457458
r"""Gets an environment. Returns NOT_FOUND if the environment does
@@ -560,7 +561,7 @@ def start_environment(
560561
request: Optional[Union[cloudshell.StartEnvironmentRequest, dict]] = None,
561562
*,
562563
retry: OptionalRetry = gapic_v1.method.DEFAULT,
563-
timeout: Optional[float] = None,
564+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
564565
metadata: Sequence[Tuple[str, str]] = (),
565566
) -> operation.Operation:
566567
r"""Starts an existing environment, allowing clients to
@@ -662,7 +663,7 @@ def authorize_environment(
662663
request: Optional[Union[cloudshell.AuthorizeEnvironmentRequest, dict]] = None,
663664
*,
664665
retry: OptionalRetry = gapic_v1.method.DEFAULT,
665-
timeout: Optional[float] = None,
666+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
666667
metadata: Sequence[Tuple[str, str]] = (),
667668
) -> operation.Operation:
668669
r"""Sends OAuth credentials to a running environment on
@@ -760,7 +761,7 @@ def add_public_key(
760761
request: Optional[Union[cloudshell.AddPublicKeyRequest, dict]] = None,
761762
*,
762763
retry: OptionalRetry = gapic_v1.method.DEFAULT,
763-
timeout: Optional[float] = None,
764+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
764765
metadata: Sequence[Tuple[str, str]] = (),
765766
) -> operation.Operation:
766767
r"""Adds a public SSH key to an environment, allowing clients with
@@ -859,7 +860,7 @@ def remove_public_key(
859860
request: Optional[Union[cloudshell.RemovePublicKeyRequest, dict]] = None,
860861
*,
861862
retry: OptionalRetry = gapic_v1.method.DEFAULT,
862-
timeout: Optional[float] = None,
863+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
863864
metadata: Sequence[Tuple[str, str]] = (),
864865
) -> operation.Operation:
865866
r"""Removes a public SSH key from an environment. Clients will no
@@ -967,14 +968,9 @@ def __exit__(self, type, value, traceback):
967968
self.transport.close()
968969

969970

970-
try:
971-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
972-
gapic_version=pkg_resources.get_distribution(
973-
"google-cloud-shell",
974-
).version,
975-
)
976-
except pkg_resources.DistributionNotFound:
977-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
971+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
972+
gapic_version=package_version.__version__
973+
)
978974

979975

980976
__all__ = ("CloudShellServiceClient",)

google/cloud/shell_v1/services/cloud_shell_service/transports/base.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,13 @@
2424
from google.auth import credentials as ga_credentials # type: ignore
2525
from google.longrunning import operations_pb2 # type: ignore
2626
from google.oauth2 import service_account # type: ignore
27-
import pkg_resources
2827

28+
from google.cloud.shell_v1 import gapic_version as package_version
2929
from google.cloud.shell_v1.types import cloudshell
3030

31-
try:
32-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
33-
gapic_version=pkg_resources.get_distribution(
34-
"google-cloud-shell",
35-
).version,
36-
)
37-
except pkg_resources.DistributionNotFound:
38-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
31+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
32+
gapic_version=package_version.__version__
33+
)
3934

4035

4136
class CloudShellServiceTransport(abc.ABC):

release-please-config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"release-type": "python",
66
"extra-files": [
77
"google/cloud/shell/gapic_version.py",
8+
"google/cloud/shell_v1/gapic_version.py",
89
{
910
"type": "json",
1011
"path": "samples/generated_samples/snippet_metadata_google.cloud.shell.v1.json",

samples/generated_samples/cloudshell_v1_generated_cloud_shell_service_add_public_key_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async def sample_add_public_key():
4747

4848
print("Waiting for operation to complete...")
4949

50-
response = await operation.result()
50+
response = (await operation).result()
5151

5252
# Handle the response
5353
print(response)

samples/generated_samples/cloudshell_v1_generated_cloud_shell_service_authorize_environment_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async def sample_authorize_environment():
4747

4848
print("Waiting for operation to complete...")
4949

50-
response = await operation.result()
50+
response = (await operation).result()
5151

5252
# Handle the response
5353
print(response)

samples/generated_samples/cloudshell_v1_generated_cloud_shell_service_remove_public_key_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async def sample_remove_public_key():
4747

4848
print("Waiting for operation to complete...")
4949

50-
response = await operation.result()
50+
response = (await operation).result()
5151

5252
# Handle the response
5353
print(response)

samples/generated_samples/cloudshell_v1_generated_cloud_shell_service_start_environment_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ async def sample_start_environment():
4747

4848
print("Waiting for operation to complete...")
4949

50-
response = await operation.result()
50+
response = (await operation).result()
5151

5252
# Handle the response
5353
print(response)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
release_status = "Development Status :: 5 - Production/Stable"
3737

3838
dependencies = [
39-
"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.*",
39+
"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.*",
4040
"proto-plus >= 1.22.0, <2.0.0dev",
4141
"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",
4242
]

testing/constraints-3.7.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
# Pin the version to the lower bound.
55
# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev",
66
# Then this file should have google-cloud-foo==1.14.0
7-
google-api-core==1.33.2
7+
google-api-core==1.34.0
88
proto-plus==1.22.0
99
protobuf==3.19.5

0 commit comments

Comments
 (0)