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

Commit b1f7a36

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#231)
* 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 * 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 c9c771a commit b1f7a36

25 files changed

+148
-145
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.4" # {x-release-please-version}

google/cloud/memcache_v1/services/cloud_memcache/async_client.py

Lines changed: 25 additions & 29 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.memcache_v1 import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -246,7 +247,7 @@ async def list_instances(
246247
*,
247248
parent: Optional[str] = None,
248249
retry: OptionalRetry = gapic_v1.method.DEFAULT,
249-
timeout: Optional[float] = None,
250+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
250251
metadata: Sequence[Tuple[str, str]] = (),
251252
) -> pagers.ListInstancesAsyncPager:
252253
r"""Lists Instances in a given location.
@@ -363,7 +364,7 @@ async def get_instance(
363364
*,
364365
name: Optional[str] = None,
365366
retry: OptionalRetry = gapic_v1.method.DEFAULT,
366-
timeout: Optional[float] = None,
367+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
367368
metadata: Sequence[Tuple[str, str]] = (),
368369
) -> cloud_memcache.Instance:
369370
r"""Gets details of a single Instance.
@@ -467,7 +468,7 @@ async def create_instance(
467468
instance: Optional[cloud_memcache.Instance] = None,
468469
instance_id: Optional[str] = None,
469470
retry: OptionalRetry = gapic_v1.method.DEFAULT,
470-
timeout: Optional[float] = None,
471+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
471472
metadata: Sequence[Tuple[str, str]] = (),
472473
) -> operation_async.AsyncOperation:
473474
r"""Creates a new Instance in a given location.
@@ -505,7 +506,7 @@ async def sample_create_instance():
505506
506507
print("Waiting for operation to complete...")
507508
508-
response = await operation.result()
509+
response = (await operation).result()
509510
510511
# Handle the response
511512
print(response)
@@ -621,7 +622,7 @@ async def update_instance(
621622
instance: Optional[cloud_memcache.Instance] = None,
622623
update_mask: Optional[field_mask_pb2.FieldMask] = None,
623624
retry: OptionalRetry = gapic_v1.method.DEFAULT,
624-
timeout: Optional[float] = None,
625+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
625626
metadata: Sequence[Tuple[str, str]] = (),
626627
) -> operation_async.AsyncOperation:
627628
r"""Updates an existing Instance in a given project and
@@ -658,7 +659,7 @@ async def sample_update_instance():
658659
659660
print("Waiting for operation to complete...")
660661
661-
response = await operation.result()
662+
response = (await operation).result()
662663
663664
# Handle the response
664665
print(response)
@@ -759,7 +760,7 @@ async def update_parameters(
759760
update_mask: Optional[field_mask_pb2.FieldMask] = None,
760761
parameters: Optional[cloud_memcache.MemcacheParameters] = None,
761762
retry: OptionalRetry = gapic_v1.method.DEFAULT,
762-
timeout: Optional[float] = None,
763+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
763764
metadata: Sequence[Tuple[str, str]] = (),
764765
) -> operation_async.AsyncOperation:
765766
r"""Updates the defined Memcached parameters for an existing
@@ -792,7 +793,7 @@ async def sample_update_parameters():
792793
793794
print("Waiting for operation to complete...")
794795
795-
response = await operation.result()
796+
response = (await operation).result()
796797
797798
# Handle the response
798799
print(response)
@@ -896,7 +897,7 @@ async def delete_instance(
896897
*,
897898
name: Optional[str] = None,
898899
retry: OptionalRetry = gapic_v1.method.DEFAULT,
899-
timeout: Optional[float] = None,
900+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
900901
metadata: Sequence[Tuple[str, str]] = (),
901902
) -> operation_async.AsyncOperation:
902903
r"""Deletes a single Instance.
@@ -926,7 +927,7 @@ async def sample_delete_instance():
926927
927928
print("Waiting for operation to complete...")
928929
929-
response = await operation.result()
930+
response = (await operation).result()
930931
931932
# Handle the response
932933
print(response)
@@ -1024,7 +1025,7 @@ async def apply_parameters(
10241025
node_ids: Optional[MutableSequence[str]] = None,
10251026
apply_all: Optional[bool] = None,
10261027
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1027-
timeout: Optional[float] = None,
1028+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
10281029
metadata: Sequence[Tuple[str, str]] = (),
10291030
) -> operation_async.AsyncOperation:
10301031
r"""``ApplyParameters`` restarts the set of specified nodes in order
@@ -1056,7 +1057,7 @@ async def sample_apply_parameters():
10561057
10571058
print("Waiting for operation to complete...")
10581059
1059-
response = await operation.result()
1060+
response = (await operation).result()
10601061
10611062
# Handle the response
10621063
print(response)
@@ -1170,7 +1171,7 @@ async def reschedule_maintenance(
11701171
] = None,
11711172
schedule_time: Optional[timestamp_pb2.Timestamp] = None,
11721173
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1173-
timeout: Optional[float] = None,
1174+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
11741175
metadata: Sequence[Tuple[str, str]] = (),
11751176
) -> operation_async.AsyncOperation:
11761177
r"""Reschedules upcoming maintenance event.
@@ -1201,7 +1202,7 @@ async def sample_reschedule_maintenance():
12011202
12021203
print("Waiting for operation to complete...")
12031204
1204-
response = await operation.result()
1205+
response = (await operation).result()
12051206
12061207
# Handle the response
12071208
print(response)
@@ -1308,7 +1309,7 @@ async def list_operations(
13081309
request: Optional[operations_pb2.ListOperationsRequest] = None,
13091310
*,
13101311
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1311-
timeout: Optional[float] = None,
1312+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
13121313
metadata: Sequence[Tuple[str, str]] = (),
13131314
) -> operations_pb2.ListOperationsResponse:
13141315
r"""Lists operations that match the specified filter in the request.
@@ -1362,7 +1363,7 @@ async def get_operation(
13621363
request: Optional[operations_pb2.GetOperationRequest] = None,
13631364
*,
13641365
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1365-
timeout: Optional[float] = None,
1366+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
13661367
metadata: Sequence[Tuple[str, str]] = (),
13671368
) -> operations_pb2.Operation:
13681369
r"""Gets the latest state of a long-running operation.
@@ -1416,7 +1417,7 @@ async def delete_operation(
14161417
request: Optional[operations_pb2.DeleteOperationRequest] = None,
14171418
*,
14181419
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1419-
timeout: Optional[float] = None,
1420+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
14201421
metadata: Sequence[Tuple[str, str]] = (),
14211422
) -> None:
14221423
r"""Deletes a long-running operation.
@@ -1471,7 +1472,7 @@ async def cancel_operation(
14711472
request: Optional[operations_pb2.CancelOperationRequest] = None,
14721473
*,
14731474
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1474-
timeout: Optional[float] = None,
1475+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
14751476
metadata: Sequence[Tuple[str, str]] = (),
14761477
) -> None:
14771478
r"""Starts asynchronous cancellation on a long-running operation.
@@ -1525,7 +1526,7 @@ async def get_location(
15251526
request: Optional[locations_pb2.GetLocationRequest] = None,
15261527
*,
15271528
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1528-
timeout: Optional[float] = None,
1529+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
15291530
metadata: Sequence[Tuple[str, str]] = (),
15301531
) -> locations_pb2.Location:
15311532
r"""Gets information about a location.
@@ -1579,7 +1580,7 @@ async def list_locations(
15791580
request: Optional[locations_pb2.ListLocationsRequest] = None,
15801581
*,
15811582
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1582-
timeout: Optional[float] = None,
1583+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
15831584
metadata: Sequence[Tuple[str, str]] = (),
15841585
) -> locations_pb2.ListLocationsResponse:
15851586
r"""Lists information about the supported locations for this service.
@@ -1635,14 +1636,9 @@ async def __aexit__(self, exc_type, exc, tb):
16351636
await self.transport.close()
16361637

16371638

1638-
try:
1639-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1640-
gapic_version=pkg_resources.get_distribution(
1641-
"google-cloud-memcache",
1642-
).version,
1643-
)
1644-
except pkg_resources.DistributionNotFound:
1645-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
1639+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1640+
gapic_version=package_version.__version__
1641+
)
16461642

16471643

16481644
__all__ = ("CloudMemcacheAsyncClient",)

google/cloud/memcache_v1/services/cloud_memcache/client.py

Lines changed: 19 additions & 23 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.memcache_v1 import gapic_version as package_version
4243

4344
try:
4445
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -471,7 +472,7 @@ def list_instances(
471472
*,
472473
parent: Optional[str] = None,
473474
retry: OptionalRetry = gapic_v1.method.DEFAULT,
474-
timeout: Optional[float] = None,
475+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
475476
metadata: Sequence[Tuple[str, str]] = (),
476477
) -> pagers.ListInstancesPager:
477478
r"""Lists Instances in a given location.
@@ -588,7 +589,7 @@ def get_instance(
588589
*,
589590
name: Optional[str] = None,
590591
retry: OptionalRetry = gapic_v1.method.DEFAULT,
591-
timeout: Optional[float] = None,
592+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
592593
metadata: Sequence[Tuple[str, str]] = (),
593594
) -> cloud_memcache.Instance:
594595
r"""Gets details of a single Instance.
@@ -692,7 +693,7 @@ def create_instance(
692693
instance: Optional[cloud_memcache.Instance] = None,
693694
instance_id: Optional[str] = None,
694695
retry: OptionalRetry = gapic_v1.method.DEFAULT,
695-
timeout: Optional[float] = None,
696+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
696697
metadata: Sequence[Tuple[str, str]] = (),
697698
) -> operation.Operation:
698699
r"""Creates a new Instance in a given location.
@@ -846,7 +847,7 @@ def update_instance(
846847
instance: Optional[cloud_memcache.Instance] = None,
847848
update_mask: Optional[field_mask_pb2.FieldMask] = None,
848849
retry: OptionalRetry = gapic_v1.method.DEFAULT,
849-
timeout: Optional[float] = None,
850+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
850851
metadata: Sequence[Tuple[str, str]] = (),
851852
) -> operation.Operation:
852853
r"""Updates an existing Instance in a given project and
@@ -984,7 +985,7 @@ def update_parameters(
984985
update_mask: Optional[field_mask_pb2.FieldMask] = None,
985986
parameters: Optional[cloud_memcache.MemcacheParameters] = None,
986987
retry: OptionalRetry = gapic_v1.method.DEFAULT,
987-
timeout: Optional[float] = None,
988+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
988989
metadata: Sequence[Tuple[str, str]] = (),
989990
) -> operation.Operation:
990991
r"""Updates the defined Memcached parameters for an existing
@@ -1121,7 +1122,7 @@ def delete_instance(
11211122
*,
11221123
name: Optional[str] = None,
11231124
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1124-
timeout: Optional[float] = None,
1125+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
11251126
metadata: Sequence[Tuple[str, str]] = (),
11261127
) -> operation.Operation:
11271128
r"""Deletes a single Instance.
@@ -1249,7 +1250,7 @@ def apply_parameters(
12491250
node_ids: Optional[MutableSequence[str]] = None,
12501251
apply_all: Optional[bool] = None,
12511252
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1252-
timeout: Optional[float] = None,
1253+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
12531254
metadata: Sequence[Tuple[str, str]] = (),
12541255
) -> operation.Operation:
12551256
r"""``ApplyParameters`` restarts the set of specified nodes in order
@@ -1395,7 +1396,7 @@ def reschedule_maintenance(
13951396
] = None,
13961397
schedule_time: Optional[timestamp_pb2.Timestamp] = None,
13971398
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1398-
timeout: Optional[float] = None,
1399+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
13991400
metadata: Sequence[Tuple[str, str]] = (),
14001401
) -> operation.Operation:
14011402
r"""Reschedules upcoming maintenance event.
@@ -1546,7 +1547,7 @@ def list_operations(
15461547
request: Optional[operations_pb2.ListOperationsRequest] = None,
15471548
*,
15481549
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1549-
timeout: Optional[float] = None,
1550+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
15501551
metadata: Sequence[Tuple[str, str]] = (),
15511552
) -> operations_pb2.ListOperationsResponse:
15521553
r"""Lists operations that match the specified filter in the request.
@@ -1600,7 +1601,7 @@ def get_operation(
16001601
request: Optional[operations_pb2.GetOperationRequest] = None,
16011602
*,
16021603
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1603-
timeout: Optional[float] = None,
1604+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
16041605
metadata: Sequence[Tuple[str, str]] = (),
16051606
) -> operations_pb2.Operation:
16061607
r"""Gets the latest state of a long-running operation.
@@ -1654,7 +1655,7 @@ def delete_operation(
16541655
request: Optional[operations_pb2.DeleteOperationRequest] = None,
16551656
*,
16561657
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1657-
timeout: Optional[float] = None,
1658+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
16581659
metadata: Sequence[Tuple[str, str]] = (),
16591660
) -> None:
16601661
r"""Deletes a long-running operation.
@@ -1709,7 +1710,7 @@ def cancel_operation(
17091710
request: Optional[operations_pb2.CancelOperationRequest] = None,
17101711
*,
17111712
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1712-
timeout: Optional[float] = None,
1713+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
17131714
metadata: Sequence[Tuple[str, str]] = (),
17141715
) -> None:
17151716
r"""Starts asynchronous cancellation on a long-running operation.
@@ -1763,7 +1764,7 @@ def get_location(
17631764
request: Optional[locations_pb2.GetLocationRequest] = None,
17641765
*,
17651766
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1766-
timeout: Optional[float] = None,
1767+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
17671768
metadata: Sequence[Tuple[str, str]] = (),
17681769
) -> locations_pb2.Location:
17691770
r"""Gets information about a location.
@@ -1817,7 +1818,7 @@ def list_locations(
18171818
request: Optional[locations_pb2.ListLocationsRequest] = None,
18181819
*,
18191820
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1820-
timeout: Optional[float] = None,
1821+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
18211822
metadata: Sequence[Tuple[str, str]] = (),
18221823
) -> locations_pb2.ListLocationsResponse:
18231824
r"""Lists information about the supported locations for this service.
@@ -1867,14 +1868,9 @@ def list_locations(
18671868
return response
18681869

18691870

1870-
try:
1871-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1872-
gapic_version=pkg_resources.get_distribution(
1873-
"google-cloud-memcache",
1874-
).version,
1875-
)
1876-
except pkg_resources.DistributionNotFound:
1877-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
1871+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1872+
gapic_version=package_version.__version__
1873+
)
18781874

18791875

18801876
__all__ = ("CloudMemcacheClient",)

0 commit comments

Comments
 (0)