From 953fd524d2018a380a2c016cc097b61c6bb2884b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 24 Nov 2022 16:45:59 -0800 Subject: [PATCH] chore: Update gapic-generator-python to v1.6.1 (#378) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Update gapic-generator-python to v1.6.1 PiperOrigin-RevId: 488036204 Source-Link: https://github.com/googleapis/googleapis/commit/08f275f5c1c0d99056e1cb68376323414459ee19 Source-Link: https://github.com/googleapis/googleapis-gen/commit/555c0945e60649e38739ae64bc45719cdf72178f Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTU1YzA5NDVlNjA2NDllMzg3MzlhZTY0YmM0NTcxOWNkZjcyMTc4ZiJ9 feat: new APIs added to reflect updates to the filestore service - Add ENTERPRISE Tier - Add snapshot APIs: RevertInstance, ListSnapshots, CreateSnapshot, DeleteSnapshot, UpdateSnapshot - Add multi-share APIs: ListShares, GetShare, CreateShare, DeleteShare, UpdateShare - Add ConnectMode to NetworkConfig (for Private Service Access support) - New status codes (SUSPENDED/SUSPENDING, REVERTING/RESUMING) - Add SuspensionReason (for KMS related suspension) - Add new fields to Instance information: max_capacity_gb, capacity_step_size_gb, max_share_count, capacity_gb, multi_share_enabled PiperOrigin-RevId: 487492758 Source-Link: https://github.com/googleapis/googleapis/commit/5be5981f50322cf0c7388595e0f31ac5d0693469 Source-Link: https://github.com/googleapis/googleapis-gen/commit/ab0e217f560cc2c1afc11441c2eab6b6950efd2b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWIwZTIxN2Y1NjBjYzJjMWFmYzExNDQxYzJlYWI2YjY5NTBlZmQyYiJ9 chore: Update to gapic-generator-python 1.6.0 feat(python): Add typing to proto.Message based class attributes feat(python): Snippetgen handling of repeated enum field PiperOrigin-RevId: 487326846 Source-Link: https://github.com/googleapis/googleapis/commit/da380c77bb87ba0f752baf07605dd1db30e1f7e1 Source-Link: https://github.com/googleapis/googleapis-gen/commit/61ef5762ee6731a0cbbfea22fd0eecee51ab1c8e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjFlZjU3NjJlZTY3MzFhMGNiYmZlYTIyZmQwZWVjZWU1MWFiMWM4ZSJ9 chore: update to gapic-generator-python 1.5.0 feat: add support for `google.cloud..__version__` PiperOrigin-RevId: 484665853 Source-Link: https://github.com/googleapis/googleapis/commit/8eb249a19db926c2fbc4ecf1dc09c0e521a88b22 Source-Link: https://github.com/googleapis/googleapis-gen/commit/c8aa327b5f478865fc3fd91e3c2768e54e26ad44 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzhhYTMyN2I1ZjQ3ODg2NWZjM2ZkOTFlM2MyNzY4ZTU0ZTI2YWQ0NCJ9 * 🦉 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 release-please config and manifest. Update gapic_version and setup py. * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * Rename release-please-config.json * add generated code for google/cloud/datastore_admin * configure release please to use manifest * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * configure release please to use manifest Co-authored-by: Owl Bot Co-authored-by: Mariatta Wijaya Co-authored-by: Anthonios Partheniou Co-authored-by: Mariatta Wijaya --- .github/release-please.yml | 1 + .release-please-manifest.json | 3 + google/cloud/datastore/gapic_version.py | 15 ++ google/cloud/datastore_admin/__init__.py | 76 +++++++++ google/cloud/datastore_admin/gapic_version.py | 16 ++ google/cloud/datastore_admin/py.typed | 2 + google/cloud/datastore_admin_v1/__init__.py | 4 + .../services/datastore_admin/async_client.py | 72 +++++---- .../services/datastore_admin/client.py | 66 ++++---- .../datastore_admin/transports/base.py | 2 +- .../datastore_admin/transports/grpc.py | 20 +-- .../transports/grpc_asyncio.py | 16 +- .../types/datastore_admin.py | 104 +++++++------ .../cloud/datastore_admin_v1/types/index.py | 20 +-- .../datastore_admin_v1/types/migration.py | 14 +- google/cloud/datastore_v1/__init__.py | 4 + .../services/datastore/async_client.py | 116 +++++++------- .../datastore_v1/services/datastore/client.py | 106 +++++++------ .../services/datastore/transports/base.py | 2 +- .../services/datastore/transports/grpc.py | 20 +-- .../datastore/transports/grpc_asyncio.py | 16 +- .../datastore_v1/types/aggregation_result.py | 14 +- google/cloud/datastore_v1/types/datastore.py | 146 +++++++++--------- google/cloud/datastore_v1/types/entity.py | 56 +++---- google/cloud/datastore_v1/types/query.py | 108 ++++++------- owlbot.py | 3 +- release-please-config.json | 20 +++ setup.py | 2 +- .../test_datastore_admin.py | 1 + 29 files changed, 623 insertions(+), 422 deletions(-) create mode 100644 .release-please-manifest.json create mode 100644 google/cloud/datastore/gapic_version.py create mode 100644 google/cloud/datastore_admin/__init__.py create mode 100644 google/cloud/datastore_admin/gapic_version.py create mode 100644 google/cloud/datastore_admin/py.typed create mode 100644 release-please-config.json diff --git a/.github/release-please.yml b/.github/release-please.yml index 29601ad4..fe749ff6 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,5 +1,6 @@ releaseType: python handleGHRelease: true +manifest: true # NOTE: this section is generated by synthtool.languages.python # See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py branches: diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 00000000..a2cc302e --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "2.10.0" +} \ No newline at end of file diff --git a/google/cloud/datastore/gapic_version.py b/google/cloud/datastore/gapic_version.py new file mode 100644 index 00000000..60f4adfc --- /dev/null +++ b/google/cloud/datastore/gapic_version.py @@ -0,0 +1,15 @@ +# Copyright 2020 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.10.0" # {x-release-please-version} diff --git a/google/cloud/datastore_admin/__init__.py b/google/cloud/datastore_admin/__init__.py new file mode 100644 index 00000000..6e5cd0cd --- /dev/null +++ b/google/cloud/datastore_admin/__init__.py @@ -0,0 +1,76 @@ +# -*- 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. +# +from google.cloud.datastore_admin import gapic_version as package_version + +__version__ = package_version.__version__ + + +from google.cloud.datastore_admin_v1.services.datastore_admin.client import ( + DatastoreAdminClient, +) +from google.cloud.datastore_admin_v1.services.datastore_admin.async_client import ( + DatastoreAdminAsyncClient, +) + +from google.cloud.datastore_admin_v1.types.datastore_admin import CommonMetadata +from google.cloud.datastore_admin_v1.types.datastore_admin import CreateIndexRequest +from google.cloud.datastore_admin_v1.types.datastore_admin import ( + DatastoreFirestoreMigrationMetadata, +) +from google.cloud.datastore_admin_v1.types.datastore_admin import DeleteIndexRequest +from google.cloud.datastore_admin_v1.types.datastore_admin import EntityFilter +from google.cloud.datastore_admin_v1.types.datastore_admin import ExportEntitiesMetadata +from google.cloud.datastore_admin_v1.types.datastore_admin import ExportEntitiesRequest +from google.cloud.datastore_admin_v1.types.datastore_admin import ExportEntitiesResponse +from google.cloud.datastore_admin_v1.types.datastore_admin import GetIndexRequest +from google.cloud.datastore_admin_v1.types.datastore_admin import ImportEntitiesMetadata +from google.cloud.datastore_admin_v1.types.datastore_admin import ImportEntitiesRequest +from google.cloud.datastore_admin_v1.types.datastore_admin import IndexOperationMetadata +from google.cloud.datastore_admin_v1.types.datastore_admin import ListIndexesRequest +from google.cloud.datastore_admin_v1.types.datastore_admin import ListIndexesResponse +from google.cloud.datastore_admin_v1.types.datastore_admin import Progress +from google.cloud.datastore_admin_v1.types.datastore_admin import OperationType +from google.cloud.datastore_admin_v1.types.index import Index +from google.cloud.datastore_admin_v1.types.migration import MigrationProgressEvent +from google.cloud.datastore_admin_v1.types.migration import MigrationStateEvent +from google.cloud.datastore_admin_v1.types.migration import MigrationState +from google.cloud.datastore_admin_v1.types.migration import MigrationStep + +__all__ = ( + "DatastoreAdminClient", + "DatastoreAdminAsyncClient", + "CommonMetadata", + "CreateIndexRequest", + "DatastoreFirestoreMigrationMetadata", + "DeleteIndexRequest", + "EntityFilter", + "ExportEntitiesMetadata", + "ExportEntitiesRequest", + "ExportEntitiesResponse", + "GetIndexRequest", + "ImportEntitiesMetadata", + "ImportEntitiesRequest", + "IndexOperationMetadata", + "ListIndexesRequest", + "ListIndexesResponse", + "Progress", + "OperationType", + "Index", + "MigrationProgressEvent", + "MigrationStateEvent", + "MigrationState", + "MigrationStep", +) diff --git a/google/cloud/datastore_admin/gapic_version.py b/google/cloud/datastore_admin/gapic_version.py new file mode 100644 index 00000000..00f0a8d0 --- /dev/null +++ b/google/cloud/datastore_admin/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__ = "2.10.0" # {x-release-please-version} diff --git a/google/cloud/datastore_admin/py.typed b/google/cloud/datastore_admin/py.typed new file mode 100644 index 00000000..dc48a544 --- /dev/null +++ b/google/cloud/datastore_admin/py.typed @@ -0,0 +1,2 @@ +# Marker file for PEP 561. +# The google-cloud-datastore-admin package uses inline types. diff --git a/google/cloud/datastore_admin_v1/__init__.py b/google/cloud/datastore_admin_v1/__init__.py index 4d0164cf..4b0552de 100644 --- a/google/cloud/datastore_admin_v1/__init__.py +++ b/google/cloud/datastore_admin_v1/__init__.py @@ -13,6 +13,10 @@ # 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 + +__version__ = package_version.__version__ + from .services.datastore_admin import DatastoreAdminClient from .services.datastore_admin import DatastoreAdminAsyncClient diff --git a/google/cloud/datastore_admin_v1/services/datastore_admin/async_client.py b/google/cloud/datastore_admin_v1/services/datastore_admin/async_client.py index 2a7e46c4..bd96febe 100644 --- a/google/cloud/datastore_admin_v1/services/datastore_admin/async_client.py +++ b/google/cloud/datastore_admin_v1/services/datastore_admin/async_client.py @@ -16,7 +16,17 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) import pkg_resources from google.api_core.client_options import ClientOptions @@ -218,9 +228,9 @@ def transport(self) -> DatastoreAdminTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, DatastoreAdminTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the datastore admin client. @@ -264,14 +274,14 @@ def __init__( async def export_entities( self, - request: Union[datastore_admin.ExportEntitiesRequest, dict] = None, + request: Optional[Union[datastore_admin.ExportEntitiesRequest, dict]] = None, *, - project_id: str = None, - labels: Mapping[str, str] = None, - entity_filter: datastore_admin.EntityFilter = None, - output_url_prefix: str = None, + project_id: Optional[str] = None, + labels: Optional[MutableMapping[str, str]] = None, + entity_filter: Optional[datastore_admin.EntityFilter] = None, + output_url_prefix: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Exports a copy of all or a subset of entities from @@ -317,7 +327,7 @@ async def sample_export_entities(): print(response) Args: - request (Union[google.cloud.datastore_admin_v1.types.ExportEntitiesRequest, dict]): + request (Optional[Union[google.cloud.datastore_admin_v1.types.ExportEntitiesRequest, dict]]): The request object. The request for [google.datastore.admin.v1.DatastoreAdmin.ExportEntities][google.datastore.admin.v1.DatastoreAdmin.ExportEntities]. project_id (:class:`str`): @@ -327,7 +337,7 @@ async def sample_export_entities(): This corresponds to the ``project_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - labels (:class:`Mapping[str, str]`): + labels (:class:`MutableMapping[str, str]`): Client-assigned labels. This corresponds to the ``labels`` field on the ``request`` instance; if ``request`` is provided, this @@ -445,14 +455,14 @@ async def sample_export_entities(): async def import_entities( self, - request: Union[datastore_admin.ImportEntitiesRequest, dict] = None, + request: Optional[Union[datastore_admin.ImportEntitiesRequest, dict]] = None, *, - project_id: str = None, - labels: Mapping[str, str] = None, - input_url: str = None, - entity_filter: datastore_admin.EntityFilter = None, + project_id: Optional[str] = None, + labels: Optional[MutableMapping[str, str]] = None, + input_url: Optional[str] = None, + entity_filter: Optional[datastore_admin.EntityFilter] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Imports entities into Google Cloud Datastore. @@ -495,7 +505,7 @@ async def sample_import_entities(): print(response) Args: - request (Union[google.cloud.datastore_admin_v1.types.ImportEntitiesRequest, dict]): + request (Optional[Union[google.cloud.datastore_admin_v1.types.ImportEntitiesRequest, dict]]): The request object. The request for [google.datastore.admin.v1.DatastoreAdmin.ImportEntities][google.datastore.admin.v1.DatastoreAdmin.ImportEntities]. project_id (:class:`str`): @@ -505,7 +515,7 @@ async def sample_import_entities(): This corresponds to the ``project_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - labels (:class:`Mapping[str, str]`): + labels (:class:`MutableMapping[str, str]`): Client-assigned labels. This corresponds to the ``labels`` field on the ``request`` instance; if ``request`` is provided, this @@ -624,10 +634,10 @@ async def sample_import_entities(): async def create_index( self, - request: Union[datastore_admin.CreateIndexRequest, dict] = None, + request: Optional[Union[datastore_admin.CreateIndexRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Creates the specified index. A newly created index's initial @@ -676,7 +686,7 @@ async def sample_create_index(): print(response) Args: - request (Union[google.cloud.datastore_admin_v1.types.CreateIndexRequest, dict]): + request (Optional[Union[google.cloud.datastore_admin_v1.types.CreateIndexRequest, dict]]): The request object. The request for [google.datastore.admin.v1.DatastoreAdmin.CreateIndex][google.datastore.admin.v1.DatastoreAdmin.CreateIndex]. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -734,10 +744,10 @@ async def sample_create_index(): async def delete_index( self, - request: Union[datastore_admin.DeleteIndexRequest, dict] = None, + request: Optional[Union[datastore_admin.DeleteIndexRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deletes an existing index. An index can only be deleted if it is @@ -785,7 +795,7 @@ async def sample_delete_index(): print(response) Args: - request (Union[google.cloud.datastore_admin_v1.types.DeleteIndexRequest, dict]): + request (Optional[Union[google.cloud.datastore_admin_v1.types.DeleteIndexRequest, dict]]): The request object. The request for [google.datastore.admin.v1.DatastoreAdmin.DeleteIndex][google.datastore.admin.v1.DatastoreAdmin.DeleteIndex]. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -846,10 +856,10 @@ async def sample_delete_index(): async def get_index( self, - request: Union[datastore_admin.GetIndexRequest, dict] = None, + request: Optional[Union[datastore_admin.GetIndexRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> index.Index: r"""Gets an index. @@ -880,7 +890,7 @@ async def sample_get_index(): print(response) Args: - request (Union[google.cloud.datastore_admin_v1.types.GetIndexRequest, dict]): + request (Optional[Union[google.cloud.datastore_admin_v1.types.GetIndexRequest, dict]]): The request object. The request for [google.datastore.admin.v1.DatastoreAdmin.GetIndex][google.datastore.admin.v1.DatastoreAdmin.GetIndex]. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -938,10 +948,10 @@ async def sample_get_index(): async def list_indexes( self, - request: Union[datastore_admin.ListIndexesRequest, dict] = None, + request: Optional[Union[datastore_admin.ListIndexesRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListIndexesAsyncPager: r"""Lists the indexes that match the specified filters. @@ -976,7 +986,7 @@ async def sample_list_indexes(): print(response) Args: - request (Union[google.cloud.datastore_admin_v1.types.ListIndexesRequest, dict]): + request (Optional[Union[google.cloud.datastore_admin_v1.types.ListIndexesRequest, dict]]): The request object. The request for [google.datastore.admin.v1.DatastoreAdmin.ListIndexes][google.datastore.admin.v1.DatastoreAdmin.ListIndexes]. retry (google.api_core.retry.Retry): Designation of what errors, if any, diff --git a/google/cloud/datastore_admin_v1/services/datastore_admin/client.py b/google/cloud/datastore_admin_v1/services/datastore_admin/client.py index 201a69e8..4c00fb94 100644 --- a/google/cloud/datastore_admin_v1/services/datastore_admin/client.py +++ b/google/cloud/datastore_admin_v1/services/datastore_admin/client.py @@ -16,7 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) import pkg_resources from google.api_core import client_options as client_options_lib @@ -61,7 +72,7 @@ class DatastoreAdminClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[DatastoreAdminTransport]: """Returns an appropriate transport class. @@ -369,8 +380,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, DatastoreAdminTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, DatastoreAdminTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the datastore admin client. @@ -384,7 +395,7 @@ def __init__( transport (Union[str, DatastoreAdminTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -414,6 +425,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -466,14 +478,14 @@ def __init__( def export_entities( self, - request: Union[datastore_admin.ExportEntitiesRequest, dict] = None, + request: Optional[Union[datastore_admin.ExportEntitiesRequest, dict]] = None, *, - project_id: str = None, - labels: Mapping[str, str] = None, - entity_filter: datastore_admin.EntityFilter = None, - output_url_prefix: str = None, + project_id: Optional[str] = None, + labels: Optional[MutableMapping[str, str]] = None, + entity_filter: Optional[datastore_admin.EntityFilter] = None, + output_url_prefix: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Exports a copy of all or a subset of entities from @@ -529,7 +541,7 @@ def sample_export_entities(): This corresponds to the ``project_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - labels (Mapping[str, str]): + labels (MutableMapping[str, str]): Client-assigned labels. This corresponds to the ``labels`` field on the ``request`` instance; if ``request`` is provided, this @@ -646,14 +658,14 @@ def sample_export_entities(): def import_entities( self, - request: Union[datastore_admin.ImportEntitiesRequest, dict] = None, + request: Optional[Union[datastore_admin.ImportEntitiesRequest, dict]] = None, *, - project_id: str = None, - labels: Mapping[str, str] = None, - input_url: str = None, - entity_filter: datastore_admin.EntityFilter = None, + project_id: Optional[str] = None, + labels: Optional[MutableMapping[str, str]] = None, + input_url: Optional[str] = None, + entity_filter: Optional[datastore_admin.EntityFilter] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Imports entities into Google Cloud Datastore. @@ -706,7 +718,7 @@ def sample_import_entities(): This corresponds to the ``project_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - labels (Mapping[str, str]): + labels (MutableMapping[str, str]): Client-assigned labels. This corresponds to the ``labels`` field on the ``request`` instance; if ``request`` is provided, this @@ -824,10 +836,10 @@ def sample_import_entities(): def create_index( self, - request: Union[datastore_admin.CreateIndexRequest, dict] = None, + request: Optional[Union[datastore_admin.CreateIndexRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Creates the specified index. A newly created index's initial @@ -935,10 +947,10 @@ def sample_create_index(): def delete_index( self, - request: Union[datastore_admin.DeleteIndexRequest, dict] = None, + request: Optional[Union[datastore_admin.DeleteIndexRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Deletes an existing index. An index can only be deleted if it is @@ -1048,10 +1060,10 @@ def sample_delete_index(): def get_index( self, - request: Union[datastore_admin.GetIndexRequest, dict] = None, + request: Optional[Union[datastore_admin.GetIndexRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> index.Index: r"""Gets an index. @@ -1131,10 +1143,10 @@ def sample_get_index(): def list_indexes( self, - request: Union[datastore_admin.ListIndexesRequest, dict] = None, + request: Optional[Union[datastore_admin.ListIndexesRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListIndexesPager: r"""Lists the indexes that match the specified filters. diff --git a/google/cloud/datastore_admin_v1/services/datastore_admin/transports/base.py b/google/cloud/datastore_admin_v1/services/datastore_admin/transports/base.py index cf9fd950..23175bd2 100644 --- a/google/cloud/datastore_admin_v1/services/datastore_admin/transports/base.py +++ b/google/cloud/datastore_admin_v1/services/datastore_admin/transports/base.py @@ -54,7 +54,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/datastore_admin_v1/services/datastore_admin/transports/grpc.py b/google/cloud/datastore_admin_v1/services/datastore_admin/transports/grpc.py index f15228fa..2eac944f 100644 --- a/google/cloud/datastore_admin_v1/services/datastore_admin/transports/grpc.py +++ b/google/cloud/datastore_admin_v1/services/datastore_admin/transports/grpc.py @@ -107,14 +107,14 @@ def __init__( self, *, host: str = "datastore.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -242,8 +242,8 @@ def __init__( def create_channel( cls, host: str = "datastore.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/datastore_admin_v1/services/datastore_admin/transports/grpc_asyncio.py b/google/cloud/datastore_admin_v1/services/datastore_admin/transports/grpc_asyncio.py index b5ec2814..d0fc1d60 100644 --- a/google/cloud/datastore_admin_v1/services/datastore_admin/transports/grpc_asyncio.py +++ b/google/cloud/datastore_admin_v1/services/datastore_admin/transports/grpc_asyncio.py @@ -109,7 +109,7 @@ class DatastoreAdminGrpcAsyncIOTransport(DatastoreAdminTransport): def create_channel( cls, host: str = "datastore.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -152,15 +152,15 @@ def __init__( self, *, host: str = "datastore.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/datastore_admin_v1/types/datastore_admin.py b/google/cloud/datastore_admin_v1/types/datastore_admin.py index 1bffdf3d..f7e3adcf 100644 --- a/google/cloud/datastore_admin_v1/types/datastore_admin.py +++ b/google/cloud/datastore_admin_v1/types/datastore_admin.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.cloud.datastore_admin_v1.types import index as gda_index @@ -64,7 +66,7 @@ class CommonMetadata(proto.Message): operation_type (google.cloud.datastore_admin_v1.types.OperationType): The type of the operation. Can be used as a filter in ListOperationsRequest. - labels (Mapping[str, str]): + labels (MutableMapping[str, str]): The client-assigned labels which were provided when the operation was created. May also include additional labels. @@ -83,27 +85,27 @@ class State(proto.Enum): FAILED = 6 CANCELLED = 7 - start_time = proto.Field( + start_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp, ) - end_time = proto.Field( + end_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp, ) - operation_type = proto.Field( + operation_type: "OperationType" = proto.Field( proto.ENUM, number=3, enum="OperationType", ) - labels = proto.MapField( + labels: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, number=4, ) - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=5, enum=State, @@ -123,11 +125,11 @@ class Progress(proto.Message): unavailable. """ - work_completed = proto.Field( + work_completed: int = proto.Field( proto.INT64, number=1, ) - work_estimated = proto.Field( + work_estimated: int = proto.Field( proto.INT64, number=2, ) @@ -141,7 +143,7 @@ class ExportEntitiesRequest(proto.Message): project_id (str): Required. Project ID against which to make the request. - labels (Mapping[str, str]): + labels (MutableMapping[str, str]): Client-assigned labels. entity_filter (google.cloud.datastore_admin_v1.types.EntityFilter): Description of what data from the project is @@ -171,21 +173,21 @@ class ExportEntitiesRequest(proto.Message): without conflict. """ - project_id = proto.Field( + project_id: str = proto.Field( proto.STRING, number=1, ) - labels = proto.MapField( + labels: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, number=2, ) - entity_filter = proto.Field( + entity_filter: "EntityFilter" = proto.Field( proto.MESSAGE, number=3, message="EntityFilter", ) - output_url_prefix = proto.Field( + output_url_prefix: str = proto.Field( proto.STRING, number=4, ) @@ -199,7 +201,7 @@ class ImportEntitiesRequest(proto.Message): project_id (str): Required. Project ID against which to make the request. - labels (Mapping[str, str]): + labels (MutableMapping[str, str]): Client-assigned labels. input_url (str): Required. The full resource URL of the external storage @@ -225,20 +227,20 @@ class ImportEntitiesRequest(proto.Message): specified then all entities from the export are imported. """ - project_id = proto.Field( + project_id: str = proto.Field( proto.STRING, number=1, ) - labels = proto.MapField( + labels: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, number=2, ) - input_url = proto.Field( + input_url: str = proto.Field( proto.STRING, number=3, ) - entity_filter = proto.Field( + entity_filter: "EntityFilter" = proto.Field( proto.MESSAGE, number=4, message="EntityFilter", @@ -258,7 +260,7 @@ class ExportEntitiesResponse(proto.Message): Only present if the operation completed successfully. """ - output_url = proto.Field( + output_url: str = proto.Field( proto.STRING, number=1, ) @@ -287,27 +289,27 @@ class ExportEntitiesMetadata(proto.Message): [google.datastore.admin.v1.ExportEntitiesResponse.output_url][google.datastore.admin.v1.ExportEntitiesResponse.output_url]. """ - common = proto.Field( + common: "CommonMetadata" = proto.Field( proto.MESSAGE, number=1, message="CommonMetadata", ) - progress_entities = proto.Field( + progress_entities: "Progress" = proto.Field( proto.MESSAGE, number=2, message="Progress", ) - progress_bytes = proto.Field( + progress_bytes: "Progress" = proto.Field( proto.MESSAGE, number=3, message="Progress", ) - entity_filter = proto.Field( + entity_filter: "EntityFilter" = proto.Field( proto.MESSAGE, number=4, message="EntityFilter", ) - output_url_prefix = proto.Field( + output_url_prefix: str = proto.Field( proto.STRING, number=5, ) @@ -335,27 +337,27 @@ class ImportEntitiesMetadata(proto.Message): field. """ - common = proto.Field( + common: "CommonMetadata" = proto.Field( proto.MESSAGE, number=1, message="CommonMetadata", ) - progress_entities = proto.Field( + progress_entities: "Progress" = proto.Field( proto.MESSAGE, number=2, message="Progress", ) - progress_bytes = proto.Field( + progress_bytes: "Progress" = proto.Field( proto.MESSAGE, number=3, message="Progress", ) - entity_filter = proto.Field( + entity_filter: "EntityFilter" = proto.Field( proto.MESSAGE, number=4, message="EntityFilter", ) - input_url = proto.Field( + input_url: str = proto.Field( proto.STRING, number=5, ) @@ -380,9 +382,9 @@ class EntityFilter(proto.Message): The entire Baz namespace: kinds=[], namespace_ids=['Baz'] Attributes: - kinds (Sequence[str]): + kinds (MutableSequence[str]): If empty, then this represents all kinds. - namespace_ids (Sequence[str]): + namespace_ids (MutableSequence[str]): An empty list represents all namespaces. This is the preferred usage for projects that don't use namespaces. @@ -393,11 +395,11 @@ class EntityFilter(proto.Message): Each namespace in this list must be unique. """ - kinds = proto.RepeatedField( + kinds: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) - namespace_ids = proto.RepeatedField( + namespace_ids: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=2, ) @@ -417,11 +419,11 @@ class CreateIndexRequest(proto.Message): deleted. """ - project_id = proto.Field( + project_id: str = proto.Field( proto.STRING, number=1, ) - index = proto.Field( + index: gda_index.Index = proto.Field( proto.MESSAGE, number=3, message=gda_index.Index, @@ -439,11 +441,11 @@ class DeleteIndexRequest(proto.Message): The resource ID of the index to delete. """ - project_id = proto.Field( + project_id: str = proto.Field( proto.STRING, number=1, ) - index_id = proto.Field( + index_id: str = proto.Field( proto.STRING, number=3, ) @@ -460,11 +462,11 @@ class GetIndexRequest(proto.Message): The resource ID of the index to get. """ - project_id = proto.Field( + project_id: str = proto.Field( proto.STRING, number=1, ) - index_id = proto.Field( + index_id: str = proto.Field( proto.STRING, number=3, ) @@ -487,19 +489,19 @@ class ListIndexesRequest(proto.Message): request, if any. """ - project_id = proto.Field( + project_id: str = proto.Field( proto.STRING, number=1, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=3, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=4, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=5, ) @@ -510,7 +512,7 @@ class ListIndexesResponse(proto.Message): [google.datastore.admin.v1.DatastoreAdmin.ListIndexes][google.datastore.admin.v1.DatastoreAdmin.ListIndexes]. Attributes: - indexes (Sequence[google.cloud.datastore_admin_v1.types.Index]): + indexes (MutableSequence[google.cloud.datastore_admin_v1.types.Index]): The indexes. next_page_token (str): The standard List next-page token. @@ -520,12 +522,12 @@ class ListIndexesResponse(proto.Message): def raw_page(self): return self - indexes = proto.RepeatedField( + indexes: MutableSequence[gda_index.Index] = proto.RepeatedField( proto.MESSAGE, number=1, message=gda_index.Index, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -546,17 +548,17 @@ class IndexOperationMetadata(proto.Message): acting on. """ - common = proto.Field( + common: "CommonMetadata" = proto.Field( proto.MESSAGE, number=1, message="CommonMetadata", ) - progress_entities = proto.Field( + progress_entities: "Progress" = proto.Field( proto.MESSAGE, number=2, message="Progress", ) - index_id = proto.Field( + index_id: str = proto.Field( proto.STRING, number=3, ) @@ -581,12 +583,12 @@ class DatastoreFirestoreMigrationMetadata(proto.Message): Datastore to Cloud Firestore in Datastore mode. """ - migration_state = proto.Field( + migration_state: migration.MigrationState = proto.Field( proto.ENUM, number=1, enum=migration.MigrationState, ) - migration_step = proto.Field( + migration_step: migration.MigrationStep = proto.Field( proto.ENUM, number=2, enum=migration.MigrationStep, diff --git a/google/cloud/datastore_admin_v1/types/index.py b/google/cloud/datastore_admin_v1/types/index.py index e00c3bb7..8192d81c 100644 --- a/google/cloud/datastore_admin_v1/types/index.py +++ b/google/cloud/datastore_admin_v1/types/index.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore @@ -38,7 +40,7 @@ class Index(proto.Message): ancestor (google.cloud.datastore_admin_v1.types.Index.AncestorMode): Required. The index's ancestor mode. Must not be ANCESTOR_MODE_UNSPECIFIED. - properties (Sequence[google.cloud.datastore_admin_v1.types.Index.IndexedProperty]): + properties (MutableSequence[google.cloud.datastore_admin_v1.types.Index.IndexedProperty]): Required. An ordered sequence of property names and their index attributes. state (google.cloud.datastore_admin_v1.types.Index.State): @@ -78,39 +80,39 @@ class IndexedProperty(proto.Message): DIRECTION_UNSPECIFIED. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - direction = proto.Field( + direction: "Index.Direction" = proto.Field( proto.ENUM, number=2, enum="Index.Direction", ) - project_id = proto.Field( + project_id: str = proto.Field( proto.STRING, number=1, ) - index_id = proto.Field( + index_id: str = proto.Field( proto.STRING, number=3, ) - kind = proto.Field( + kind: str = proto.Field( proto.STRING, number=4, ) - ancestor = proto.Field( + ancestor: AncestorMode = proto.Field( proto.ENUM, number=5, enum=AncestorMode, ) - properties = proto.RepeatedField( + properties: MutableSequence[IndexedProperty] = proto.RepeatedField( proto.MESSAGE, number=6, message=IndexedProperty, ) - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=7, enum=State, diff --git a/google/cloud/datastore_admin_v1/types/migration.py b/google/cloud/datastore_admin_v1/types/migration.py index cbd4f4f7..95f25f42 100644 --- a/google/cloud/datastore_admin_v1/types/migration.py +++ b/google/cloud/datastore_admin_v1/types/migration.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore @@ -57,7 +59,7 @@ class MigrationStateEvent(proto.Message): The new state of the migration. """ - state = proto.Field( + state: "MigrationState" = proto.Field( proto.ENUM, number=1, enum="MigrationState", @@ -109,7 +111,7 @@ class PrepareStepDetails(proto.Message): the ``REDIRECT_WRITES`` step. """ - concurrency_mode = proto.Field( + concurrency_mode: "MigrationProgressEvent.ConcurrencyMode" = proto.Field( proto.ENUM, number=1, enum="MigrationProgressEvent.ConcurrencyMode", @@ -123,24 +125,24 @@ class RedirectWritesStepDetails(proto.Message): Ths concurrency mode for this database. """ - concurrency_mode = proto.Field( + concurrency_mode: "MigrationProgressEvent.ConcurrencyMode" = proto.Field( proto.ENUM, number=1, enum="MigrationProgressEvent.ConcurrencyMode", ) - step = proto.Field( + step: "MigrationStep" = proto.Field( proto.ENUM, number=1, enum="MigrationStep", ) - prepare_step_details = proto.Field( + prepare_step_details: PrepareStepDetails = proto.Field( proto.MESSAGE, number=2, oneof="step_details", message=PrepareStepDetails, ) - redirect_writes_step_details = proto.Field( + redirect_writes_step_details: RedirectWritesStepDetails = proto.Field( proto.MESSAGE, number=3, oneof="step_details", diff --git a/google/cloud/datastore_v1/__init__.py b/google/cloud/datastore_v1/__init__.py index 83e7464d..b868c406 100644 --- a/google/cloud/datastore_v1/__init__.py +++ b/google/cloud/datastore_v1/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.datastore import gapic_version as package_version + +__version__ = package_version.__version__ + from .services.datastore import DatastoreClient from .services.datastore import DatastoreAsyncClient diff --git a/google/cloud/datastore_v1/services/datastore/async_client.py b/google/cloud/datastore_v1/services/datastore/async_client.py index c6e6f2df..1986c2b5 100644 --- a/google/cloud/datastore_v1/services/datastore/async_client.py +++ b/google/cloud/datastore_v1/services/datastore/async_client.py @@ -16,7 +16,17 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) import pkg_resources from google.api_core.client_options import ClientOptions @@ -161,9 +171,9 @@ def transport(self) -> DatastoreTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, DatastoreTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the datastore client. @@ -207,13 +217,13 @@ def __init__( async def lookup( self, - request: Union[datastore.LookupRequest, dict] = None, + request: Optional[Union[datastore.LookupRequest, dict]] = None, *, - project_id: str = None, - read_options: datastore.ReadOptions = None, - keys: Sequence[entity.Key] = None, + project_id: Optional[str] = None, + read_options: Optional[datastore.ReadOptions] = None, + keys: Optional[MutableSequence[entity.Key]] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> datastore.LookupResponse: r"""Looks up entities by key. @@ -245,7 +255,7 @@ async def sample_lookup(): print(response) Args: - request (Union[google.cloud.datastore_v1.types.LookupRequest, dict]): + request (Optional[Union[google.cloud.datastore_v1.types.LookupRequest, dict]]): The request object. The request for [Datastore.Lookup][google.datastore.v1.Datastore.Lookup]. project_id (:class:`str`): @@ -260,7 +270,7 @@ async def sample_lookup(): This corresponds to the ``read_options`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - keys (:class:`Sequence[google.cloud.datastore_v1.types.Key]`): + keys (:class:`MutableSequence[google.cloud.datastore_v1.types.Key]`): Required. Keys of entities to look up. @@ -339,10 +349,10 @@ async def sample_lookup(): async def run_query( self, - request: Union[datastore.RunQueryRequest, dict] = None, + request: Optional[Union[datastore.RunQueryRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> datastore.RunQueryResponse: r"""Queries for entities. @@ -374,7 +384,7 @@ async def sample_run_query(): print(response) Args: - request (Union[google.cloud.datastore_v1.types.RunQueryRequest, dict]): + request (Optional[Union[google.cloud.datastore_v1.types.RunQueryRequest, dict]]): The request object. The request for [Datastore.RunQuery][google.datastore.v1.Datastore.RunQuery]. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -431,10 +441,10 @@ async def sample_run_query(): async def run_aggregation_query( self, - request: Union[datastore.RunAggregationQueryRequest, dict] = None, + request: Optional[Union[datastore.RunAggregationQueryRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> datastore.RunAggregationQueryResponse: r"""Runs an aggregation query. @@ -466,7 +476,7 @@ async def sample_run_aggregation_query(): print(response) Args: - request (Union[google.cloud.datastore_v1.types.RunAggregationQueryRequest, dict]): + request (Optional[Union[google.cloud.datastore_v1.types.RunAggregationQueryRequest, dict]]): The request object. The request for [Datastore.RunAggregationQuery][google.datastore.v1.Datastore.RunAggregationQuery]. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -523,11 +533,11 @@ async def sample_run_aggregation_query(): async def begin_transaction( self, - request: Union[datastore.BeginTransactionRequest, dict] = None, + request: Optional[Union[datastore.BeginTransactionRequest, dict]] = None, *, - project_id: str = None, + project_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> datastore.BeginTransactionResponse: r"""Begins a new transaction. @@ -559,7 +569,7 @@ async def sample_begin_transaction(): print(response) Args: - request (Union[google.cloud.datastore_v1.types.BeginTransactionRequest, dict]): + request (Optional[Union[google.cloud.datastore_v1.types.BeginTransactionRequest, dict]]): The request object. The request for [Datastore.BeginTransaction][google.datastore.v1.Datastore.BeginTransaction]. project_id (:class:`str`): @@ -627,14 +637,14 @@ async def sample_begin_transaction(): async def commit( self, - request: Union[datastore.CommitRequest, dict] = None, + request: Optional[Union[datastore.CommitRequest, dict]] = None, *, - project_id: str = None, - mode: datastore.CommitRequest.Mode = None, - transaction: bytes = None, - mutations: Sequence[datastore.Mutation] = None, + project_id: Optional[str] = None, + mode: Optional[datastore.CommitRequest.Mode] = None, + transaction: Optional[bytes] = None, + mutations: Optional[MutableSequence[datastore.Mutation]] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> datastore.CommitResponse: r"""Commits a transaction, optionally creating, deleting @@ -668,7 +678,7 @@ async def sample_commit(): print(response) Args: - request (Union[google.cloud.datastore_v1.types.CommitRequest, dict]): + request (Optional[Union[google.cloud.datastore_v1.types.CommitRequest, dict]]): The request object. The request for [Datastore.Commit][google.datastore.v1.Datastore.Commit]. project_id (:class:`str`): @@ -694,7 +704,7 @@ async def sample_commit(): This corresponds to the ``transaction`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - mutations (:class:`Sequence[google.cloud.datastore_v1.types.Mutation]`): + mutations (:class:`MutableSequence[google.cloud.datastore_v1.types.Mutation]`): The mutations to perform. When mode is ``TRANSACTIONAL``, mutations affecting a @@ -777,12 +787,12 @@ async def sample_commit(): async def rollback( self, - request: Union[datastore.RollbackRequest, dict] = None, + request: Optional[Union[datastore.RollbackRequest, dict]] = None, *, - project_id: str = None, - transaction: bytes = None, + project_id: Optional[str] = None, + transaction: Optional[bytes] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> datastore.RollbackResponse: r"""Rolls back a transaction. @@ -815,7 +825,7 @@ async def sample_rollback(): print(response) Args: - request (Union[google.cloud.datastore_v1.types.RollbackRequest, dict]): + request (Optional[Union[google.cloud.datastore_v1.types.RollbackRequest, dict]]): The request object. The request for [Datastore.Rollback][google.datastore.v1.Datastore.Rollback]. project_id (:class:`str`): @@ -893,12 +903,12 @@ async def sample_rollback(): async def allocate_ids( self, - request: Union[datastore.AllocateIdsRequest, dict] = None, + request: Optional[Union[datastore.AllocateIdsRequest, dict]] = None, *, - project_id: str = None, - keys: Sequence[entity.Key] = None, + project_id: Optional[str] = None, + keys: Optional[MutableSequence[entity.Key]] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> datastore.AllocateIdsResponse: r"""Allocates IDs for the given keys, which is useful for @@ -931,7 +941,7 @@ async def sample_allocate_ids(): print(response) Args: - request (Union[google.cloud.datastore_v1.types.AllocateIdsRequest, dict]): + request (Optional[Union[google.cloud.datastore_v1.types.AllocateIdsRequest, dict]]): The request object. The request for [Datastore.AllocateIds][google.datastore.v1.Datastore.AllocateIds]. project_id (:class:`str`): @@ -941,7 +951,7 @@ async def sample_allocate_ids(): This corresponds to the ``project_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - keys (:class:`Sequence[google.cloud.datastore_v1.types.Key]`): + keys (:class:`MutableSequence[google.cloud.datastore_v1.types.Key]`): Required. A list of keys with incomplete key paths for which to allocate IDs. No key may be @@ -1010,12 +1020,12 @@ async def sample_allocate_ids(): async def reserve_ids( self, - request: Union[datastore.ReserveIdsRequest, dict] = None, + request: Optional[Union[datastore.ReserveIdsRequest, dict]] = None, *, - project_id: str = None, - keys: Sequence[entity.Key] = None, + project_id: Optional[str] = None, + keys: Optional[MutableSequence[entity.Key]] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> datastore.ReserveIdsResponse: r"""Prevents the supplied keys' IDs from being @@ -1048,7 +1058,7 @@ async def sample_reserve_ids(): print(response) Args: - request (Union[google.cloud.datastore_v1.types.ReserveIdsRequest, dict]): + request (Optional[Union[google.cloud.datastore_v1.types.ReserveIdsRequest, dict]]): The request object. The request for [Datastore.ReserveIds][google.datastore.v1.Datastore.ReserveIds]. project_id (:class:`str`): @@ -1058,7 +1068,7 @@ async def sample_reserve_ids(): This corresponds to the ``project_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - keys (:class:`Sequence[google.cloud.datastore_v1.types.Key]`): + keys (:class:`MutableSequence[google.cloud.datastore_v1.types.Key]`): Required. A list of keys with complete key paths whose numeric IDs should not be auto-allocated. @@ -1136,10 +1146,10 @@ async def sample_reserve_ids(): async def list_operations( self, - request: operations_pb2.ListOperationsRequest = None, + request: Optional[operations_pb2.ListOperationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Lists operations that match the specified filter in the request. @@ -1190,10 +1200,10 @@ async def list_operations( async def get_operation( self, - request: operations_pb2.GetOperationRequest = None, + request: Optional[operations_pb2.GetOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Gets the latest state of a long-running operation. @@ -1244,10 +1254,10 @@ async def get_operation( async def delete_operation( self, - request: operations_pb2.DeleteOperationRequest = None, + request: Optional[operations_pb2.DeleteOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a long-running operation. @@ -1299,10 +1309,10 @@ async def delete_operation( async def cancel_operation( self, - request: operations_pb2.CancelOperationRequest = None, + request: Optional[operations_pb2.CancelOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Starts asynchronous cancellation on a long-running operation. diff --git a/google/cloud/datastore_v1/services/datastore/client.py b/google/cloud/datastore_v1/services/datastore/client.py index 4d0b8f34..5d744620 100644 --- a/google/cloud/datastore_v1/services/datastore/client.py +++ b/google/cloud/datastore_v1/services/datastore/client.py @@ -16,7 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) import pkg_resources from google.api_core import client_options as client_options_lib @@ -59,7 +70,7 @@ class DatastoreClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[DatastoreTransport]: """Returns an appropriate transport class. @@ -319,8 +330,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, DatastoreTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, DatastoreTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the datastore client. @@ -334,7 +345,7 @@ def __init__( transport (Union[str, DatastoreTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (google.api_core.client_options.ClientOptions): Custom options for the + client_options (Optional[Union[google.api_core.client_options.ClientOptions, dict]]): Custom options for the client. It won't take effect if a ``transport`` instance is provided. (1) The ``api_endpoint`` property can be used to override the default endpoint provided by the client. GOOGLE_API_USE_MTLS_ENDPOINT @@ -364,6 +375,7 @@ def __init__( client_options = client_options_lib.from_dict(client_options) if client_options is None: client_options = client_options_lib.ClientOptions() + client_options = cast(client_options_lib.ClientOptions, client_options) api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( client_options @@ -416,13 +428,13 @@ def __init__( def lookup( self, - request: Union[datastore.LookupRequest, dict] = None, + request: Optional[Union[datastore.LookupRequest, dict]] = None, *, - project_id: str = None, - read_options: datastore.ReadOptions = None, - keys: Sequence[entity.Key] = None, + project_id: Optional[str] = None, + read_options: Optional[datastore.ReadOptions] = None, + keys: Optional[MutableSequence[entity.Key]] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> datastore.LookupResponse: r"""Looks up entities by key. @@ -469,7 +481,7 @@ def sample_lookup(): This corresponds to the ``read_options`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - keys (Sequence[google.cloud.datastore_v1.types.Key]): + keys (MutableSequence[google.cloud.datastore_v1.types.Key]): Required. Keys of entities to look up. @@ -538,10 +550,10 @@ def sample_lookup(): def run_query( self, - request: Union[datastore.RunQueryRequest, dict] = None, + request: Optional[Union[datastore.RunQueryRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> datastore.RunQueryResponse: r"""Queries for entities. @@ -621,10 +633,10 @@ def sample_run_query(): def run_aggregation_query( self, - request: Union[datastore.RunAggregationQueryRequest, dict] = None, + request: Optional[Union[datastore.RunAggregationQueryRequest, dict]] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> datastore.RunAggregationQueryResponse: r"""Runs an aggregation query. @@ -704,11 +716,11 @@ def sample_run_aggregation_query(): def begin_transaction( self, - request: Union[datastore.BeginTransactionRequest, dict] = None, + request: Optional[Union[datastore.BeginTransactionRequest, dict]] = None, *, - project_id: str = None, + project_id: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> datastore.BeginTransactionResponse: r"""Begins a new transaction. @@ -808,14 +820,14 @@ def sample_begin_transaction(): def commit( self, - request: Union[datastore.CommitRequest, dict] = None, + request: Optional[Union[datastore.CommitRequest, dict]] = None, *, - project_id: str = None, - mode: datastore.CommitRequest.Mode = None, - transaction: bytes = None, - mutations: Sequence[datastore.Mutation] = None, + project_id: Optional[str] = None, + mode: Optional[datastore.CommitRequest.Mode] = None, + transaction: Optional[bytes] = None, + mutations: Optional[MutableSequence[datastore.Mutation]] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> datastore.CommitResponse: r"""Commits a transaction, optionally creating, deleting @@ -875,7 +887,7 @@ def sample_commit(): This corresponds to the ``transaction`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - mutations (Sequence[google.cloud.datastore_v1.types.Mutation]): + mutations (MutableSequence[google.cloud.datastore_v1.types.Mutation]): The mutations to perform. When mode is ``TRANSACTIONAL``, mutations affecting a @@ -958,12 +970,12 @@ def sample_commit(): def rollback( self, - request: Union[datastore.RollbackRequest, dict] = None, + request: Optional[Union[datastore.RollbackRequest, dict]] = None, *, - project_id: str = None, - transaction: bytes = None, + project_id: Optional[str] = None, + transaction: Optional[bytes] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> datastore.RollbackResponse: r"""Rolls back a transaction. @@ -1074,12 +1086,12 @@ def sample_rollback(): def allocate_ids( self, - request: Union[datastore.AllocateIdsRequest, dict] = None, + request: Optional[Union[datastore.AllocateIdsRequest, dict]] = None, *, - project_id: str = None, - keys: Sequence[entity.Key] = None, + project_id: Optional[str] = None, + keys: Optional[MutableSequence[entity.Key]] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> datastore.AllocateIdsResponse: r"""Allocates IDs for the given keys, which is useful for @@ -1122,7 +1134,7 @@ def sample_allocate_ids(): This corresponds to the ``project_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - keys (Sequence[google.cloud.datastore_v1.types.Key]): + keys (MutableSequence[google.cloud.datastore_v1.types.Key]): Required. A list of keys with incomplete key paths for which to allocate IDs. No key may be @@ -1191,12 +1203,12 @@ def sample_allocate_ids(): def reserve_ids( self, - request: Union[datastore.ReserveIdsRequest, dict] = None, + request: Optional[Union[datastore.ReserveIdsRequest, dict]] = None, *, - project_id: str = None, - keys: Sequence[entity.Key] = None, + project_id: Optional[str] = None, + keys: Optional[MutableSequence[entity.Key]] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> datastore.ReserveIdsResponse: r"""Prevents the supplied keys' IDs from being @@ -1239,7 +1251,7 @@ def sample_reserve_ids(): This corresponds to the ``project_id`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - keys (Sequence[google.cloud.datastore_v1.types.Key]): + keys (MutableSequence[google.cloud.datastore_v1.types.Key]): Required. A list of keys with complete key paths whose numeric IDs should not be auto-allocated. @@ -1320,10 +1332,10 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: operations_pb2.ListOperationsRequest = None, + request: Optional[operations_pb2.ListOperationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Lists operations that match the specified filter in the request. @@ -1374,10 +1386,10 @@ def list_operations( def get_operation( self, - request: operations_pb2.GetOperationRequest = None, + request: Optional[operations_pb2.GetOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Gets the latest state of a long-running operation. @@ -1428,10 +1440,10 @@ def get_operation( def delete_operation( self, - request: operations_pb2.DeleteOperationRequest = None, + request: Optional[operations_pb2.DeleteOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a long-running operation. @@ -1483,10 +1495,10 @@ def delete_operation( def cancel_operation( self, - request: operations_pb2.CancelOperationRequest = None, + request: Optional[operations_pb2.CancelOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Starts asynchronous cancellation on a long-running operation. diff --git a/google/cloud/datastore_v1/services/datastore/transports/base.py b/google/cloud/datastore_v1/services/datastore/transports/base.py index d628468b..c9b14ea8 100644 --- a/google/cloud/datastore_v1/services/datastore/transports/base.py +++ b/google/cloud/datastore_v1/services/datastore/transports/base.py @@ -52,7 +52,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/datastore_v1/services/datastore/transports/grpc.py b/google/cloud/datastore_v1/services/datastore/transports/grpc.py index 4f160c45..622f217c 100644 --- a/google/cloud/datastore_v1/services/datastore/transports/grpc.py +++ b/google/cloud/datastore_v1/services/datastore/transports/grpc.py @@ -54,14 +54,14 @@ def __init__( self, *, host: str = "datastore.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -188,8 +188,8 @@ def __init__( def create_channel( cls, host: str = "datastore.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/datastore_v1/services/datastore/transports/grpc_asyncio.py b/google/cloud/datastore_v1/services/datastore/transports/grpc_asyncio.py index 529c2206..08b1e5f2 100644 --- a/google/cloud/datastore_v1/services/datastore/transports/grpc_asyncio.py +++ b/google/cloud/datastore_v1/services/datastore/transports/grpc_asyncio.py @@ -56,7 +56,7 @@ class DatastoreGrpcAsyncIOTransport(DatastoreTransport): def create_channel( cls, host: str = "datastore.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -99,15 +99,15 @@ def __init__( self, *, host: str = "datastore.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/datastore_v1/types/aggregation_result.py b/google/cloud/datastore_v1/types/aggregation_result.py index 17020a63..c2d1d859 100644 --- a/google/cloud/datastore_v1/types/aggregation_result.py +++ b/google/cloud/datastore_v1/types/aggregation_result.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.cloud.datastore_v1.types import entity @@ -37,7 +39,7 @@ class AggregationResult(proto.Message): fields present for each result. Attributes: - aggregate_properties (Mapping[str, google.cloud.datastore_v1.types.Value]): + aggregate_properties (MutableMapping[str, google.cloud.datastore_v1.types.Value]): The result of the aggregation functions, ex: ``COUNT(*) AS total_entities``. @@ -48,7 +50,7 @@ class AggregationResult(proto.Message): the query. """ - aggregate_properties = proto.MapField( + aggregate_properties: MutableMapping[str, entity.Value] = proto.MapField( proto.STRING, proto.MESSAGE, number=2, @@ -61,7 +63,7 @@ class AggregationResultBatch(proto.Message): query. Attributes: - aggregation_results (Sequence[google.cloud.datastore_v1.types.AggregationResult]): + aggregation_results (MutableSequence[google.cloud.datastore_v1.types.AggregationResult]): The aggregation results for this batch. more_results (google.cloud.datastore_v1.types.QueryResultBatch.MoreResultsType): The state of the query after the current batch. Only @@ -76,17 +78,17 @@ class AggregationResultBatch(proto.Message): for all preceding batches. """ - aggregation_results = proto.RepeatedField( + aggregation_results: MutableSequence["AggregationResult"] = proto.RepeatedField( proto.MESSAGE, number=1, message="AggregationResult", ) - more_results = proto.Field( + more_results: query.QueryResultBatch.MoreResultsType = proto.Field( proto.ENUM, number=2, enum=query.QueryResultBatch.MoreResultsType, ) - read_time = proto.Field( + read_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, diff --git a/google/cloud/datastore_v1/types/datastore.py b/google/cloud/datastore_v1/types/datastore.py index 42c87f72..a2d7c2a2 100644 --- a/google/cloud/datastore_v1/types/datastore.py +++ b/google/cloud/datastore_v1/types/datastore.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.cloud.datastore_v1.types import aggregation_result @@ -63,24 +65,24 @@ class LookupRequest(proto.Message): string '' to refer the default database. read_options (google.cloud.datastore_v1.types.ReadOptions): The options for this lookup request. - keys (Sequence[google.cloud.datastore_v1.types.Key]): + keys (MutableSequence[google.cloud.datastore_v1.types.Key]): Required. Keys of entities to look up. """ - project_id = proto.Field( + project_id: str = proto.Field( proto.STRING, number=8, ) - database_id = proto.Field( + database_id: str = proto.Field( proto.STRING, number=9, ) - read_options = proto.Field( + read_options: "ReadOptions" = proto.Field( proto.MESSAGE, number=1, message="ReadOptions", ) - keys = proto.RepeatedField( + keys: MutableSequence[entity.Key] = proto.RepeatedField( proto.MESSAGE, number=3, message=entity.Key, @@ -92,15 +94,15 @@ class LookupResponse(proto.Message): [Datastore.Lookup][google.datastore.v1.Datastore.Lookup]. Attributes: - found (Sequence[google.cloud.datastore_v1.types.EntityResult]): + found (MutableSequence[google.cloud.datastore_v1.types.EntityResult]): Entities found as ``ResultType.FULL`` entities. The order of results in this field is undefined and has no relation to the order of the keys in the input. - missing (Sequence[google.cloud.datastore_v1.types.EntityResult]): + missing (MutableSequence[google.cloud.datastore_v1.types.EntityResult]): Entities not found as ``ResultType.KEY_ONLY`` entities. The order of results in this field is undefined and has no relation to the order of the keys in the input. - deferred (Sequence[google.cloud.datastore_v1.types.Key]): + deferred (MutableSequence[google.cloud.datastore_v1.types.Key]): A list of keys that were not looked up due to resource constraints. The order of results in this field is undefined and has no relation to @@ -110,22 +112,22 @@ class LookupResponse(proto.Message): found missing. """ - found = proto.RepeatedField( + found: MutableSequence[gd_query.EntityResult] = proto.RepeatedField( proto.MESSAGE, number=1, message=gd_query.EntityResult, ) - missing = proto.RepeatedField( + missing: MutableSequence[gd_query.EntityResult] = proto.RepeatedField( proto.MESSAGE, number=2, message=gd_query.EntityResult, ) - deferred = proto.RepeatedField( + deferred: MutableSequence[entity.Key] = proto.RepeatedField( proto.MESSAGE, number=3, message=entity.Key, ) - read_time = proto.Field( + read_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp, @@ -171,31 +173,31 @@ class RunQueryRequest(proto.Message): This field is a member of `oneof`_ ``query_type``. """ - project_id = proto.Field( + project_id: str = proto.Field( proto.STRING, number=8, ) - database_id = proto.Field( + database_id: str = proto.Field( proto.STRING, number=9, ) - partition_id = proto.Field( + partition_id: entity.PartitionId = proto.Field( proto.MESSAGE, number=2, message=entity.PartitionId, ) - read_options = proto.Field( + read_options: "ReadOptions" = proto.Field( proto.MESSAGE, number=1, message="ReadOptions", ) - query = proto.Field( + query: gd_query.Query = proto.Field( proto.MESSAGE, number=3, oneof="query_type", message=gd_query.Query, ) - gql_query = proto.Field( + gql_query: gd_query.GqlQuery = proto.Field( proto.MESSAGE, number=7, oneof="query_type", @@ -215,12 +217,12 @@ class RunQueryResponse(proto.Message): was set. """ - batch = proto.Field( + batch: gd_query.QueryResultBatch = proto.Field( proto.MESSAGE, number=1, message=gd_query.QueryResultBatch, ) - query = proto.Field( + query: gd_query.Query = proto.Field( proto.MESSAGE, number=2, message=gd_query.Query, @@ -266,31 +268,31 @@ class RunAggregationQueryRequest(proto.Message): This field is a member of `oneof`_ ``query_type``. """ - project_id = proto.Field( + project_id: str = proto.Field( proto.STRING, number=8, ) - database_id = proto.Field( + database_id: str = proto.Field( proto.STRING, number=9, ) - partition_id = proto.Field( + partition_id: entity.PartitionId = proto.Field( proto.MESSAGE, number=2, message=entity.PartitionId, ) - read_options = proto.Field( + read_options: "ReadOptions" = proto.Field( proto.MESSAGE, number=1, message="ReadOptions", ) - aggregation_query = proto.Field( + aggregation_query: gd_query.AggregationQuery = proto.Field( proto.MESSAGE, number=3, oneof="query_type", message=gd_query.AggregationQuery, ) - gql_query = proto.Field( + gql_query: gd_query.GqlQuery = proto.Field( proto.MESSAGE, number=7, oneof="query_type", @@ -311,12 +313,12 @@ class RunAggregationQueryResponse(proto.Message): was set. """ - batch = proto.Field( + batch: aggregation_result.AggregationResultBatch = proto.Field( proto.MESSAGE, number=1, message=aggregation_result.AggregationResultBatch, ) - query = proto.Field( + query: gd_query.AggregationQuery = proto.Field( proto.MESSAGE, number=2, message=gd_query.AggregationQuery, @@ -340,15 +342,15 @@ class BeginTransactionRequest(proto.Message): Options for a new transaction. """ - project_id = proto.Field( + project_id: str = proto.Field( proto.STRING, number=8, ) - database_id = proto.Field( + database_id: str = proto.Field( proto.STRING, number=9, ) - transaction_options = proto.Field( + transaction_options: "TransactionOptions" = proto.Field( proto.MESSAGE, number=10, message="TransactionOptions", @@ -364,7 +366,7 @@ class BeginTransactionResponse(proto.Message): The transaction identifier (always present). """ - transaction = proto.Field( + transaction: bytes = proto.Field( proto.BYTES, number=1, ) @@ -388,15 +390,15 @@ class RollbackRequest(proto.Message): [Datastore.BeginTransaction][google.datastore.v1.Datastore.BeginTransaction]. """ - project_id = proto.Field( + project_id: str = proto.Field( proto.STRING, number=8, ) - database_id = proto.Field( + database_id: str = proto.Field( proto.STRING, number=9, ) - transaction = proto.Field( + transaction: bytes = proto.Field( proto.BYTES, number=1, ) @@ -435,7 +437,7 @@ class CommitRequest(proto.Message): [Datastore.BeginTransaction][google.datastore.v1.Datastore.BeginTransaction]. This field is a member of `oneof`_ ``transaction_selector``. - mutations (Sequence[google.cloud.datastore_v1.types.Mutation]): + mutations (MutableSequence[google.cloud.datastore_v1.types.Mutation]): The mutations to perform. When mode is ``TRANSACTIONAL``, mutations affecting a single @@ -458,25 +460,25 @@ class Mode(proto.Enum): TRANSACTIONAL = 1 NON_TRANSACTIONAL = 2 - project_id = proto.Field( + project_id: str = proto.Field( proto.STRING, number=8, ) - database_id = proto.Field( + database_id: str = proto.Field( proto.STRING, number=9, ) - mode = proto.Field( + mode: Mode = proto.Field( proto.ENUM, number=5, enum=Mode, ) - transaction = proto.Field( + transaction: bytes = proto.Field( proto.BYTES, number=1, oneof="transaction_selector", ) - mutations = proto.RepeatedField( + mutations: MutableSequence["Mutation"] = proto.RepeatedField( proto.MESSAGE, number=6, message="Mutation", @@ -488,7 +490,7 @@ class CommitResponse(proto.Message): [Datastore.Commit][google.datastore.v1.Datastore.Commit]. Attributes: - mutation_results (Sequence[google.cloud.datastore_v1.types.MutationResult]): + mutation_results (MutableSequence[google.cloud.datastore_v1.types.MutationResult]): The result of performing the mutations. The i-th mutation result corresponds to the i-th mutation in the request. @@ -500,16 +502,16 @@ class CommitResponse(proto.Message): non-transactional commits. """ - mutation_results = proto.RepeatedField( + mutation_results: MutableSequence["MutationResult"] = proto.RepeatedField( proto.MESSAGE, number=3, message="MutationResult", ) - index_updates = proto.Field( + index_updates: int = proto.Field( proto.INT32, number=4, ) - commit_time = proto.Field( + commit_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=8, message=timestamp_pb2.Timestamp, @@ -529,21 +531,21 @@ class AllocateIdsRequest(proto.Message): the request. '(default)' is not allowed; please use empty string '' to refer the default database. - keys (Sequence[google.cloud.datastore_v1.types.Key]): + keys (MutableSequence[google.cloud.datastore_v1.types.Key]): Required. A list of keys with incomplete key paths for which to allocate IDs. No key may be reserved/read-only. """ - project_id = proto.Field( + project_id: str = proto.Field( proto.STRING, number=8, ) - database_id = proto.Field( + database_id: str = proto.Field( proto.STRING, number=9, ) - keys = proto.RepeatedField( + keys: MutableSequence[entity.Key] = proto.RepeatedField( proto.MESSAGE, number=1, message=entity.Key, @@ -555,13 +557,13 @@ class AllocateIdsResponse(proto.Message): [Datastore.AllocateIds][google.datastore.v1.Datastore.AllocateIds]. Attributes: - keys (Sequence[google.cloud.datastore_v1.types.Key]): + keys (MutableSequence[google.cloud.datastore_v1.types.Key]): The keys specified in the request (in the same order), each with its key path completed with a newly allocated ID. """ - keys = proto.RepeatedField( + keys: MutableSequence[entity.Key] = proto.RepeatedField( proto.MESSAGE, number=1, message=entity.Key, @@ -581,21 +583,21 @@ class ReserveIdsRequest(proto.Message): the request. '(default)' is not allowed; please use empty string '' to refer the default database. - keys (Sequence[google.cloud.datastore_v1.types.Key]): + keys (MutableSequence[google.cloud.datastore_v1.types.Key]): Required. A list of keys with complete key paths whose numeric IDs should not be auto-allocated. """ - project_id = proto.Field( + project_id: str = proto.Field( proto.STRING, number=8, ) - database_id = proto.Field( + database_id: str = proto.Field( proto.STRING, number=9, ) - keys = proto.RepeatedField( + keys: MutableSequence[entity.Key] = proto.RepeatedField( proto.MESSAGE, number=1, message=entity.Key, @@ -660,36 +662,36 @@ class Mutation(proto.Message): This field is a member of `oneof`_ ``conflict_detection_strategy``. """ - insert = proto.Field( + insert: entity.Entity = proto.Field( proto.MESSAGE, number=4, oneof="operation", message=entity.Entity, ) - update = proto.Field( + update: entity.Entity = proto.Field( proto.MESSAGE, number=5, oneof="operation", message=entity.Entity, ) - upsert = proto.Field( + upsert: entity.Entity = proto.Field( proto.MESSAGE, number=6, oneof="operation", message=entity.Entity, ) - delete = proto.Field( + delete: entity.Key = proto.Field( proto.MESSAGE, number=7, oneof="operation", message=entity.Key, ) - base_version = proto.Field( + base_version: int = proto.Field( proto.INT64, number=8, oneof="conflict_detection_strategy", ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=11, oneof="conflict_detection_strategy", @@ -726,21 +728,21 @@ class MutationResult(proto.Message): strategy field is not set in the mutation. """ - key = proto.Field( + key: entity.Key = proto.Field( proto.MESSAGE, number=3, message=entity.Key, ) - version = proto.Field( + version: int = proto.Field( proto.INT64, number=4, ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp, ) - conflict_detected = proto.Field( + conflict_detected: bool = proto.Field( proto.BOOL, number=5, ) @@ -783,18 +785,18 @@ class ReadConsistency(proto.Enum): STRONG = 1 EVENTUAL = 2 - read_consistency = proto.Field( + read_consistency: ReadConsistency = proto.Field( proto.ENUM, number=1, oneof="consistency_type", enum=ReadConsistency, ) - transaction = proto.Field( + transaction: bytes = proto.Field( proto.BYTES, number=2, oneof="consistency_type", ) - read_time = proto.Field( + read_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, oneof="consistency_type", @@ -839,7 +841,7 @@ class ReadWrite(proto.Message): being retried. """ - previous_transaction = proto.Field( + previous_transaction: bytes = proto.Field( proto.BYTES, number=1, ) @@ -853,19 +855,19 @@ class ReadOnly(proto.Message): This may not be older than 60 seconds. """ - read_time = proto.Field( + read_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp, ) - read_write = proto.Field( + read_write: ReadWrite = proto.Field( proto.MESSAGE, number=1, oneof="mode", message=ReadWrite, ) - read_only = proto.Field( + read_only: ReadOnly = proto.Field( proto.MESSAGE, number=2, oneof="mode", diff --git a/google/cloud/datastore_v1/types/entity.py b/google/cloud/datastore_v1/types/entity.py index d9b8febe..adb651a2 100644 --- a/google/cloud/datastore_v1/types/entity.py +++ b/google/cloud/datastore_v1/types/entity.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.protobuf import struct_pb2 # type: ignore @@ -65,15 +67,15 @@ class PartitionId(proto.Message): which the entities belong. """ - project_id = proto.Field( + project_id: str = proto.Field( proto.STRING, number=2, ) - database_id = proto.Field( + database_id: str = proto.Field( proto.STRING, number=3, ) - namespace_id = proto.Field( + namespace_id: str = proto.Field( proto.STRING, number=4, ) @@ -92,7 +94,7 @@ class Key(proto.Message): currently identified by a project ID and namespace ID. Queries are scoped to a single partition. - path (Sequence[google.cloud.datastore_v1.types.Key.PathElement]): + path (MutableSequence[google.cloud.datastore_v1.types.Key.PathElement]): The entity path. An entity path consists of one or more elements composed of a kind and a string or numerical identifier, which identify entities. The first element @@ -158,27 +160,27 @@ class PathElement(proto.Message): This field is a member of `oneof`_ ``id_type``. """ - kind = proto.Field( + kind: str = proto.Field( proto.STRING, number=1, ) - id = proto.Field( + id: int = proto.Field( proto.INT64, number=2, oneof="id_type", ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=3, oneof="id_type", ) - partition_id = proto.Field( + partition_id: "PartitionId" = proto.Field( proto.MESSAGE, number=1, message="PartitionId", ) - path = proto.RepeatedField( + path: MutableSequence[PathElement] = proto.RepeatedField( proto.MESSAGE, number=2, message=PathElement, @@ -189,13 +191,13 @@ class ArrayValue(proto.Message): r"""An array value. Attributes: - values (Sequence[google.cloud.datastore_v1.types.Value]): + values (MutableSequence[google.cloud.datastore_v1.types.Value]): Values in the array. The order of values in an array is preserved as long as all values have identical settings for 'exclude_from_indexes'. """ - values = proto.RepeatedField( + values: MutableSequence["Value"] = proto.RepeatedField( proto.MESSAGE, number=1, message="Value", @@ -279,72 +281,72 @@ class Value(proto.Message): indexes including those defined explicitly. """ - null_value = proto.Field( + null_value: struct_pb2.NullValue = proto.Field( proto.ENUM, number=11, oneof="value_type", enum=struct_pb2.NullValue, ) - boolean_value = proto.Field( + boolean_value: bool = proto.Field( proto.BOOL, number=1, oneof="value_type", ) - integer_value = proto.Field( + integer_value: int = proto.Field( proto.INT64, number=2, oneof="value_type", ) - double_value = proto.Field( + double_value: float = proto.Field( proto.DOUBLE, number=3, oneof="value_type", ) - timestamp_value = proto.Field( + timestamp_value: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=10, oneof="value_type", message=timestamp_pb2.Timestamp, ) - key_value = proto.Field( + key_value: "Key" = proto.Field( proto.MESSAGE, number=5, oneof="value_type", message="Key", ) - string_value = proto.Field( + string_value: str = proto.Field( proto.STRING, number=17, oneof="value_type", ) - blob_value = proto.Field( + blob_value: bytes = proto.Field( proto.BYTES, number=18, oneof="value_type", ) - geo_point_value = proto.Field( + geo_point_value: latlng_pb2.LatLng = proto.Field( proto.MESSAGE, number=8, oneof="value_type", message=latlng_pb2.LatLng, ) - entity_value = proto.Field( + entity_value: "Entity" = proto.Field( proto.MESSAGE, number=6, oneof="value_type", message="Entity", ) - array_value = proto.Field( + array_value: "ArrayValue" = proto.Field( proto.MESSAGE, number=9, oneof="value_type", message="ArrayValue", ) - meaning = proto.Field( + meaning: int = proto.Field( proto.INT32, number=14, ) - exclude_from_indexes = proto.Field( + exclude_from_indexes: bool = proto.Field( proto.BOOL, number=19, ) @@ -365,7 +367,7 @@ class Entity(proto.Message): example, an entity in ``Value.entity_value`` may have no key). An entity's kind is its key path's last element's kind, or null if it has no key. - properties (Mapping[str, google.cloud.datastore_v1.types.Value]): + properties (MutableMapping[str, google.cloud.datastore_v1.types.Value]): The entity's properties. The map's keys are property names. A property name matching regex ``__.*__`` is reserved. A reserved property name is forbidden in certain documented @@ -373,12 +375,12 @@ class Entity(proto.Message): characters. The name cannot be ``""``. """ - key = proto.Field( + key: "Key" = proto.Field( proto.MESSAGE, number=1, message="Key", ) - properties = proto.MapField( + properties: MutableMapping[str, "Value"] = proto.MapField( proto.STRING, proto.MESSAGE, number=3, diff --git a/google/cloud/datastore_v1/types/query.py b/google/cloud/datastore_v1/types/query.py index a3f6b75d..f66da3f2 100644 --- a/google/cloud/datastore_v1/types/query.py +++ b/google/cloud/datastore_v1/types/query.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore from google.cloud.datastore_v1.types import entity as gd_entity @@ -83,21 +85,21 @@ class ResultType(proto.Enum): PROJECTION = 2 KEY_ONLY = 3 - entity = proto.Field( + entity: gd_entity.Entity = proto.Field( proto.MESSAGE, number=1, message=gd_entity.Entity, ) - version = proto.Field( + version: int = proto.Field( proto.INT64, number=4, ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, ) - cursor = proto.Field( + cursor: bytes = proto.Field( proto.BYTES, number=3, ) @@ -107,19 +109,19 @@ class Query(proto.Message): r"""A query for entities. Attributes: - projection (Sequence[google.cloud.datastore_v1.types.Projection]): + projection (MutableSequence[google.cloud.datastore_v1.types.Projection]): The projection to return. Defaults to returning all properties. - kind (Sequence[google.cloud.datastore_v1.types.KindExpression]): + kind (MutableSequence[google.cloud.datastore_v1.types.KindExpression]): The kinds to query (if empty, returns entities of all kinds). Currently at most 1 kind may be specified. filter (google.cloud.datastore_v1.types.Filter): The filter to apply. - order (Sequence[google.cloud.datastore_v1.types.PropertyOrder]): + order (MutableSequence[google.cloud.datastore_v1.types.PropertyOrder]): The order to apply to the query results (if empty, order is unspecified). - distinct_on (Sequence[google.cloud.datastore_v1.types.PropertyReference]): + distinct_on (MutableSequence[google.cloud.datastore_v1.types.PropertyReference]): The properties to make distinct. The query results will contain the first result for each distinct combination of values for the given @@ -145,44 +147,44 @@ class Query(proto.Message): Must be >= 0 if specified. """ - projection = proto.RepeatedField( + projection: MutableSequence["Projection"] = proto.RepeatedField( proto.MESSAGE, number=2, message="Projection", ) - kind = proto.RepeatedField( + kind: MutableSequence["KindExpression"] = proto.RepeatedField( proto.MESSAGE, number=3, message="KindExpression", ) - filter = proto.Field( + filter: "Filter" = proto.Field( proto.MESSAGE, number=4, message="Filter", ) - order = proto.RepeatedField( + order: MutableSequence["PropertyOrder"] = proto.RepeatedField( proto.MESSAGE, number=5, message="PropertyOrder", ) - distinct_on = proto.RepeatedField( + distinct_on: MutableSequence["PropertyReference"] = proto.RepeatedField( proto.MESSAGE, number=6, message="PropertyReference", ) - start_cursor = proto.Field( + start_cursor: bytes = proto.Field( proto.BYTES, number=7, ) - end_cursor = proto.Field( + end_cursor: bytes = proto.Field( proto.BYTES, number=8, ) - offset = proto.Field( + offset: int = proto.Field( proto.INT32, number=10, ) - limit = proto.Field( + limit: wrappers_pb2.Int32Value = proto.Field( proto.MESSAGE, number=12, message=wrappers_pb2.Int32Value, @@ -201,7 +203,7 @@ class AggregationQuery(proto.Message): Nested query for aggregation This field is a member of `oneof`_ ``query_type``. - aggregations (Sequence[google.cloud.datastore_v1.types.AggregationQuery.Aggregation]): + aggregations (MutableSequence[google.cloud.datastore_v1.types.AggregationQuery.Aggregation]): Optional. Series of aggregations to apply over the results of the ``nested_query``. @@ -290,30 +292,30 @@ class Count(proto.Message): - Must be non-negative when present. """ - up_to = proto.Field( + up_to: wrappers_pb2.Int64Value = proto.Field( proto.MESSAGE, number=1, message=wrappers_pb2.Int64Value, ) - count = proto.Field( + count: "AggregationQuery.Aggregation.Count" = proto.Field( proto.MESSAGE, number=1, oneof="operator", message="AggregationQuery.Aggregation.Count", ) - alias = proto.Field( + alias: str = proto.Field( proto.STRING, number=7, ) - nested_query = proto.Field( + nested_query: "Query" = proto.Field( proto.MESSAGE, number=1, oneof="query_type", message="Query", ) - aggregations = proto.RepeatedField( + aggregations: MutableSequence[Aggregation] = proto.RepeatedField( proto.MESSAGE, number=3, message=Aggregation, @@ -328,7 +330,7 @@ class KindExpression(proto.Message): The name of the kind. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -344,7 +346,7 @@ class PropertyReference(proto.Message): a property name path. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=2, ) @@ -358,7 +360,7 @@ class Projection(proto.Message): The property to project. """ - property = proto.Field( + property: "PropertyReference" = proto.Field( proto.MESSAGE, number=1, message="PropertyReference", @@ -381,12 +383,12 @@ class Direction(proto.Enum): ASCENDING = 1 DESCENDING = 2 - property = proto.Field( + property: "PropertyReference" = proto.Field( proto.MESSAGE, number=1, message="PropertyReference", ) - direction = proto.Field( + direction: Direction = proto.Field( proto.ENUM, number=2, enum=Direction, @@ -414,13 +416,13 @@ class Filter(proto.Message): This field is a member of `oneof`_ ``filter_type``. """ - composite_filter = proto.Field( + composite_filter: "CompositeFilter" = proto.Field( proto.MESSAGE, number=1, oneof="filter_type", message="CompositeFilter", ) - property_filter = proto.Field( + property_filter: "PropertyFilter" = proto.Field( proto.MESSAGE, number=2, oneof="filter_type", @@ -435,7 +437,7 @@ class CompositeFilter(proto.Message): Attributes: op (google.cloud.datastore_v1.types.CompositeFilter.Operator): The operator for combining multiple filters. - filters (Sequence[google.cloud.datastore_v1.types.Filter]): + filters (MutableSequence[google.cloud.datastore_v1.types.Filter]): The list of filters to combine. Requires: @@ -448,12 +450,12 @@ class Operator(proto.Enum): OPERATOR_UNSPECIFIED = 0 AND = 1 - op = proto.Field( + op: Operator = proto.Field( proto.ENUM, number=1, enum=Operator, ) - filters = proto.RepeatedField( + filters: MutableSequence["Filter"] = proto.RepeatedField( proto.MESSAGE, number=2, message="Filter", @@ -485,17 +487,17 @@ class Operator(proto.Enum): HAS_ANCESTOR = 11 NOT_IN = 13 - property = proto.Field( + property: "PropertyReference" = proto.Field( proto.MESSAGE, number=1, message="PropertyReference", ) - op = proto.Field( + op: Operator = proto.Field( proto.ENUM, number=2, enum=Operator, ) - value = proto.Field( + value: gd_entity.Value = proto.Field( proto.MESSAGE, number=3, message=gd_entity.Value, @@ -515,14 +517,14 @@ class GqlQuery(proto.Message): and instead must bind all values. For example, ``SELECT * FROM Kind WHERE a = 'string literal'`` is not allowed, while ``SELECT * FROM Kind WHERE a = @value`` is. - named_bindings (Mapping[str, google.cloud.datastore_v1.types.GqlQueryParameter]): + named_bindings (MutableMapping[str, google.cloud.datastore_v1.types.GqlQueryParameter]): For each non-reserved named binding site in the query string, there must be a named parameter with that name, but not necessarily the inverse. Key must match regex ``[A-Za-z_$][A-Za-z_$0-9]*``, must not match regex ``__.*__``, and must not be ``""``. - positional_bindings (Sequence[google.cloud.datastore_v1.types.GqlQueryParameter]): + positional_bindings (MutableSequence[google.cloud.datastore_v1.types.GqlQueryParameter]): Numbered binding site @1 references the first numbered parameter, effectively using 1-based indexing, rather than the usual 0. @@ -532,21 +534,21 @@ class GqlQuery(proto.Message): true. """ - query_string = proto.Field( + query_string: str = proto.Field( proto.STRING, number=1, ) - allow_literals = proto.Field( + allow_literals: bool = proto.Field( proto.BOOL, number=2, ) - named_bindings = proto.MapField( + named_bindings: MutableMapping[str, "GqlQueryParameter"] = proto.MapField( proto.STRING, proto.MESSAGE, number=5, message="GqlQueryParameter", ) - positional_bindings = proto.RepeatedField( + positional_bindings: MutableSequence["GqlQueryParameter"] = proto.RepeatedField( proto.MESSAGE, number=4, message="GqlQueryParameter", @@ -575,13 +577,13 @@ class GqlQueryParameter(proto.Message): This field is a member of `oneof`_ ``parameter_type``. """ - value = proto.Field( + value: gd_entity.Value = proto.Field( proto.MESSAGE, number=2, oneof="parameter_type", message=gd_entity.Value, ) - cursor = proto.Field( + cursor: bytes = proto.Field( proto.BYTES, number=3, oneof="parameter_type", @@ -600,7 +602,7 @@ class QueryResultBatch(proto.Message): result. Will be set when ``skipped_results`` != 0. entity_result_type (google.cloud.datastore_v1.types.EntityResult.ResultType): The result type for every entity in ``entity_results``. - entity_results (Sequence[google.cloud.datastore_v1.types.EntityResult]): + entity_results (MutableSequence[google.cloud.datastore_v1.types.EntityResult]): The results for this batch. end_cursor (bytes): A cursor that points to the position after @@ -641,38 +643,38 @@ class MoreResultsType(proto.Enum): MORE_RESULTS_AFTER_CURSOR = 4 NO_MORE_RESULTS = 3 - skipped_results = proto.Field( + skipped_results: int = proto.Field( proto.INT32, number=6, ) - skipped_cursor = proto.Field( + skipped_cursor: bytes = proto.Field( proto.BYTES, number=3, ) - entity_result_type = proto.Field( + entity_result_type: "EntityResult.ResultType" = proto.Field( proto.ENUM, number=1, enum="EntityResult.ResultType", ) - entity_results = proto.RepeatedField( + entity_results: MutableSequence["EntityResult"] = proto.RepeatedField( proto.MESSAGE, number=2, message="EntityResult", ) - end_cursor = proto.Field( + end_cursor: bytes = proto.Field( proto.BYTES, number=4, ) - more_results = proto.Field( + more_results: MoreResultsType = proto.Field( proto.ENUM, number=5, enum=MoreResultsType, ) - snapshot_version = proto.Field( + snapshot_version: int = proto.Field( proto.INT64, number=7, ) - read_time = proto.Field( + read_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=8, message=timestamp_pb2.Timestamp, diff --git a/owlbot.py b/owlbot.py index 47450e9e..60fc4172 100644 --- a/owlbot.py +++ b/owlbot.py @@ -86,6 +86,7 @@ def get_staging_dirs( "", ) + s.move(library / f"google/cloud/datastore_admin", excludes=["**/gapic_version.py"]) s.move(library / f"google/cloud/datastore_admin_{library.name}") s.move(library / "tests") s.move(library / "scripts") @@ -102,7 +103,7 @@ def get_staging_dirs( ) s.move( templated_files, - excludes=["docs/multiprocessing.rst", ".coveragerc", ".github/CODEOOWNERS"], + excludes=["docs/multiprocessing.rst", ".coveragerc", ".github/CODEOOWNERS", ".github/release-please.yml"], ) python.py_samples(skip_readmes=True) diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 00000000..ebf3058f --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,20 @@ +{ + "$schema": +"https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "packages": { + ".": { + "release-type": "python", + "extra-files": [ + "google/cloud/datastore/gapic_version.py", + "google/cloud/datastore_admin/gapic_version.py" + ] + } + }, + "release-type": "python", + "plugins": [ + { + "type": "sentence-case" + } + ], + "initial-version": "2.10.0" +} \ No newline at end of file diff --git a/setup.py b/setup.py index b0e45e9e..af39cfa4 100644 --- a/setup.py +++ b/setup.py @@ -42,7 +42,7 @@ package_root = os.path.abspath(os.path.dirname(__file__)) version = {} -with open(os.path.join(package_root, "google/cloud/datastore/version.py")) as fp: +with open(os.path.join(package_root, "google/cloud/datastore/gapic_version.py")) as fp: exec(fp.read(), version) version = version["__version__"] diff --git a/tests/unit/gapic/datastore_admin_v1/test_datastore_admin.py b/tests/unit/gapic/datastore_admin_v1/test_datastore_admin.py index 13c26fa9..63f8814f 100644 --- a/tests/unit/gapic/datastore_admin_v1/test_datastore_admin.py +++ b/tests/unit/gapic/datastore_admin_v1/test_datastore_admin.py @@ -53,6 +53,7 @@ from google.cloud.datastore_admin_v1.types import index from google.longrunning import operations_pb2 from google.oauth2 import service_account +from google.protobuf import empty_pb2 # type: ignore import google.auth