Skip to content

Commit 829502a

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#390)
* 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: googleapis/googleapis-gen@387b734 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzg3YjczNDRjNzUyOWVlNDRiZTg0ZTYxM2IxOWE4MjA1MDhjNjEyYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix(deps): require google-api-core>=1.34.0,>=2.11.0 * fix cover * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * revert * set coverage level to 99 * set coverage level to 100 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * add test * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * add test Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
1 parent 171c7b8 commit 829502a

File tree

15 files changed

+117
-105
lines changed

15 files changed

+117
-105
lines changed

packages/google-cloud-datastore/.coveragerc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,3 @@ exclude_lines =
3030
pragma: NO COVER
3131
# Ignore debug-only repr
3232
def __repr__
33-
# Ignore pkg_resources exceptions.
34-
# This is added at the module level as a safeguard for if someone
35-
# generates the code and tries to run it without pip installing. This
36-
# makes it virtually impossible to test properly.
37-
except pkg_resources.DistributionNotFound

packages/google-cloud-datastore/google/cloud/datastore_admin_v1/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
from google.cloud.datastore_admin import gapic_version as package_version
16+
from google.cloud.datastore_admin_v1 import gapic_version as package_version
1717

1818
__version__ = package_version.__version__
1919

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2022 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
__version__ = "2.11.0" # {x-release-please-version}

packages/google-cloud-datastore/google/cloud/datastore_admin_v1/services/datastore_admin/async_client.py

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
Type,
2828
Union,
2929
)
30-
import pkg_resources
30+
31+
from google.cloud.datastore_admin_v1 import gapic_version as package_version
3132

3233
from google.api_core.client_options import ClientOptions
3334
from google.api_core import exceptions as core_exceptions
@@ -281,7 +282,7 @@ async def export_entities(
281282
entity_filter: Optional[datastore_admin.EntityFilter] = None,
282283
output_url_prefix: Optional[str] = None,
283284
retry: OptionalRetry = gapic_v1.method.DEFAULT,
284-
timeout: Optional[float] = None,
285+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
285286
metadata: Sequence[Tuple[str, str]] = (),
286287
) -> operation_async.AsyncOperation:
287288
r"""Exports a copy of all or a subset of entities from
@@ -321,7 +322,7 @@ async def sample_export_entities():
321322
322323
print("Waiting for operation to complete...")
323324
324-
response = await operation.result()
325+
response = (await operation).result()
325326
326327
# Handle the response
327328
print(response)
@@ -462,7 +463,7 @@ async def import_entities(
462463
input_url: Optional[str] = None,
463464
entity_filter: Optional[datastore_admin.EntityFilter] = None,
464465
retry: OptionalRetry = gapic_v1.method.DEFAULT,
465-
timeout: Optional[float] = None,
466+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
466467
metadata: Sequence[Tuple[str, str]] = (),
467468
) -> operation_async.AsyncOperation:
468469
r"""Imports entities into Google Cloud Datastore.
@@ -499,7 +500,7 @@ async def sample_import_entities():
499500
500501
print("Waiting for operation to complete...")
501502
502-
response = await operation.result()
503+
response = (await operation).result()
503504
504505
# Handle the response
505506
print(response)
@@ -637,7 +638,7 @@ async def create_index(
637638
request: Optional[Union[datastore_admin.CreateIndexRequest, dict]] = None,
638639
*,
639640
retry: OptionalRetry = gapic_v1.method.DEFAULT,
640-
timeout: Optional[float] = None,
641+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
641642
metadata: Sequence[Tuple[str, str]] = (),
642643
) -> operation_async.AsyncOperation:
643644
r"""Creates the specified index. A newly created index's initial
@@ -680,7 +681,7 @@ async def sample_create_index():
680681
681682
print("Waiting for operation to complete...")
682683
683-
response = await operation.result()
684+
response = (await operation).result()
684685
685686
# Handle the response
686687
print(response)
@@ -747,7 +748,7 @@ async def delete_index(
747748
request: Optional[Union[datastore_admin.DeleteIndexRequest, dict]] = None,
748749
*,
749750
retry: OptionalRetry = gapic_v1.method.DEFAULT,
750-
timeout: Optional[float] = None,
751+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
751752
metadata: Sequence[Tuple[str, str]] = (),
752753
) -> operation_async.AsyncOperation:
753754
r"""Deletes an existing index. An index can only be deleted if it is
@@ -789,7 +790,7 @@ async def sample_delete_index():
789790
790791
print("Waiting for operation to complete...")
791792
792-
response = await operation.result()
793+
response = (await operation).result()
793794
794795
# Handle the response
795796
print(response)
@@ -859,7 +860,7 @@ async def get_index(
859860
request: Optional[Union[datastore_admin.GetIndexRequest, 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
) -> index.Index:
865866
r"""Gets an index.
@@ -951,7 +952,7 @@ async def list_indexes(
951952
request: Optional[Union[datastore_admin.ListIndexesRequest, dict]] = None,
952953
*,
953954
retry: OptionalRetry = gapic_v1.method.DEFAULT,
954-
timeout: Optional[float] = None,
955+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
955956
metadata: Sequence[Tuple[str, str]] = (),
956957
) -> pagers.ListIndexesAsyncPager:
957958
r"""Lists the indexes that match the specified filters.
@@ -1060,14 +1061,9 @@ async def __aexit__(self, exc_type, exc, tb):
10601061
await self.transport.close()
10611062

10621063

1063-
try:
1064-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1065-
gapic_version=pkg_resources.get_distribution(
1066-
"google-cloud-datastore-admin",
1067-
).version,
1068-
)
1069-
except pkg_resources.DistributionNotFound:
1070-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
1064+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1065+
gapic_version=package_version.__version__
1066+
)
10711067

10721068

10731069
__all__ = ("DatastoreAdminAsyncClient",)

packages/google-cloud-datastore/google/cloud/datastore_admin_v1/services/datastore_admin/client.py

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
Union,
2929
cast,
3030
)
31-
import pkg_resources
31+
32+
from google.cloud.datastore_admin_v1 import gapic_version as package_version
3233

3334
from google.api_core import client_options as client_options_lib
3435
from google.api_core import exceptions as core_exceptions
@@ -485,7 +486,7 @@ def export_entities(
485486
entity_filter: Optional[datastore_admin.EntityFilter] = None,
486487
output_url_prefix: Optional[str] = None,
487488
retry: OptionalRetry = gapic_v1.method.DEFAULT,
488-
timeout: Optional[float] = None,
489+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
489490
metadata: Sequence[Tuple[str, str]] = (),
490491
) -> operation.Operation:
491492
r"""Exports a copy of all or a subset of entities from
@@ -665,7 +666,7 @@ def import_entities(
665666
input_url: Optional[str] = None,
666667
entity_filter: Optional[datastore_admin.EntityFilter] = None,
667668
retry: OptionalRetry = gapic_v1.method.DEFAULT,
668-
timeout: Optional[float] = None,
669+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
669670
metadata: Sequence[Tuple[str, str]] = (),
670671
) -> operation.Operation:
671672
r"""Imports entities into Google Cloud Datastore.
@@ -839,7 +840,7 @@ def create_index(
839840
request: Optional[Union[datastore_admin.CreateIndexRequest, dict]] = None,
840841
*,
841842
retry: OptionalRetry = gapic_v1.method.DEFAULT,
842-
timeout: Optional[float] = None,
843+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
843844
metadata: Sequence[Tuple[str, str]] = (),
844845
) -> operation.Operation:
845846
r"""Creates the specified index. A newly created index's initial
@@ -950,7 +951,7 @@ def delete_index(
950951
request: Optional[Union[datastore_admin.DeleteIndexRequest, dict]] = None,
951952
*,
952953
retry: OptionalRetry = gapic_v1.method.DEFAULT,
953-
timeout: Optional[float] = None,
954+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
954955
metadata: Sequence[Tuple[str, str]] = (),
955956
) -> operation.Operation:
956957
r"""Deletes an existing index. An index can only be deleted if it is
@@ -1063,7 +1064,7 @@ def get_index(
10631064
request: Optional[Union[datastore_admin.GetIndexRequest, dict]] = None,
10641065
*,
10651066
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1066-
timeout: Optional[float] = None,
1067+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
10671068
metadata: Sequence[Tuple[str, str]] = (),
10681069
) -> index.Index:
10691070
r"""Gets an index.
@@ -1146,7 +1147,7 @@ def list_indexes(
11461147
request: Optional[Union[datastore_admin.ListIndexesRequest, dict]] = None,
11471148
*,
11481149
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1149-
timeout: Optional[float] = None,
1150+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
11501151
metadata: Sequence[Tuple[str, str]] = (),
11511152
) -> pagers.ListIndexesPager:
11521153
r"""Lists the indexes that match the specified filters.
@@ -1253,14 +1254,9 @@ def __exit__(self, type, value, traceback):
12531254
self.transport.close()
12541255

12551256

1256-
try:
1257-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1258-
gapic_version=pkg_resources.get_distribution(
1259-
"google-cloud-datastore-admin",
1260-
).version,
1261-
)
1262-
except pkg_resources.DistributionNotFound:
1263-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
1257+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
1258+
gapic_version=package_version.__version__
1259+
)
12641260

12651261

12661262
__all__ = ("DatastoreAdminClient",)

packages/google-cloud-datastore/google/cloud/datastore_admin_v1/services/datastore_admin/transports/base.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
#
1616
import abc
1717
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
18-
import pkg_resources
18+
19+
from google.cloud.datastore_admin_v1 import gapic_version as package_version
1920

2021
import google.auth # type: ignore
2122
import google.api_core
@@ -30,14 +31,9 @@
3031
from google.cloud.datastore_admin_v1.types import index
3132
from google.longrunning import operations_pb2 # type: ignore
3233

33-
try:
34-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
35-
gapic_version=pkg_resources.get_distribution(
36-
"google-cloud-datastore-admin",
37-
).version,
38-
)
39-
except pkg_resources.DistributionNotFound:
40-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
34+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
35+
gapic_version=package_version.__version__
36+
)
4137

4238

4339
class DatastoreAdminTransport(abc.ABC):

packages/google-cloud-datastore/google/cloud/datastore_v1/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
from google.cloud.datastore import gapic_version as package_version
16+
from google.cloud.datastore_v1 import gapic_version as package_version
1717

1818
__version__ = package_version.__version__
1919

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2022 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
__version__ = "2.11.0" # {x-release-please-version}

0 commit comments

Comments
 (0)