Skip to content

Commit

Permalink
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#390)
Browse files Browse the repository at this point in the history
* 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 <partheniou@google.com>
  • Loading branch information
3 people committed Dec 7, 2022
1 parent 9e2753a commit 6f6bb63
Show file tree
Hide file tree
Showing 15 changed files with 117 additions and 105 deletions.
5 changes: 0 additions & 5 deletions .coveragerc
Expand Up @@ -30,8 +30,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
2 changes: 1 addition & 1 deletion google/cloud/datastore_admin_v1/__init__.py
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from google.cloud.datastore_admin import gapic_version as package_version
from google.cloud.datastore_admin_v1 import gapic_version as package_version

__version__ = package_version.__version__

Expand Down
15 changes: 15 additions & 0 deletions google/cloud/datastore_admin_v1/gapic_version.py
@@ -0,0 +1,15 @@
# 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__ = "2.11.0" # {x-release-please-version}
Expand Up @@ -27,7 +27,8 @@
Type,
Union,
)
import pkg_resources

from google.cloud.datastore_admin_v1 import gapic_version as package_version

from google.api_core.client_options import ClientOptions
from google.api_core import exceptions as core_exceptions
Expand Down Expand Up @@ -281,7 +282,7 @@ async def export_entities(
entity_filter: Optional[datastore_admin.EntityFilter] = None,
output_url_prefix: 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"""Exports a copy of all or a subset of entities from
Expand Down Expand Up @@ -321,7 +322,7 @@ async def sample_export_entities():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -462,7 +463,7 @@ async def import_entities(
input_url: Optional[str] = None,
entity_filter: Optional[datastore_admin.EntityFilter] = 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"""Imports entities into Google Cloud Datastore.
Expand Down Expand Up @@ -499,7 +500,7 @@ async def sample_import_entities():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -637,7 +638,7 @@ async def create_index(
request: Optional[Union[datastore_admin.CreateIndexRequest, 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"""Creates the specified index. A newly created index's initial
Expand Down Expand Up @@ -680,7 +681,7 @@ async def sample_create_index():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -747,7 +748,7 @@ async def delete_index(
request: Optional[Union[datastore_admin.DeleteIndexRequest, 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"""Deletes an existing index. An index can only be deleted if it is
Expand Down Expand Up @@ -789,7 +790,7 @@ async def sample_delete_index():
print("Waiting for operation to complete...")
response = await operation.result()
response = (await operation).result()
# Handle the response
print(response)
Expand Down Expand Up @@ -859,7 +860,7 @@ async def get_index(
request: Optional[Union[datastore_admin.GetIndexRequest, 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]] = (),
) -> index.Index:
r"""Gets an index.
Expand Down Expand Up @@ -951,7 +952,7 @@ async def list_indexes(
request: Optional[Union[datastore_admin.ListIndexesRequest, 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]] = (),
) -> pagers.ListIndexesAsyncPager:
r"""Lists the indexes that match the specified filters.
Expand Down Expand Up @@ -1060,14 +1061,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-datastore-admin",
).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__ = ("DatastoreAdminAsyncClient",)
26 changes: 11 additions & 15 deletions google/cloud/datastore_admin_v1/services/datastore_admin/client.py
Expand Up @@ -28,7 +28,8 @@
Union,
cast,
)
import pkg_resources

from google.cloud.datastore_admin_v1 import gapic_version as package_version

from google.api_core import client_options as client_options_lib
from google.api_core import exceptions as core_exceptions
Expand Down Expand Up @@ -485,7 +486,7 @@ def export_entities(
entity_filter: Optional[datastore_admin.EntityFilter] = None,
output_url_prefix: 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"""Exports a copy of all or a subset of entities from
Expand Down Expand Up @@ -665,7 +666,7 @@ def import_entities(
input_url: Optional[str] = None,
entity_filter: Optional[datastore_admin.EntityFilter] = 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"""Imports entities into Google Cloud Datastore.
Expand Down Expand Up @@ -839,7 +840,7 @@ def create_index(
request: Optional[Union[datastore_admin.CreateIndexRequest, 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"""Creates the specified index. A newly created index's initial
Expand Down Expand Up @@ -950,7 +951,7 @@ def delete_index(
request: Optional[Union[datastore_admin.DeleteIndexRequest, 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"""Deletes an existing index. An index can only be deleted if it is
Expand Down Expand Up @@ -1063,7 +1064,7 @@ def get_index(
request: Optional[Union[datastore_admin.GetIndexRequest, 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]] = (),
) -> index.Index:
r"""Gets an index.
Expand Down Expand Up @@ -1146,7 +1147,7 @@ def list_indexes(
request: Optional[Union[datastore_admin.ListIndexesRequest, 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]] = (),
) -> pagers.ListIndexesPager:
r"""Lists the indexes that match the specified filters.
Expand Down Expand Up @@ -1253,14 +1254,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-datastore-admin",
).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__ = ("DatastoreAdminClient",)
Expand Up @@ -15,7 +15,8 @@
#
import abc
from typing import Awaitable, Callable, Dict, Optional, Sequence, Union
import pkg_resources

from google.cloud.datastore_admin_v1 import gapic_version as package_version

import google.auth # type: ignore
import google.api_core
Expand All @@ -30,14 +31,9 @@
from google.cloud.datastore_admin_v1.types import index
from google.longrunning import operations_pb2 # type: ignore

try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
"google-cloud-datastore-admin",
).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 DatastoreAdminTransport(abc.ABC):
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/datastore_v1/__init__.py
Expand Up @@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from google.cloud.datastore import gapic_version as package_version
from google.cloud.datastore_v1 import gapic_version as package_version

__version__ = package_version.__version__

Expand Down
15 changes: 15 additions & 0 deletions google/cloud/datastore_v1/gapic_version.py
@@ -0,0 +1,15 @@
# 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__ = "2.11.0" # {x-release-please-version}

0 comments on commit 6f6bb63

Please sign in to comment.