From 874c905eb80bf221a3e944d7974b84c9e9906adf Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 22 Nov 2022 14:48:54 -0500 Subject: [PATCH] chore: Update gapic-generator-python to v1.6.1 (#286) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 * update version in gapic_version.py * add .release-please-manifest.json with correct version * add owlbot.py to exclude generated gapic_version.py * set manifest to true in .github/release-please.yml * add release-please-config.json * 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 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * 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 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * update path to snippet metadata json * 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 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .../.github/release-please.yml | 1 + .../.release-please-manifest.json | 3 + .../docs/datalabeling_v1beta1/types.rst | 1 - .../google/cloud/datalabeling/__init__.py | 4 + .../cloud/datalabeling/gapic_version.py | 16 + .../cloud/datalabeling_v1beta1/__init__.py | 4 + .../data_labeling_service/async_client.py | 386 ++++++++++-------- .../services/data_labeling_service/client.py | 324 +++++++++------ .../data_labeling_service/transports/base.py | 2 +- .../data_labeling_service/transports/grpc.py | 20 +- .../transports/grpc_asyncio.py | 16 +- .../datalabeling_v1beta1/types/annotation.py | 128 +++--- .../types/annotation_spec_set.py | 20 +- .../types/data_labeling_service.py | 286 +++++++------ .../types/data_payloads.py | 28 +- .../datalabeling_v1beta1/types/dataset.py | 164 ++++---- .../datalabeling_v1beta1/types/evaluation.py | 78 ++-- .../types/evaluation_job.py | 74 ++-- .../types/human_annotation_config.py | 72 ++-- .../datalabeling_v1beta1/types/instruction.py | 26 +- .../datalabeling_v1beta1/types/operations.py | 178 ++++---- packages/google-cloud-datalabeling/owlbot.py | 56 +++ .../release-please-config.json | 23 ++ ...ta_google.cloud.datalabeling.v1beta1.json} | 3 +- packages/google-cloud-datalabeling/setup.py | 39 +- .../testing/constraints-3.10.txt | 6 + .../testing/constraints-3.11.txt | 6 + .../testing/constraints-3.7.txt | 10 +- .../testing/constraints-3.8.txt | 6 + .../testing/constraints-3.9.txt | 6 + 30 files changed, 1152 insertions(+), 834 deletions(-) create mode 100644 packages/google-cloud-datalabeling/.release-please-manifest.json create mode 100644 packages/google-cloud-datalabeling/google/cloud/datalabeling/gapic_version.py create mode 100644 packages/google-cloud-datalabeling/owlbot.py create mode 100644 packages/google-cloud-datalabeling/release-please-config.json rename packages/google-cloud-datalabeling/samples/generated_samples/{snippet_metadata_datalabeling_v1beta1.json => snippet_metadata_google.cloud.datalabeling.v1beta1.json} (99%) diff --git a/packages/google-cloud-datalabeling/.github/release-please.yml b/packages/google-cloud-datalabeling/.github/release-please.yml index 6def37a84c98..e9a4f0085128 100644 --- a/packages/google-cloud-datalabeling/.github/release-please.yml +++ b/packages/google-cloud-datalabeling/.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/packages/google-cloud-datalabeling/.release-please-manifest.json b/packages/google-cloud-datalabeling/.release-please-manifest.json new file mode 100644 index 000000000000..a0457ca5e897 --- /dev/null +++ b/packages/google-cloud-datalabeling/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "1.6.3" +} diff --git a/packages/google-cloud-datalabeling/docs/datalabeling_v1beta1/types.rst b/packages/google-cloud-datalabeling/docs/datalabeling_v1beta1/types.rst index 452ea6c5599a..2722f06ed1f8 100644 --- a/packages/google-cloud-datalabeling/docs/datalabeling_v1beta1/types.rst +++ b/packages/google-cloud-datalabeling/docs/datalabeling_v1beta1/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Datalabeling v1beta1 API .. automodule:: google.cloud.datalabeling_v1beta1.types :members: - :undoc-members: :show-inheritance: diff --git a/packages/google-cloud-datalabeling/google/cloud/datalabeling/__init__.py b/packages/google-cloud-datalabeling/google/cloud/datalabeling/__init__.py index b502b78f38c9..a756bb214142 100644 --- a/packages/google-cloud-datalabeling/google/cloud/datalabeling/__init__.py +++ b/packages/google-cloud-datalabeling/google/cloud/datalabeling/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.datalabeling import gapic_version as package_version + +__version__ = package_version.__version__ + from google.cloud.datalabeling_v1beta1.services.data_labeling_service.async_client import ( DataLabelingServiceAsyncClient, diff --git a/packages/google-cloud-datalabeling/google/cloud/datalabeling/gapic_version.py b/packages/google-cloud-datalabeling/google/cloud/datalabeling/gapic_version.py new file mode 100644 index 000000000000..a7807d3a8585 --- /dev/null +++ b/packages/google-cloud-datalabeling/google/cloud/datalabeling/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__ = "1.6.3" # {x-release-please-version} diff --git a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/__init__.py b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/__init__.py index 80c9050e813c..3cb27858cee4 100644 --- a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/__init__.py +++ b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/__init__.py @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from google.cloud.datalabeling import gapic_version as package_version + +__version__ = package_version.__version__ + from .services.data_labeling_service import ( DataLabelingServiceAsyncClient, diff --git a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/services/data_labeling_service/async_client.py b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/services/data_labeling_service/async_client.py index 377213e2b1f7..0e10e5db64b6 100644 --- a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/services/data_labeling_service/async_client.py +++ b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/services/data_labeling_service/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, +) from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 @@ -207,9 +217,9 @@ def transport(self) -> DataLabelingServiceTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, DataLabelingServiceTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the data labeling service client. @@ -253,12 +263,14 @@ def __init__( async def create_dataset( self, - request: Union[data_labeling_service.CreateDatasetRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.CreateDatasetRequest, dict] + ] = None, *, - parent: str = None, - dataset: gcd_dataset.Dataset = None, + parent: Optional[str] = None, + dataset: Optional[gcd_dataset.Dataset] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gcd_dataset.Dataset: r"""Creates dataset. If success return a Dataset @@ -291,7 +303,7 @@ async def sample_create_dataset(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.CreateDatasetRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.CreateDatasetRequest, dict]]): The request object. Request message for CreateDataset. parent (:class:`str`): Required. Dataset resource parent, format: @@ -365,11 +377,11 @@ async def sample_create_dataset(): async def get_dataset( self, - request: Union[data_labeling_service.GetDatasetRequest, dict] = None, + request: Optional[Union[data_labeling_service.GetDatasetRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dataset.Dataset: r"""Gets dataset by resource name. @@ -401,7 +413,7 @@ async def sample_get_dataset(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.GetDatasetRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.GetDatasetRequest, dict]]): The request object. Request message for GetDataSet. name (:class:`str`): Required. Dataset resource name, format: @@ -478,12 +490,14 @@ async def sample_get_dataset(): async def list_datasets( self, - request: Union[data_labeling_service.ListDatasetsRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.ListDatasetsRequest, dict] + ] = None, *, - parent: str = None, - filter: str = None, + parent: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListDatasetsAsyncPager: r"""Lists datasets under a project. Pagination is @@ -517,7 +531,7 @@ async def sample_list_datasets(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.ListDatasetsRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.ListDatasetsRequest, dict]]): The request object. Request message for ListDataset. parent (:class:`str`): Required. Dataset resource parent, format: @@ -613,11 +627,13 @@ async def sample_list_datasets(): async def delete_dataset( self, - request: Union[data_labeling_service.DeleteDatasetRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.DeleteDatasetRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a dataset by resource name. @@ -646,7 +662,7 @@ async def sample_delete_dataset(): await client.delete_dataset(request=request) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.DeleteDatasetRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.DeleteDatasetRequest, dict]]): The request object. Request message for DeleteDataset. name (:class:`str`): Required. Dataset resource name, format: @@ -712,12 +728,12 @@ async def sample_delete_dataset(): async def import_data( self, - request: Union[data_labeling_service.ImportDataRequest, dict] = None, + request: Optional[Union[data_labeling_service.ImportDataRequest, dict]] = None, *, - name: str = None, - input_config: dataset.InputConfig = None, + name: Optional[str] = None, + input_config: Optional[dataset.InputConfig] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Imports data into dataset based on source locations @@ -758,7 +774,7 @@ async def sample_import_data(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.ImportDataRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.ImportDataRequest, dict]]): The request object. Request message for ImportData API. name (:class:`str`): Required. Dataset resource name, format: @@ -843,14 +859,14 @@ async def sample_import_data(): async def export_data( self, - request: Union[data_labeling_service.ExportDataRequest, dict] = None, + request: Optional[Union[data_labeling_service.ExportDataRequest, dict]] = None, *, - name: str = None, - annotated_dataset: str = None, - filter: str = None, - output_config: dataset.OutputConfig = None, + name: Optional[str] = None, + annotated_dataset: Optional[str] = None, + filter: Optional[str] = None, + output_config: Optional[dataset.OutputConfig] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Exports data and annotations from dataset. @@ -887,7 +903,7 @@ async def sample_export_data(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.ExportDataRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.ExportDataRequest, dict]]): The request object. Request message for ExportData API. name (:class:`str`): Required. Dataset resource name, format: @@ -1003,11 +1019,11 @@ async def sample_export_data(): async def get_data_item( self, - request: Union[data_labeling_service.GetDataItemRequest, dict] = None, + request: Optional[Union[data_labeling_service.GetDataItemRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dataset.DataItem: r"""Gets a data item in a dataset by resource name. This @@ -1040,7 +1056,7 @@ async def sample_get_data_item(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.GetDataItemRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.GetDataItemRequest, dict]]): The request object. Request message for GetDataItem. name (:class:`str`): Required. The name of the data item to get, format: @@ -1115,12 +1131,14 @@ async def sample_get_data_item(): async def list_data_items( self, - request: Union[data_labeling_service.ListDataItemsRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.ListDataItemsRequest, dict] + ] = None, *, - parent: str = None, - filter: str = None, + parent: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListDataItemsAsyncPager: r"""Lists data items in a dataset. This API can be called @@ -1155,7 +1173,7 @@ async def sample_list_data_items(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.ListDataItemsRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.ListDataItemsRequest, dict]]): The request object. Request message for ListDataItems. parent (:class:`str`): Required. Name of the dataset to list data items, @@ -1251,11 +1269,13 @@ async def sample_list_data_items(): async def get_annotated_dataset( self, - request: Union[data_labeling_service.GetAnnotatedDatasetRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.GetAnnotatedDatasetRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dataset.AnnotatedDataset: r"""Gets an annotated dataset by resource name. @@ -1287,7 +1307,7 @@ async def sample_get_annotated_dataset(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.GetAnnotatedDatasetRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.GetAnnotatedDatasetRequest, dict]]): The request object. Request message for GetAnnotatedDataset. name (:class:`str`): @@ -1367,12 +1387,14 @@ async def sample_get_annotated_dataset(): async def list_annotated_datasets( self, - request: Union[data_labeling_service.ListAnnotatedDatasetsRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.ListAnnotatedDatasetsRequest, dict] + ] = None, *, - parent: str = None, - filter: str = None, + parent: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAnnotatedDatasetsAsyncPager: r"""Lists annotated datasets for a dataset. Pagination is @@ -1406,7 +1428,7 @@ async def sample_list_annotated_datasets(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.ListAnnotatedDatasetsRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.ListAnnotatedDatasetsRequest, dict]]): The request object. Request message for ListAnnotatedDatasets. parent (:class:`str`): @@ -1504,12 +1526,12 @@ async def sample_list_annotated_datasets(): async def delete_annotated_dataset( self, - request: Union[ - data_labeling_service.DeleteAnnotatedDatasetRequest, dict + request: Optional[ + Union[data_labeling_service.DeleteAnnotatedDatasetRequest, dict] ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an annotated dataset by resource name. @@ -1538,7 +1560,7 @@ async def sample_delete_annotated_dataset(): await client.delete_annotated_dataset(request=request) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.DeleteAnnotatedDatasetRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.DeleteAnnotatedDatasetRequest, dict]]): The request object. Request message for DeleteAnnotatedDataset. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -1574,13 +1596,13 @@ async def sample_delete_annotated_dataset(): async def label_image( self, - request: Union[data_labeling_service.LabelImageRequest, dict] = None, + request: Optional[Union[data_labeling_service.LabelImageRequest, dict]] = None, *, - parent: str = None, - basic_config: human_annotation_config.HumanAnnotationConfig = None, - feature: data_labeling_service.LabelImageRequest.Feature = None, + parent: Optional[str] = None, + basic_config: Optional[human_annotation_config.HumanAnnotationConfig] = None, + feature: Optional[data_labeling_service.LabelImageRequest.Feature] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Starts a labeling task for image. The type of image @@ -1627,7 +1649,7 @@ async def sample_label_image(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.LabelImageRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.LabelImageRequest, dict]]): The request object. Request message for starting an image labeling task. parent (:class:`str`): @@ -1722,13 +1744,13 @@ async def sample_label_image(): async def label_video( self, - request: Union[data_labeling_service.LabelVideoRequest, dict] = None, + request: Optional[Union[data_labeling_service.LabelVideoRequest, dict]] = None, *, - parent: str = None, - basic_config: human_annotation_config.HumanAnnotationConfig = None, - feature: data_labeling_service.LabelVideoRequest.Feature = None, + parent: Optional[str] = None, + basic_config: Optional[human_annotation_config.HumanAnnotationConfig] = None, + feature: Optional[data_labeling_service.LabelVideoRequest.Feature] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Starts a labeling task for video. The type of video @@ -1775,7 +1797,7 @@ async def sample_label_video(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.LabelVideoRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.LabelVideoRequest, dict]]): The request object. Request message for LabelVideo. parent (:class:`str`): Required. Name of the dataset to request labeling task, @@ -1869,13 +1891,13 @@ async def sample_label_video(): async def label_text( self, - request: Union[data_labeling_service.LabelTextRequest, dict] = None, + request: Optional[Union[data_labeling_service.LabelTextRequest, dict]] = None, *, - parent: str = None, - basic_config: human_annotation_config.HumanAnnotationConfig = None, - feature: data_labeling_service.LabelTextRequest.Feature = None, + parent: Optional[str] = None, + basic_config: Optional[human_annotation_config.HumanAnnotationConfig] = None, + feature: Optional[data_labeling_service.LabelTextRequest.Feature] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Starts a labeling task for text. The type of text @@ -1922,7 +1944,7 @@ async def sample_label_text(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.LabelTextRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.LabelTextRequest, dict]]): The request object. Request message for LabelText. parent (:class:`str`): Required. Name of the data set to request labeling task, @@ -2016,12 +2038,12 @@ async def sample_label_text(): async def get_example( self, - request: Union[data_labeling_service.GetExampleRequest, dict] = None, + request: Optional[Union[data_labeling_service.GetExampleRequest, dict]] = None, *, - name: str = None, - filter: str = None, + name: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dataset.Example: r"""Gets an example by resource name, including both data @@ -2054,7 +2076,7 @@ async def sample_get_example(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.GetExampleRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.GetExampleRequest, dict]]): The request object. Request message for GetExample name (:class:`str`): Required. Name of example, format: @@ -2141,12 +2163,14 @@ async def sample_get_example(): async def list_examples( self, - request: Union[data_labeling_service.ListExamplesRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.ListExamplesRequest, dict] + ] = None, *, - parent: str = None, - filter: str = None, + parent: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListExamplesAsyncPager: r"""Lists examples in an annotated dataset. Pagination is @@ -2180,7 +2204,7 @@ async def sample_list_examples(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.ListExamplesRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.ListExamplesRequest, dict]]): The request object. Request message for ListExamples. parent (:class:`str`): Required. Example resource parent. @@ -2276,14 +2300,14 @@ async def sample_list_examples(): async def create_annotation_spec_set( self, - request: Union[ - data_labeling_service.CreateAnnotationSpecSetRequest, dict + request: Optional[ + Union[data_labeling_service.CreateAnnotationSpecSetRequest, dict] ] = None, *, - parent: str = None, - annotation_spec_set: gcd_annotation_spec_set.AnnotationSpecSet = None, + parent: Optional[str] = None, + annotation_spec_set: Optional[gcd_annotation_spec_set.AnnotationSpecSet] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gcd_annotation_spec_set.AnnotationSpecSet: r"""Creates an annotation spec set by providing a set of @@ -2316,7 +2340,7 @@ async def sample_create_annotation_spec_set(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.CreateAnnotationSpecSetRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.CreateAnnotationSpecSetRequest, dict]]): The request object. Request message for CreateAnnotationSpecSet. parent (:class:`str`): @@ -2396,11 +2420,13 @@ async def sample_create_annotation_spec_set(): async def get_annotation_spec_set( self, - request: Union[data_labeling_service.GetAnnotationSpecSetRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.GetAnnotationSpecSetRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> annotation_spec_set.AnnotationSpecSet: r"""Gets an annotation spec set by resource name. @@ -2432,7 +2458,7 @@ async def sample_get_annotation_spec_set(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.GetAnnotationSpecSetRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.GetAnnotationSpecSetRequest, dict]]): The request object. Request message for GetAnnotationSpecSet. name (:class:`str`): @@ -2512,14 +2538,14 @@ async def sample_get_annotation_spec_set(): async def list_annotation_spec_sets( self, - request: Union[ - data_labeling_service.ListAnnotationSpecSetsRequest, dict + request: Optional[ + Union[data_labeling_service.ListAnnotationSpecSetsRequest, dict] ] = None, *, - parent: str = None, - filter: str = None, + parent: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAnnotationSpecSetsAsyncPager: r"""Lists annotation spec sets for a project. Pagination @@ -2553,7 +2579,7 @@ async def sample_list_annotation_spec_sets(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.ListAnnotationSpecSetsRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.ListAnnotationSpecSetsRequest, dict]]): The request object. Request message for ListAnnotationSpecSets. parent (:class:`str`): @@ -2650,13 +2676,13 @@ async def sample_list_annotation_spec_sets(): async def delete_annotation_spec_set( self, - request: Union[ - data_labeling_service.DeleteAnnotationSpecSetRequest, dict + request: Optional[ + Union[data_labeling_service.DeleteAnnotationSpecSetRequest, dict] ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an annotation spec set by resource name. @@ -2685,7 +2711,7 @@ async def sample_delete_annotation_spec_set(): await client.delete_annotation_spec_set(request=request) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.DeleteAnnotationSpecSetRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.DeleteAnnotationSpecSetRequest, dict]]): The request object. Request message for DeleteAnnotationSpecSet. name (:class:`str`): @@ -2752,12 +2778,14 @@ async def sample_delete_annotation_spec_set(): async def create_instruction( self, - request: Union[data_labeling_service.CreateInstructionRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.CreateInstructionRequest, dict] + ] = None, *, - parent: str = None, - instruction: gcd_instruction.Instruction = None, + parent: Optional[str] = None, + instruction: Optional[gcd_instruction.Instruction] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Creates an instruction for how data should be @@ -2794,7 +2822,7 @@ async def sample_create_instruction(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.CreateInstructionRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.CreateInstructionRequest, dict]]): The request object. Request message for CreateInstruction. parent (:class:`str`): @@ -2879,11 +2907,13 @@ async def sample_create_instruction(): async def get_instruction( self, - request: Union[data_labeling_service.GetInstructionRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.GetInstructionRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> instruction.Instruction: r"""Gets an instruction by resource name. @@ -2915,7 +2945,7 @@ async def sample_get_instruction(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.GetInstructionRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.GetInstructionRequest, dict]]): The request object. Request message for GetInstruction. name (:class:`str`): Required. Instruction resource name, format: @@ -2992,12 +3022,14 @@ async def sample_get_instruction(): async def list_instructions( self, - request: Union[data_labeling_service.ListInstructionsRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.ListInstructionsRequest, dict] + ] = None, *, - parent: str = None, - filter: str = None, + parent: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListInstructionsAsyncPager: r"""Lists instructions for a project. Pagination is @@ -3031,7 +3063,7 @@ async def sample_list_instructions(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.ListInstructionsRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.ListInstructionsRequest, dict]]): The request object. Request message for ListInstructions. parent (:class:`str`): @@ -3128,11 +3160,13 @@ async def sample_list_instructions(): async def delete_instruction( self, - request: Union[data_labeling_service.DeleteInstructionRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.DeleteInstructionRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an instruction object by resource name. @@ -3161,7 +3195,7 @@ async def sample_delete_instruction(): await client.delete_instruction(request=request) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.DeleteInstructionRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.DeleteInstructionRequest, dict]]): The request object. Request message for DeleteInstruction. name (:class:`str`): @@ -3228,11 +3262,13 @@ async def sample_delete_instruction(): async def get_evaluation( self, - request: Union[data_labeling_service.GetEvaluationRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.GetEvaluationRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> evaluation.Evaluation: r"""Gets an evaluation by resource name (to search, use @@ -3265,7 +3301,7 @@ async def sample_get_evaluation(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.GetEvaluationRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.GetEvaluationRequest, dict]]): The request object. Request message for GetEvaluation. name (:class:`str`): Required. Name of the evaluation. Format: @@ -3343,12 +3379,14 @@ async def sample_get_evaluation(): async def search_evaluations( self, - request: Union[data_labeling_service.SearchEvaluationsRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.SearchEvaluationsRequest, dict] + ] = None, *, - parent: str = None, - filter: str = None, + parent: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.SearchEvaluationsAsyncPager: r"""Searches @@ -3383,7 +3421,7 @@ async def sample_search_evaluations(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.SearchEvaluationsRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.SearchEvaluationsRequest, dict]]): The request object. Request message for SearchEvaluation. parent (:class:`str`): @@ -3510,13 +3548,13 @@ async def sample_search_evaluations(): async def search_example_comparisons( self, - request: Union[ - data_labeling_service.SearchExampleComparisonsRequest, dict + request: Optional[ + Union[data_labeling_service.SearchExampleComparisonsRequest, dict] ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.SearchExampleComparisonsAsyncPager: r"""Searches example comparisons from an evaluation. The @@ -3552,7 +3590,7 @@ async def sample_search_example_comparisons(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.SearchExampleComparisonsRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.SearchExampleComparisonsRequest, dict]]): The request object. Request message of SearchExampleComparisons. parent (:class:`str`): @@ -3633,12 +3671,14 @@ async def sample_search_example_comparisons(): async def create_evaluation_job( self, - request: Union[data_labeling_service.CreateEvaluationJobRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.CreateEvaluationJobRequest, dict] + ] = None, *, - parent: str = None, - job: evaluation_job.EvaluationJob = None, + parent: Optional[str] = None, + job: Optional[evaluation_job.EvaluationJob] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> evaluation_job.EvaluationJob: r"""Creates an evaluation job. @@ -3670,7 +3710,7 @@ async def sample_create_evaluation_job(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.CreateEvaluationJobRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.CreateEvaluationJobRequest, dict]]): The request object. Request message for CreateEvaluationJob. parent (:class:`str`): @@ -3749,12 +3789,14 @@ async def sample_create_evaluation_job(): async def update_evaluation_job( self, - request: Union[data_labeling_service.UpdateEvaluationJobRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.UpdateEvaluationJobRequest, dict] + ] = None, *, - evaluation_job: gcd_evaluation_job.EvaluationJob = None, - update_mask: field_mask_pb2.FieldMask = None, + evaluation_job: Optional[gcd_evaluation_job.EvaluationJob] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gcd_evaluation_job.EvaluationJob: r"""Updates an evaluation job. You can only update certain fields of @@ -3792,7 +3834,7 @@ async def sample_update_evaluation_job(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.UpdateEvaluationJobRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.UpdateEvaluationJobRequest, dict]]): The request object. Request message for UpdateEvaluationJob. evaluation_job (:class:`google.cloud.datalabeling_v1beta1.types.EvaluationJob`): @@ -3880,11 +3922,13 @@ async def sample_update_evaluation_job(): async def get_evaluation_job( self, - request: Union[data_labeling_service.GetEvaluationJobRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.GetEvaluationJobRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> evaluation_job.EvaluationJob: r"""Gets an evaluation job by resource name. @@ -3916,7 +3960,7 @@ async def sample_get_evaluation_job(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.GetEvaluationJobRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.GetEvaluationJobRequest, dict]]): The request object. Request message for GetEvaluationJob. name (:class:`str`): @@ -3997,11 +4041,13 @@ async def sample_get_evaluation_job(): async def pause_evaluation_job( self, - request: Union[data_labeling_service.PauseEvaluationJobRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.PauseEvaluationJobRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Pauses an evaluation job. Pausing an evaluation job that is @@ -4031,7 +4077,7 @@ async def sample_pause_evaluation_job(): await client.pause_evaluation_job(request=request) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.PauseEvaluationJobRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.PauseEvaluationJobRequest, dict]]): The request object. Request message for PauseEvaluationJob. name (:class:`str`): @@ -4090,11 +4136,13 @@ async def sample_pause_evaluation_job(): async def resume_evaluation_job( self, - request: Union[data_labeling_service.ResumeEvaluationJobRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.ResumeEvaluationJobRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Resumes a paused evaluation job. A deleted evaluation @@ -4125,7 +4173,7 @@ async def sample_resume_evaluation_job(): await client.resume_evaluation_job(request=request) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.ResumeEvaluationJobRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.ResumeEvaluationJobRequest, dict]]): The request object. Request message ResumeEvaluationJob. name (:class:`str`): Required. Name of the evaluation job that is going to be @@ -4183,11 +4231,13 @@ async def sample_resume_evaluation_job(): async def delete_evaluation_job( self, - request: Union[data_labeling_service.DeleteEvaluationJobRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.DeleteEvaluationJobRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Stops and deletes an evaluation job. @@ -4216,7 +4266,7 @@ async def sample_delete_evaluation_job(): await client.delete_evaluation_job(request=request) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.DeleteEvaluationJobRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.DeleteEvaluationJobRequest, dict]]): The request object. Request message DeleteEvaluationJob. name (:class:`str`): Required. Name of the evaluation job that is going to be @@ -4284,12 +4334,14 @@ async def sample_delete_evaluation_job(): async def list_evaluation_jobs( self, - request: Union[data_labeling_service.ListEvaluationJobsRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.ListEvaluationJobsRequest, dict] + ] = None, *, - parent: str = None, - filter: str = None, + parent: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListEvaluationJobsAsyncPager: r"""Lists all evaluation jobs within a project with @@ -4323,7 +4375,7 @@ async def sample_list_evaluation_jobs(): print(response) Args: - request (Union[google.cloud.datalabeling_v1beta1.types.ListEvaluationJobsRequest, dict]): + request (Optional[Union[google.cloud.datalabeling_v1beta1.types.ListEvaluationJobsRequest, dict]]): The request object. Request message for ListEvaluationJobs. parent (:class:`str`): diff --git a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/services/data_labeling_service/client.py b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/services/data_labeling_service/client.py index a941cbcfccbb..56da2d4ae791 100644 --- a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/services/data_labeling_service/client.py +++ b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/services/data_labeling_service/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, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -77,7 +88,7 @@ class DataLabelingServiceClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[DataLabelingServiceTransport]: """Returns an appropriate transport class. @@ -495,8 +506,8 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, DataLabelingServiceTransport, None] = None, - client_options: Optional[client_options_lib.ClientOptions] = None, + transport: Optional[Union[str, DataLabelingServiceTransport]] = None, + client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the data labeling service client. @@ -510,7 +521,7 @@ def __init__( transport (Union[str, DataLabelingServiceTransport]): 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 @@ -540,6 +551,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 @@ -592,12 +604,14 @@ def __init__( def create_dataset( self, - request: Union[data_labeling_service.CreateDatasetRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.CreateDatasetRequest, dict] + ] = None, *, - parent: str = None, - dataset: gcd_dataset.Dataset = None, + parent: Optional[str] = None, + dataset: Optional[gcd_dataset.Dataset] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gcd_dataset.Dataset: r"""Creates dataset. If success return a Dataset @@ -704,11 +718,11 @@ def sample_create_dataset(): def get_dataset( self, - request: Union[data_labeling_service.GetDatasetRequest, dict] = None, + request: Optional[Union[data_labeling_service.GetDatasetRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dataset.Dataset: r"""Gets dataset by resource name. @@ -807,12 +821,14 @@ def sample_get_dataset(): def list_datasets( self, - request: Union[data_labeling_service.ListDatasetsRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.ListDatasetsRequest, dict] + ] = None, *, - parent: str = None, - filter: str = None, + parent: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListDatasetsPager: r"""Lists datasets under a project. Pagination is @@ -932,11 +948,13 @@ def sample_list_datasets(): def delete_dataset( self, - request: Union[data_labeling_service.DeleteDatasetRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.DeleteDatasetRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes a dataset by resource name. @@ -1021,12 +1039,12 @@ def sample_delete_dataset(): def import_data( self, - request: Union[data_labeling_service.ImportDataRequest, dict] = None, + request: Optional[Union[data_labeling_service.ImportDataRequest, dict]] = None, *, - name: str = None, - input_config: dataset.InputConfig = None, + name: Optional[str] = None, + input_config: Optional[dataset.InputConfig] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Imports data into dataset based on source locations @@ -1152,14 +1170,14 @@ def sample_import_data(): def export_data( self, - request: Union[data_labeling_service.ExportDataRequest, dict] = None, + request: Optional[Union[data_labeling_service.ExportDataRequest, dict]] = None, *, - name: str = None, - annotated_dataset: str = None, - filter: str = None, - output_config: dataset.OutputConfig = None, + name: Optional[str] = None, + annotated_dataset: Optional[str] = None, + filter: Optional[str] = None, + output_config: Optional[dataset.OutputConfig] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Exports data and annotations from dataset. @@ -1302,11 +1320,11 @@ def sample_export_data(): def get_data_item( self, - request: Union[data_labeling_service.GetDataItemRequest, dict] = None, + request: Optional[Union[data_labeling_service.GetDataItemRequest, dict]] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dataset.DataItem: r"""Gets a data item in a dataset by resource name. This @@ -1404,12 +1422,14 @@ def sample_get_data_item(): def list_data_items( self, - request: Union[data_labeling_service.ListDataItemsRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.ListDataItemsRequest, dict] + ] = None, *, - parent: str = None, - filter: str = None, + parent: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListDataItemsPager: r"""Lists data items in a dataset. This API can be called @@ -1530,11 +1550,13 @@ def sample_list_data_items(): def get_annotated_dataset( self, - request: Union[data_labeling_service.GetAnnotatedDatasetRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.GetAnnotatedDatasetRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dataset.AnnotatedDataset: r"""Gets an annotated dataset by resource name. @@ -1636,12 +1658,14 @@ def sample_get_annotated_dataset(): def list_annotated_datasets( self, - request: Union[data_labeling_service.ListAnnotatedDatasetsRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.ListAnnotatedDatasetsRequest, dict] + ] = None, *, - parent: str = None, - filter: str = None, + parent: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAnnotatedDatasetsPager: r"""Lists annotated datasets for a dataset. Pagination is @@ -1763,12 +1787,12 @@ def sample_list_annotated_datasets(): def delete_annotated_dataset( self, - request: Union[ - data_labeling_service.DeleteAnnotatedDatasetRequest, dict + request: Optional[ + Union[data_labeling_service.DeleteAnnotatedDatasetRequest, dict] ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an annotated dataset by resource name. @@ -1834,13 +1858,13 @@ def sample_delete_annotated_dataset(): def label_image( self, - request: Union[data_labeling_service.LabelImageRequest, dict] = None, + request: Optional[Union[data_labeling_service.LabelImageRequest, dict]] = None, *, - parent: str = None, - basic_config: human_annotation_config.HumanAnnotationConfig = None, - feature: data_labeling_service.LabelImageRequest.Feature = None, + parent: Optional[str] = None, + basic_config: Optional[human_annotation_config.HumanAnnotationConfig] = None, + feature: Optional[data_labeling_service.LabelImageRequest.Feature] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Starts a labeling task for image. The type of image @@ -1982,13 +2006,13 @@ def sample_label_image(): def label_video( self, - request: Union[data_labeling_service.LabelVideoRequest, dict] = None, + request: Optional[Union[data_labeling_service.LabelVideoRequest, dict]] = None, *, - parent: str = None, - basic_config: human_annotation_config.HumanAnnotationConfig = None, - feature: data_labeling_service.LabelVideoRequest.Feature = None, + parent: Optional[str] = None, + basic_config: Optional[human_annotation_config.HumanAnnotationConfig] = None, + feature: Optional[data_labeling_service.LabelVideoRequest.Feature] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Starts a labeling task for video. The type of video @@ -2129,13 +2153,13 @@ def sample_label_video(): def label_text( self, - request: Union[data_labeling_service.LabelTextRequest, dict] = None, + request: Optional[Union[data_labeling_service.LabelTextRequest, dict]] = None, *, - parent: str = None, - basic_config: human_annotation_config.HumanAnnotationConfig = None, - feature: data_labeling_service.LabelTextRequest.Feature = None, + parent: Optional[str] = None, + basic_config: Optional[human_annotation_config.HumanAnnotationConfig] = None, + feature: Optional[data_labeling_service.LabelTextRequest.Feature] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Starts a labeling task for text. The type of text @@ -2276,12 +2300,12 @@ def sample_label_text(): def get_example( self, - request: Union[data_labeling_service.GetExampleRequest, dict] = None, + request: Optional[Union[data_labeling_service.GetExampleRequest, dict]] = None, *, - name: str = None, - filter: str = None, + name: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> dataset.Example: r"""Gets an example by resource name, including both data @@ -2391,12 +2415,14 @@ def sample_get_example(): def list_examples( self, - request: Union[data_labeling_service.ListExamplesRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.ListExamplesRequest, dict] + ] = None, *, - parent: str = None, - filter: str = None, + parent: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListExamplesPager: r"""Lists examples in an annotated dataset. Pagination is @@ -2516,14 +2542,14 @@ def sample_list_examples(): def create_annotation_spec_set( self, - request: Union[ - data_labeling_service.CreateAnnotationSpecSetRequest, dict + request: Optional[ + Union[data_labeling_service.CreateAnnotationSpecSetRequest, dict] ] = None, *, - parent: str = None, - annotation_spec_set: gcd_annotation_spec_set.AnnotationSpecSet = None, + parent: Optional[str] = None, + annotation_spec_set: Optional[gcd_annotation_spec_set.AnnotationSpecSet] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gcd_annotation_spec_set.AnnotationSpecSet: r"""Creates an annotation spec set by providing a set of @@ -2640,11 +2666,13 @@ def sample_create_annotation_spec_set(): def get_annotation_spec_set( self, - request: Union[data_labeling_service.GetAnnotationSpecSetRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.GetAnnotationSpecSetRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> annotation_spec_set.AnnotationSpecSet: r"""Gets an annotation spec set by resource name. @@ -2746,14 +2774,14 @@ def sample_get_annotation_spec_set(): def list_annotation_spec_sets( self, - request: Union[ - data_labeling_service.ListAnnotationSpecSetsRequest, dict + request: Optional[ + Union[data_labeling_service.ListAnnotationSpecSetsRequest, dict] ] = None, *, - parent: str = None, - filter: str = None, + parent: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListAnnotationSpecSetsPager: r"""Lists annotation spec sets for a project. Pagination @@ -2876,13 +2904,13 @@ def sample_list_annotation_spec_sets(): def delete_annotation_spec_set( self, - request: Union[ - data_labeling_service.DeleteAnnotationSpecSetRequest, dict + request: Optional[ + Union[data_labeling_service.DeleteAnnotationSpecSetRequest, dict] ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an annotation spec set by resource name. @@ -2972,12 +3000,14 @@ def sample_delete_annotation_spec_set(): def create_instruction( self, - request: Union[data_labeling_service.CreateInstructionRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.CreateInstructionRequest, dict] + ] = None, *, - parent: str = None, - instruction: gcd_instruction.Instruction = None, + parent: Optional[str] = None, + instruction: Optional[gcd_instruction.Instruction] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Creates an instruction for how data should be @@ -3099,11 +3129,13 @@ def sample_create_instruction(): def get_instruction( self, - request: Union[data_labeling_service.GetInstructionRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.GetInstructionRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> instruction.Instruction: r"""Gets an instruction by resource name. @@ -3202,12 +3234,14 @@ def sample_get_instruction(): def list_instructions( self, - request: Union[data_labeling_service.ListInstructionsRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.ListInstructionsRequest, dict] + ] = None, *, - parent: str = None, - filter: str = None, + parent: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListInstructionsPager: r"""Lists instructions for a project. Pagination is @@ -3328,11 +3362,13 @@ def sample_list_instructions(): def delete_instruction( self, - request: Union[data_labeling_service.DeleteInstructionRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.DeleteInstructionRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Deletes an instruction object by resource name. @@ -3418,11 +3454,13 @@ def sample_delete_instruction(): def get_evaluation( self, - request: Union[data_labeling_service.GetEvaluationRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.GetEvaluationRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> evaluation.Evaluation: r"""Gets an evaluation by resource name (to search, use @@ -3523,12 +3561,14 @@ def sample_get_evaluation(): def search_evaluations( self, - request: Union[data_labeling_service.SearchEvaluationsRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.SearchEvaluationsRequest, dict] + ] = None, *, - parent: str = None, - filter: str = None, + parent: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.SearchEvaluationsPager: r"""Searches @@ -3680,13 +3720,13 @@ def sample_search_evaluations(): def search_example_comparisons( self, - request: Union[ - data_labeling_service.SearchExampleComparisonsRequest, dict + request: Optional[ + Union[data_labeling_service.SearchExampleComparisonsRequest, dict] ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.SearchExampleComparisonsPager: r"""Searches example comparisons from an evaluation. The @@ -3807,12 +3847,14 @@ def sample_search_example_comparisons(): def create_evaluation_job( self, - request: Union[data_labeling_service.CreateEvaluationJobRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.CreateEvaluationJobRequest, dict] + ] = None, *, - parent: str = None, - job: evaluation_job.EvaluationJob = None, + parent: Optional[str] = None, + job: Optional[evaluation_job.EvaluationJob] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> evaluation_job.EvaluationJob: r"""Creates an evaluation job. @@ -3923,12 +3965,14 @@ def sample_create_evaluation_job(): def update_evaluation_job( self, - request: Union[data_labeling_service.UpdateEvaluationJobRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.UpdateEvaluationJobRequest, dict] + ] = None, *, - evaluation_job: gcd_evaluation_job.EvaluationJob = None, - update_mask: field_mask_pb2.FieldMask = None, + evaluation_job: Optional[gcd_evaluation_job.EvaluationJob] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gcd_evaluation_job.EvaluationJob: r"""Updates an evaluation job. You can only update certain fields of @@ -4054,11 +4098,13 @@ def sample_update_evaluation_job(): def get_evaluation_job( self, - request: Union[data_labeling_service.GetEvaluationJobRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.GetEvaluationJobRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> evaluation_job.EvaluationJob: r"""Gets an evaluation job by resource name. @@ -4161,11 +4207,13 @@ def sample_get_evaluation_job(): def pause_evaluation_job( self, - request: Union[data_labeling_service.PauseEvaluationJobRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.PauseEvaluationJobRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Pauses an evaluation job. Pausing an evaluation job that is @@ -4254,11 +4302,13 @@ def sample_pause_evaluation_job(): def resume_evaluation_job( self, - request: Union[data_labeling_service.ResumeEvaluationJobRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.ResumeEvaluationJobRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Resumes a paused evaluation job. A deleted evaluation @@ -4347,11 +4397,13 @@ def sample_resume_evaluation_job(): def delete_evaluation_job( self, - request: Union[data_labeling_service.DeleteEvaluationJobRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.DeleteEvaluationJobRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Stops and deletes an evaluation job. @@ -4438,12 +4490,14 @@ def sample_delete_evaluation_job(): def list_evaluation_jobs( self, - request: Union[data_labeling_service.ListEvaluationJobsRequest, dict] = None, + request: Optional[ + Union[data_labeling_service.ListEvaluationJobsRequest, dict] + ] = None, *, - parent: str = None, - filter: str = None, + parent: Optional[str] = None, + filter: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListEvaluationJobsPager: r"""Lists all evaluation jobs within a project with diff --git a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/base.py b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/base.py index 5144ab12e5f1..815dac2e6082 100644 --- a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/base.py +++ b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/base.py @@ -60,7 +60,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/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc.py b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc.py index 89e1cfb2c437..579af8a92727 100644 --- a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc.py +++ b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc.py @@ -58,14 +58,14 @@ def __init__( self, *, host: str = "datalabeling.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, @@ -193,8 +193,8 @@ def __init__( def create_channel( cls, host: str = "datalabeling.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/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc_asyncio.py b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc_asyncio.py index 514b4ae71e46..51f9a1d81e2a 100644 --- a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc_asyncio.py +++ b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc_asyncio.py @@ -60,7 +60,7 @@ class DataLabelingServiceGrpcAsyncIOTransport(DataLabelingServiceTransport): def create_channel( cls, host: str = "datalabeling.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, @@ -103,15 +103,15 @@ def __init__( self, *, host: str = "datalabeling.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/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/annotation.py b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/annotation.py index 782e4084064f..03ee9ec662aa 100644 --- a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/annotation.py +++ b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/annotation.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import duration_pb2 # type: ignore import proto # type: ignore @@ -107,26 +109,26 @@ class Annotation(proto.Message): Output only. Sentiment for this annotation. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - annotation_source = proto.Field( + annotation_source: "AnnotationSource" = proto.Field( proto.ENUM, number=2, enum="AnnotationSource", ) - annotation_value = proto.Field( + annotation_value: "AnnotationValue" = proto.Field( proto.MESSAGE, number=3, message="AnnotationValue", ) - annotation_metadata = proto.Field( + annotation_metadata: "AnnotationMetadata" = proto.Field( proto.MESSAGE, number=4, message="AnnotationMetadata", ) - annotation_sentiment = proto.Field( + annotation_sentiment: "AnnotationSentiment" = proto.Field( proto.ENUM, number=6, enum="AnnotationSentiment", @@ -192,55 +194,55 @@ class AnnotationValue(proto.Message): This field is a member of `oneof`_ ``value_type``. """ - image_classification_annotation = proto.Field( + image_classification_annotation: "ImageClassificationAnnotation" = proto.Field( proto.MESSAGE, number=1, oneof="value_type", message="ImageClassificationAnnotation", ) - image_bounding_poly_annotation = proto.Field( + image_bounding_poly_annotation: "ImageBoundingPolyAnnotation" = proto.Field( proto.MESSAGE, number=2, oneof="value_type", message="ImageBoundingPolyAnnotation", ) - image_polyline_annotation = proto.Field( + image_polyline_annotation: "ImagePolylineAnnotation" = proto.Field( proto.MESSAGE, number=8, oneof="value_type", message="ImagePolylineAnnotation", ) - image_segmentation_annotation = proto.Field( + image_segmentation_annotation: "ImageSegmentationAnnotation" = proto.Field( proto.MESSAGE, number=9, oneof="value_type", message="ImageSegmentationAnnotation", ) - text_classification_annotation = proto.Field( + text_classification_annotation: "TextClassificationAnnotation" = proto.Field( proto.MESSAGE, number=3, oneof="value_type", message="TextClassificationAnnotation", ) - text_entity_extraction_annotation = proto.Field( + text_entity_extraction_annotation: "TextEntityExtractionAnnotation" = proto.Field( proto.MESSAGE, number=10, oneof="value_type", message="TextEntityExtractionAnnotation", ) - video_classification_annotation = proto.Field( + video_classification_annotation: "VideoClassificationAnnotation" = proto.Field( proto.MESSAGE, number=4, oneof="value_type", message="VideoClassificationAnnotation", ) - video_object_tracking_annotation = proto.Field( + video_object_tracking_annotation: "VideoObjectTrackingAnnotation" = proto.Field( proto.MESSAGE, number=5, oneof="value_type", message="VideoObjectTrackingAnnotation", ) - video_event_annotation = proto.Field( + video_event_annotation: "VideoEventAnnotation" = proto.Field( proto.MESSAGE, number=6, oneof="value_type", @@ -256,7 +258,7 @@ class ImageClassificationAnnotation(proto.Message): Label of image. """ - annotation_spec = proto.Field( + annotation_spec: annotation_spec_set.AnnotationSpec = proto.Field( proto.MESSAGE, number=1, message=annotation_spec_set.AnnotationSpec, @@ -275,11 +277,11 @@ class Vertex(proto.Message): Y coordinate. """ - x = proto.Field( + x: int = proto.Field( proto.INT32, number=1, ) - y = proto.Field( + y: int = proto.Field( proto.INT32, number=2, ) @@ -297,11 +299,11 @@ class NormalizedVertex(proto.Message): Y coordinate. """ - x = proto.Field( + x: float = proto.Field( proto.FLOAT, number=1, ) - y = proto.Field( + y: float = proto.Field( proto.FLOAT, number=2, ) @@ -311,11 +313,11 @@ class BoundingPoly(proto.Message): r"""A bounding polygon in the image. Attributes: - vertices (Sequence[google.cloud.datalabeling_v1beta1.types.Vertex]): + vertices (MutableSequence[google.cloud.datalabeling_v1beta1.types.Vertex]): The bounding polygon vertices. """ - vertices = proto.RepeatedField( + vertices: MutableSequence["Vertex"] = proto.RepeatedField( proto.MESSAGE, number=1, message="Vertex", @@ -326,11 +328,11 @@ class NormalizedBoundingPoly(proto.Message): r"""Normalized bounding polygon. Attributes: - normalized_vertices (Sequence[google.cloud.datalabeling_v1beta1.types.NormalizedVertex]): + normalized_vertices (MutableSequence[google.cloud.datalabeling_v1beta1.types.NormalizedVertex]): The bounding polygon normalized vertices. """ - normalized_vertices = proto.RepeatedField( + normalized_vertices: MutableSequence["NormalizedVertex"] = proto.RepeatedField( proto.MESSAGE, number=1, message="NormalizedVertex", @@ -359,19 +361,19 @@ class ImageBoundingPolyAnnotation(proto.Message): Label of object in this bounding polygon. """ - bounding_poly = proto.Field( + bounding_poly: "BoundingPoly" = proto.Field( proto.MESSAGE, number=2, oneof="bounded_area", message="BoundingPoly", ) - normalized_bounding_poly = proto.Field( + normalized_bounding_poly: "NormalizedBoundingPoly" = proto.Field( proto.MESSAGE, number=3, oneof="bounded_area", message="NormalizedBoundingPoly", ) - annotation_spec = proto.Field( + annotation_spec: annotation_spec_set.AnnotationSpec = proto.Field( proto.MESSAGE, number=1, message=annotation_spec_set.AnnotationSpec, @@ -382,11 +384,11 @@ class Polyline(proto.Message): r"""A line with multiple line segments. Attributes: - vertices (Sequence[google.cloud.datalabeling_v1beta1.types.Vertex]): + vertices (MutableSequence[google.cloud.datalabeling_v1beta1.types.Vertex]): The polyline vertices. """ - vertices = proto.RepeatedField( + vertices: MutableSequence["Vertex"] = proto.RepeatedField( proto.MESSAGE, number=1, message="Vertex", @@ -397,11 +399,11 @@ class NormalizedPolyline(proto.Message): r"""Normalized polyline. Attributes: - normalized_vertices (Sequence[google.cloud.datalabeling_v1beta1.types.NormalizedVertex]): + normalized_vertices (MutableSequence[google.cloud.datalabeling_v1beta1.types.NormalizedVertex]): The normalized polyline vertices. """ - normalized_vertices = proto.RepeatedField( + normalized_vertices: MutableSequence["NormalizedVertex"] = proto.RepeatedField( proto.MESSAGE, number=1, message="NormalizedVertex", @@ -429,19 +431,19 @@ class ImagePolylineAnnotation(proto.Message): Label of this polyline. """ - polyline = proto.Field( + polyline: "Polyline" = proto.Field( proto.MESSAGE, number=2, oneof="poly", message="Polyline", ) - normalized_polyline = proto.Field( + normalized_polyline: "NormalizedPolyline" = proto.Field( proto.MESSAGE, number=3, oneof="poly", message="NormalizedPolyline", ) - annotation_spec = proto.Field( + annotation_spec: annotation_spec_set.AnnotationSpec = proto.Field( proto.MESSAGE, number=1, message=annotation_spec_set.AnnotationSpec, @@ -452,7 +454,7 @@ class ImageSegmentationAnnotation(proto.Message): r"""Image segmentation annotation. Attributes: - annotation_colors (Mapping[str, google.cloud.datalabeling_v1beta1.types.AnnotationSpec]): + annotation_colors (MutableMapping[str, google.cloud.datalabeling_v1beta1.types.AnnotationSpec]): The mapping between rgb color and annotation spec. The key is the rgb color represented in format of rgb(0, 0, 0). The value is the @@ -463,17 +465,19 @@ class ImageSegmentationAnnotation(proto.Message): A byte string of a full image's color map. """ - annotation_colors = proto.MapField( + annotation_colors: MutableMapping[ + str, annotation_spec_set.AnnotationSpec + ] = proto.MapField( proto.STRING, proto.MESSAGE, number=1, message=annotation_spec_set.AnnotationSpec, ) - mime_type = proto.Field( + mime_type: str = proto.Field( proto.STRING, number=2, ) - image_bytes = proto.Field( + image_bytes: bytes = proto.Field( proto.BYTES, number=3, ) @@ -487,7 +491,7 @@ class TextClassificationAnnotation(proto.Message): Label of the text. """ - annotation_spec = proto.Field( + annotation_spec: annotation_spec_set.AnnotationSpec = proto.Field( proto.MESSAGE, number=1, message=annotation_spec_set.AnnotationSpec, @@ -504,12 +508,12 @@ class TextEntityExtractionAnnotation(proto.Message): Position of the entity. """ - annotation_spec = proto.Field( + annotation_spec: annotation_spec_set.AnnotationSpec = proto.Field( proto.MESSAGE, number=1, message=annotation_spec_set.AnnotationSpec, ) - sequential_segment = proto.Field( + sequential_segment: "SequentialSegment" = proto.Field( proto.MESSAGE, number=2, message="SequentialSegment", @@ -526,11 +530,11 @@ class SequentialSegment(proto.Message): End position (exclusive). """ - start = proto.Field( + start: int = proto.Field( proto.INT32, number=1, ) - end = proto.Field( + end: int = proto.Field( proto.INT32, number=2, ) @@ -551,12 +555,12 @@ class TimeSegment(proto.Message): start. """ - start_time_offset = proto.Field( + start_time_offset: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=1, message=duration_pb2.Duration, ) - end_time_offset = proto.Field( + end_time_offset: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=2, message=duration_pb2.Duration, @@ -574,12 +578,12 @@ class VideoClassificationAnnotation(proto.Message): Label of the segment specified by time_segment. """ - time_segment = proto.Field( + time_segment: "TimeSegment" = proto.Field( proto.MESSAGE, number=1, message="TimeSegment", ) - annotation_spec = proto.Field( + annotation_spec: annotation_spec_set.AnnotationSpec = proto.Field( proto.MESSAGE, number=2, message=annotation_spec_set.AnnotationSpec, @@ -609,19 +613,19 @@ class ObjectTrackingFrame(proto.Message): beginning of the video. """ - bounding_poly = proto.Field( + bounding_poly: "BoundingPoly" = proto.Field( proto.MESSAGE, number=1, oneof="bounded_area", message="BoundingPoly", ) - normalized_bounding_poly = proto.Field( + normalized_bounding_poly: "NormalizedBoundingPoly" = proto.Field( proto.MESSAGE, number=2, oneof="bounded_area", message="NormalizedBoundingPoly", ) - time_offset = proto.Field( + time_offset: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=3, message=duration_pb2.Duration, @@ -638,22 +642,24 @@ class VideoObjectTrackingAnnotation(proto.Message): time_segment (google.cloud.datalabeling_v1beta1.types.TimeSegment): The time segment of the video to which object tracking applies. - object_tracking_frames (Sequence[google.cloud.datalabeling_v1beta1.types.ObjectTrackingFrame]): + object_tracking_frames (MutableSequence[google.cloud.datalabeling_v1beta1.types.ObjectTrackingFrame]): The list of frames where this object track appears. """ - annotation_spec = proto.Field( + annotation_spec: annotation_spec_set.AnnotationSpec = proto.Field( proto.MESSAGE, number=1, message=annotation_spec_set.AnnotationSpec, ) - time_segment = proto.Field( + time_segment: "TimeSegment" = proto.Field( proto.MESSAGE, number=2, message="TimeSegment", ) - object_tracking_frames = proto.RepeatedField( + object_tracking_frames: MutableSequence[ + "ObjectTrackingFrame" + ] = proto.RepeatedField( proto.MESSAGE, number=3, message="ObjectTrackingFrame", @@ -671,12 +677,12 @@ class VideoEventAnnotation(proto.Message): annotation applies. """ - annotation_spec = proto.Field( + annotation_spec: annotation_spec_set.AnnotationSpec = proto.Field( proto.MESSAGE, number=1, message=annotation_spec_set.AnnotationSpec, ) - time_segment = proto.Field( + time_segment: "TimeSegment" = proto.Field( proto.MESSAGE, number=2, message="TimeSegment", @@ -691,7 +697,7 @@ class AnnotationMetadata(proto.Message): Metadata related to human labeling. """ - operator_metadata = proto.Field( + operator_metadata: "OperatorMetadata" = proto.Field( proto.MESSAGE, number=2, message="OperatorMetadata", @@ -714,23 +720,23 @@ class OperatorMetadata(proto.Message): label_votes (int): The total number of contributors that choose this label. - comments (Sequence[str]): + comments (MutableSequence[str]): Comments from contributors. """ - score = proto.Field( + score: float = proto.Field( proto.FLOAT, number=1, ) - total_votes = proto.Field( + total_votes: int = proto.Field( proto.INT32, number=2, ) - label_votes = proto.Field( + label_votes: int = proto.Field( proto.INT32, number=3, ) - comments = proto.RepeatedField( + comments: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=4, ) diff --git a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/annotation_spec_set.py b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/annotation_spec_set.py index 424ee370d69c..3eba4f8c3cc0 100644 --- a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/annotation_spec_set.py +++ b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/annotation_spec_set.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 __protobuf__ = proto.module( @@ -44,35 +46,35 @@ class AnnotationSpecSet(proto.Message): Optional. User-provided description of the annotation specification set. The description can be up to 10,000 characters long. - annotation_specs (Sequence[google.cloud.datalabeling_v1beta1.types.AnnotationSpec]): + annotation_specs (MutableSequence[google.cloud.datalabeling_v1beta1.types.AnnotationSpec]): Required. The array of AnnotationSpecs that you define when you create the AnnotationSpecSet. These are the possible labels for the labeling task. - blocking_resources (Sequence[str]): + blocking_resources (MutableSequence[str]): Output only. The names of any related resources that are blocking changes to the annotation spec set. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - display_name = proto.Field( + display_name: str = proto.Field( proto.STRING, number=2, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=3, ) - annotation_specs = proto.RepeatedField( + annotation_specs: MutableSequence["AnnotationSpec"] = proto.RepeatedField( proto.MESSAGE, number=4, message="AnnotationSpec", ) - blocking_resources = proto.RepeatedField( + blocking_resources: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=5, ) @@ -94,11 +96,11 @@ class AnnotationSpec(proto.Message): up to 10,000 characters long. """ - display_name = proto.Field( + display_name: str = proto.Field( proto.STRING, number=1, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=2, ) diff --git a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/data_labeling_service.py b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/data_labeling_service.py index 26bf382adc91..bc159bd8c00b 100644 --- a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/data_labeling_service.py +++ b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/data_labeling_service.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import field_mask_pb2 # type: ignore import proto # type: ignore @@ -86,11 +88,11 @@ class CreateDatasetRequest(proto.Message): Required. The dataset to be created. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - dataset = proto.Field( + dataset: gcd_dataset.Dataset = proto.Field( proto.MESSAGE, number=2, message=gcd_dataset.Dataset, @@ -106,7 +108,7 @@ class GetDatasetRequest(proto.Message): projects/{project_id}/datasets/{dataset_id} """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -134,19 +136,19 @@ class ListDatasetsRequest(proto.Message): Returns the first page if empty. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=4, ) @@ -156,7 +158,7 @@ class ListDatasetsResponse(proto.Message): r"""Results of listing datasets within a project. Attributes: - datasets (Sequence[google.cloud.datalabeling_v1beta1.types.Dataset]): + datasets (MutableSequence[google.cloud.datalabeling_v1beta1.types.Dataset]): The list of datasets to return. next_page_token (str): A token to retrieve next page of results. @@ -166,12 +168,12 @@ class ListDatasetsResponse(proto.Message): def raw_page(self): return self - datasets = proto.RepeatedField( + datasets: MutableSequence[gcd_dataset.Dataset] = proto.RepeatedField( proto.MESSAGE, number=1, message=gcd_dataset.Dataset, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -186,7 +188,7 @@ class DeleteDatasetRequest(proto.Message): projects/{project_id}/datasets/{dataset_id} """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -208,16 +210,16 @@ class ImportDataRequest(proto.Message): notification will be sent. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - input_config = proto.Field( + input_config: gcd_dataset.InputConfig = proto.Field( proto.MESSAGE, number=2, message=gcd_dataset.InputConfig, ) - user_email_address = proto.Field( + user_email_address: str = proto.Field( proto.STRING, number=3, ) @@ -247,24 +249,24 @@ class ExportDataRequest(proto.Message): notification will be sent. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - annotated_dataset = proto.Field( + annotated_dataset: str = proto.Field( proto.STRING, number=2, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=3, ) - output_config = proto.Field( + output_config: gcd_dataset.OutputConfig = proto.Field( proto.MESSAGE, number=4, message=gcd_dataset.OutputConfig, ) - user_email_address = proto.Field( + user_email_address: str = proto.Field( proto.STRING, number=5, ) @@ -279,7 +281,7 @@ class GetDataItemRequest(proto.Message): projects/{project_id}/datasets/{dataset_id}/dataItems/{data_item_id} """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -307,19 +309,19 @@ class ListDataItemsRequest(proto.Message): Return first page if empty. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=4, ) @@ -329,7 +331,7 @@ class ListDataItemsResponse(proto.Message): r"""Results of listing data items in a dataset. Attributes: - data_items (Sequence[google.cloud.datalabeling_v1beta1.types.DataItem]): + data_items (MutableSequence[google.cloud.datalabeling_v1beta1.types.DataItem]): The list of data items to return. next_page_token (str): A token to retrieve next page of results. @@ -339,12 +341,12 @@ class ListDataItemsResponse(proto.Message): def raw_page(self): return self - data_items = proto.RepeatedField( + data_items: MutableSequence[gcd_dataset.DataItem] = proto.RepeatedField( proto.MESSAGE, number=1, message=gcd_dataset.DataItem, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -360,7 +362,7 @@ class GetAnnotatedDatasetRequest(proto.Message): {annotated_dataset_id} """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -388,19 +390,19 @@ class ListAnnotatedDatasetsRequest(proto.Message): call. Return first page if empty. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=4, ) @@ -410,7 +412,7 @@ class ListAnnotatedDatasetsResponse(proto.Message): r"""Results of listing annotated datasets for a dataset. Attributes: - annotated_datasets (Sequence[google.cloud.datalabeling_v1beta1.types.AnnotatedDataset]): + annotated_datasets (MutableSequence[google.cloud.datalabeling_v1beta1.types.AnnotatedDataset]): The list of annotated datasets to return. next_page_token (str): A token to retrieve next page of results. @@ -420,12 +422,14 @@ class ListAnnotatedDatasetsResponse(proto.Message): def raw_page(self): return self - annotated_datasets = proto.RepeatedField( + annotated_datasets: MutableSequence[ + gcd_dataset.AnnotatedDataset + ] = proto.RepeatedField( proto.MESSAGE, number=1, message=gcd_dataset.AnnotatedDataset, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -441,7 +445,7 @@ class DeleteAnnotatedDatasetRequest(proto.Message): {annotated_dataset_id} """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -501,40 +505,42 @@ class Feature(proto.Enum): POLYLINE = 4 SEGMENTATION = 5 - image_classification_config = proto.Field( - proto.MESSAGE, - number=4, - oneof="request_config", - message=human_annotation_config.ImageClassificationConfig, + image_classification_config: human_annotation_config.ImageClassificationConfig = ( + proto.Field( + proto.MESSAGE, + number=4, + oneof="request_config", + message=human_annotation_config.ImageClassificationConfig, + ) ) - bounding_poly_config = proto.Field( + bounding_poly_config: human_annotation_config.BoundingPolyConfig = proto.Field( proto.MESSAGE, number=5, oneof="request_config", message=human_annotation_config.BoundingPolyConfig, ) - polyline_config = proto.Field( + polyline_config: human_annotation_config.PolylineConfig = proto.Field( proto.MESSAGE, number=6, oneof="request_config", message=human_annotation_config.PolylineConfig, ) - segmentation_config = proto.Field( + segmentation_config: human_annotation_config.SegmentationConfig = proto.Field( proto.MESSAGE, number=7, oneof="request_config", message=human_annotation_config.SegmentationConfig, ) - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - basic_config = proto.Field( + basic_config: human_annotation_config.HumanAnnotationConfig = proto.Field( proto.MESSAGE, number=2, message=human_annotation_config.HumanAnnotationConfig, ) - feature = proto.Field( + feature: Feature = proto.Field( proto.ENUM, number=3, enum=Feature, @@ -593,40 +599,44 @@ class Feature(proto.Enum): OBJECT_TRACKING = 3 EVENT = 4 - video_classification_config = proto.Field( - proto.MESSAGE, - number=4, - oneof="request_config", - message=human_annotation_config.VideoClassificationConfig, + video_classification_config: human_annotation_config.VideoClassificationConfig = ( + proto.Field( + proto.MESSAGE, + number=4, + oneof="request_config", + message=human_annotation_config.VideoClassificationConfig, + ) ) - object_detection_config = proto.Field( - proto.MESSAGE, - number=5, - oneof="request_config", - message=human_annotation_config.ObjectDetectionConfig, + object_detection_config: human_annotation_config.ObjectDetectionConfig = ( + proto.Field( + proto.MESSAGE, + number=5, + oneof="request_config", + message=human_annotation_config.ObjectDetectionConfig, + ) ) - object_tracking_config = proto.Field( + object_tracking_config: human_annotation_config.ObjectTrackingConfig = proto.Field( proto.MESSAGE, number=6, oneof="request_config", message=human_annotation_config.ObjectTrackingConfig, ) - event_config = proto.Field( + event_config: human_annotation_config.EventConfig = proto.Field( proto.MESSAGE, number=7, oneof="request_config", message=human_annotation_config.EventConfig, ) - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - basic_config = proto.Field( + basic_config: human_annotation_config.HumanAnnotationConfig = proto.Field( proto.MESSAGE, number=2, message=human_annotation_config.HumanAnnotationConfig, ) - feature = proto.Field( + feature: Feature = proto.Field( proto.ENUM, number=3, enum=Feature, @@ -671,28 +681,30 @@ class Feature(proto.Enum): TEXT_CLASSIFICATION = 1 TEXT_ENTITY_EXTRACTION = 2 - text_classification_config = proto.Field( - proto.MESSAGE, - number=4, - oneof="request_config", - message=human_annotation_config.TextClassificationConfig, + text_classification_config: human_annotation_config.TextClassificationConfig = ( + proto.Field( + proto.MESSAGE, + number=4, + oneof="request_config", + message=human_annotation_config.TextClassificationConfig, + ) ) - text_entity_extraction_config = proto.Field( + text_entity_extraction_config: human_annotation_config.TextEntityExtractionConfig = proto.Field( proto.MESSAGE, number=5, oneof="request_config", message=human_annotation_config.TextEntityExtractionConfig, ) - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - basic_config = proto.Field( + basic_config: human_annotation_config.HumanAnnotationConfig = proto.Field( proto.MESSAGE, number=2, message=human_annotation_config.HumanAnnotationConfig, ) - feature = proto.Field( + feature: Feature = proto.Field( proto.ENUM, number=6, enum=Feature, @@ -713,11 +725,11 @@ class GetExampleRequest(proto.Message): "annotation_spec.display_name = {display_name}". """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=2, ) @@ -746,19 +758,19 @@ class ListExamplesRequest(proto.Message): Return first page if empty. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=4, ) @@ -768,7 +780,7 @@ class ListExamplesResponse(proto.Message): r"""Results of listing Examples in and annotated dataset. Attributes: - examples (Sequence[google.cloud.datalabeling_v1beta1.types.Example]): + examples (MutableSequence[google.cloud.datalabeling_v1beta1.types.Example]): The list of examples to return. next_page_token (str): A token to retrieve next page of results. @@ -778,12 +790,12 @@ class ListExamplesResponse(proto.Message): def raw_page(self): return self - examples = proto.RepeatedField( + examples: MutableSequence[gcd_dataset.Example] = proto.RepeatedField( proto.MESSAGE, number=1, message=gcd_dataset.Example, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -802,11 +814,11 @@ class CreateAnnotationSpecSetRequest(proto.Message): for annotation specs with same display_name. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - annotation_spec_set = proto.Field( + annotation_spec_set: gcd_annotation_spec_set.AnnotationSpecSet = proto.Field( proto.MESSAGE, number=2, message=gcd_annotation_spec_set.AnnotationSpecSet, @@ -822,7 +834,7 @@ class GetAnnotationSpecSetRequest(proto.Message): projects/{project_id}/annotationSpecSets/{annotation_spec_set_id} """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -850,19 +862,19 @@ class ListAnnotationSpecSetsRequest(proto.Message): call. Return first page if empty. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=4, ) @@ -872,7 +884,7 @@ class ListAnnotationSpecSetsResponse(proto.Message): r"""Results of listing annotation spec set under a project. Attributes: - annotation_spec_sets (Sequence[google.cloud.datalabeling_v1beta1.types.AnnotationSpecSet]): + annotation_spec_sets (MutableSequence[google.cloud.datalabeling_v1beta1.types.AnnotationSpecSet]): The list of annotation spec sets. next_page_token (str): A token to retrieve next page of results. @@ -882,12 +894,14 @@ class ListAnnotationSpecSetsResponse(proto.Message): def raw_page(self): return self - annotation_spec_sets = proto.RepeatedField( + annotation_spec_sets: MutableSequence[ + gcd_annotation_spec_set.AnnotationSpecSet + ] = proto.RepeatedField( proto.MESSAGE, number=1, message=gcd_annotation_spec_set.AnnotationSpecSet, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -902,7 +916,7 @@ class DeleteAnnotationSpecSetRequest(proto.Message): ``projects/{project_id}/annotationSpecSets/{annotation_spec_set_id}``. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -920,11 +934,11 @@ class CreateInstructionRequest(proto.Message): labeling task. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - instruction = proto.Field( + instruction: gcd_instruction.Instruction = proto.Field( proto.MESSAGE, number=2, message=gcd_instruction.Instruction, @@ -940,7 +954,7 @@ class GetInstructionRequest(proto.Message): projects/{project_id}/instructions/{instruction_id} """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -955,7 +969,7 @@ class DeleteInstructionRequest(proto.Message): projects/{project_id}/instructions/{instruction_id} """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -983,19 +997,19 @@ class ListInstructionsRequest(proto.Message): Return first page if empty. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=4, ) @@ -1005,7 +1019,7 @@ class ListInstructionsResponse(proto.Message): r"""Results of listing instructions under a project. Attributes: - instructions (Sequence[google.cloud.datalabeling_v1beta1.types.Instruction]): + instructions (MutableSequence[google.cloud.datalabeling_v1beta1.types.Instruction]): The list of Instructions to return. next_page_token (str): A token to retrieve next page of results. @@ -1015,12 +1029,12 @@ class ListInstructionsResponse(proto.Message): def raw_page(self): return self - instructions = proto.RepeatedField( + instructions: MutableSequence[gcd_instruction.Instruction] = proto.RepeatedField( proto.MESSAGE, number=1, message=gcd_instruction.Instruction, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -1036,7 +1050,7 @@ class GetEvaluationRequest(proto.Message): "projects/{project_id}/datasets/{dataset_id}/evaluations/{evaluation_id}' """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -1095,19 +1109,19 @@ class SearchEvaluationsRequest(proto.Message): first page of the search. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=4, ) @@ -1117,7 +1131,7 @@ class SearchEvaluationsResponse(proto.Message): r"""Results of searching evaluations. Attributes: - evaluations (Sequence[google.cloud.datalabeling_v1beta1.types.Evaluation]): + evaluations (MutableSequence[google.cloud.datalabeling_v1beta1.types.Evaluation]): The list of evaluations matching the search. next_page_token (str): A token to retrieve next page of results. @@ -1127,12 +1141,12 @@ class SearchEvaluationsResponse(proto.Message): def raw_page(self): return self - evaluations = proto.RepeatedField( + evaluations: MutableSequence[evaluation.Evaluation] = proto.RepeatedField( proto.MESSAGE, number=1, message=evaluation.Evaluation, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -1162,15 +1176,15 @@ class SearchExampleComparisonsRequest(proto.Message): first page of the search. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) @@ -1180,7 +1194,7 @@ class SearchExampleComparisonsResponse(proto.Message): r"""Results of searching example comparisons. Attributes: - example_comparisons (Sequence[google.cloud.datalabeling_v1beta1.types.SearchExampleComparisonsResponse.ExampleComparison]): + example_comparisons (MutableSequence[google.cloud.datalabeling_v1beta1.types.SearchExampleComparisonsResponse.ExampleComparison]): A list of example comparisons matching the search criteria. next_page_token (str): @@ -1194,16 +1208,18 @@ class ExampleComparison(proto.Message): Attributes: ground_truth_example (google.cloud.datalabeling_v1beta1.types.Example): The ground truth output for the input. - model_created_examples (Sequence[google.cloud.datalabeling_v1beta1.types.Example]): + model_created_examples (MutableSequence[google.cloud.datalabeling_v1beta1.types.Example]): Predictions by the model for the input. """ - ground_truth_example = proto.Field( + ground_truth_example: gcd_dataset.Example = proto.Field( proto.MESSAGE, number=1, message=gcd_dataset.Example, ) - model_created_examples = proto.RepeatedField( + model_created_examples: MutableSequence[ + gcd_dataset.Example + ] = proto.RepeatedField( proto.MESSAGE, number=2, message=gcd_dataset.Example, @@ -1213,12 +1229,12 @@ class ExampleComparison(proto.Message): def raw_page(self): return self - example_comparisons = proto.RepeatedField( + example_comparisons: MutableSequence[ExampleComparison] = proto.RepeatedField( proto.MESSAGE, number=1, message=ExampleComparison, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -1235,11 +1251,11 @@ class CreateEvaluationJobRequest(proto.Message): Required. The evaluation job to create. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - job = proto.Field( + job: gcd_evaluation_job.EvaluationJob = proto.Field( proto.MESSAGE, number=2, message=gcd_evaluation_job.EvaluationJob, @@ -1265,12 +1281,12 @@ class UpdateEvaluationJobRequest(proto.Message): them with commas. """ - evaluation_job = proto.Field( + evaluation_job: gcd_evaluation_job.EvaluationJob = proto.Field( proto.MESSAGE, number=1, message=gcd_evaluation_job.EvaluationJob, ) - update_mask = proto.Field( + update_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, @@ -1287,7 +1303,7 @@ class GetEvaluationJobRequest(proto.Message): "projects/{project_id}/evaluationJobs/{evaluation_job_id}". """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -1304,7 +1320,7 @@ class PauseEvaluationJobRequest(proto.Message): "projects/{project_id}/evaluationJobs/{evaluation_job_id}". """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -1321,7 +1337,7 @@ class ResumeEvaluationJobRequest(proto.Message): "projects/{project_id}/evaluationJobs/{evaluation_job_id}". """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -1338,7 +1354,7 @@ class DeleteEvaluationJobRequest(proto.Message): "projects/{project_id}/evaluationJobs/{evaluation_job_id}". """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -1374,19 +1390,19 @@ class ListEvaluationJobsRequest(proto.Message): the first page if this is empty. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - filter = proto.Field( + filter: str = proto.Field( proto.STRING, number=2, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=3, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=4, ) @@ -1396,7 +1412,7 @@ class ListEvaluationJobsResponse(proto.Message): r"""Results for listing evaluation jobs. Attributes: - evaluation_jobs (Sequence[google.cloud.datalabeling_v1beta1.types.EvaluationJob]): + evaluation_jobs (MutableSequence[google.cloud.datalabeling_v1beta1.types.EvaluationJob]): The list of evaluation jobs to return. next_page_token (str): A token to retrieve next page of results. @@ -1406,12 +1422,14 @@ class ListEvaluationJobsResponse(proto.Message): def raw_page(self): return self - evaluation_jobs = proto.RepeatedField( + evaluation_jobs: MutableSequence[ + gcd_evaluation_job.EvaluationJob + ] = proto.RepeatedField( proto.MESSAGE, number=1, message=gcd_evaluation_job.EvaluationJob, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) diff --git a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/data_payloads.py b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/data_payloads.py index f4f7e3f8b624..8e9ea0d721b0 100644 --- a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/data_payloads.py +++ b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/data_payloads.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import duration_pb2 # type: ignore import proto # type: ignore @@ -42,19 +44,19 @@ class ImagePayload(proto.Message): bucket. """ - mime_type = proto.Field( + mime_type: str = proto.Field( proto.STRING, number=1, ) - image_thumbnail = proto.Field( + image_thumbnail: bytes = proto.Field( proto.BYTES, number=2, ) - image_uri = proto.Field( + image_uri: str = proto.Field( proto.STRING, number=3, ) - signed_uri = proto.Field( + signed_uri: str = proto.Field( proto.STRING, number=4, ) @@ -68,7 +70,7 @@ class TextPayload(proto.Message): Text content. """ - text_content = proto.Field( + text_content: str = proto.Field( proto.STRING, number=1, ) @@ -86,11 +88,11 @@ class VideoThumbnail(proto.Message): the thumbnail has been extracted from. """ - thumbnail = proto.Field( + thumbnail: bytes = proto.Field( proto.BYTES, number=1, ) - time_offset = proto.Field( + time_offset: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=2, message=duration_pb2.Duration, @@ -105,7 +107,7 @@ class VideoPayload(proto.Message): Video format. video_uri (str): Video uri from the user bucket. - video_thumbnails (Sequence[google.cloud.datalabeling_v1beta1.types.VideoThumbnail]): + video_thumbnails (MutableSequence[google.cloud.datalabeling_v1beta1.types.VideoThumbnail]): The list of video thumbnails. frame_rate (float): FPS of the video. @@ -114,24 +116,24 @@ class VideoPayload(proto.Message): bucket. """ - mime_type = proto.Field( + mime_type: str = proto.Field( proto.STRING, number=1, ) - video_uri = proto.Field( + video_uri: str = proto.Field( proto.STRING, number=2, ) - video_thumbnails = proto.RepeatedField( + video_thumbnails: MutableSequence["VideoThumbnail"] = proto.RepeatedField( proto.MESSAGE, number=3, message="VideoThumbnail", ) - frame_rate = proto.Field( + frame_rate: float = proto.Field( proto.FLOAT, number=4, ) - signed_uri = proto.Field( + signed_uri: str = proto.Field( proto.STRING, number=5, ) diff --git a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/dataset.py b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/dataset.py index 7d122182c921..c0f37fdfe39d 100644 --- a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/dataset.py +++ b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/dataset.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore @@ -70,12 +72,12 @@ class Dataset(proto.Message): can be up to 10000 characters long. create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Time the dataset is created. - input_configs (Sequence[google.cloud.datalabeling_v1beta1.types.InputConfig]): + input_configs (MutableSequence[google.cloud.datalabeling_v1beta1.types.InputConfig]): Output only. This is populated with the original input configs where ImportData is called. It is available only after the clients import data to this dataset. - blocking_resources (Sequence[str]): + blocking_resources (MutableSequence[str]): Output only. The names of any related resources that are blocking changes to the dataset. @@ -84,33 +86,33 @@ class Dataset(proto.Message): dataset. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - display_name = proto.Field( + display_name: str = proto.Field( proto.STRING, number=2, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=3, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, ) - input_configs = proto.RepeatedField( + input_configs: MutableSequence["InputConfig"] = proto.RepeatedField( proto.MESSAGE, number=5, message="InputConfig", ) - blocking_resources = proto.RepeatedField( + blocking_resources: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=6, ) - data_item_count = proto.Field( + data_item_count: int = proto.Field( proto.INT64, number=7, ) @@ -158,35 +160,35 @@ class InputConfig(proto.Message): for a model version that performs classification. """ - text_metadata = proto.Field( + text_metadata: "TextMetadata" = proto.Field( proto.MESSAGE, number=6, oneof="data_type_metadata", message="TextMetadata", ) - gcs_source = proto.Field( + gcs_source: "GcsSource" = proto.Field( proto.MESSAGE, number=2, oneof="source", message="GcsSource", ) - bigquery_source = proto.Field( + bigquery_source: "BigQuerySource" = proto.Field( proto.MESSAGE, number=5, oneof="source", message="BigQuerySource", ) - data_type = proto.Field( + data_type: "DataType" = proto.Field( proto.ENUM, number=1, enum="DataType", ) - annotation_type = proto.Field( + annotation_type: annotation.AnnotationType = proto.Field( proto.ENUM, number=3, enum=annotation.AnnotationType, ) - classification_metadata = proto.Field( + classification_metadata: "ClassificationMetadata" = proto.Field( proto.MESSAGE, number=4, message="ClassificationMetadata", @@ -203,7 +205,7 @@ class TextMetadata(proto.Message): Default value is en-US. """ - language_code = proto.Field( + language_code: str = proto.Field( proto.STRING, number=1, ) @@ -218,7 +220,7 @@ class ClassificationMetadata(proto.Message): multi-label or not. """ - is_multi_label = proto.Field( + is_multi_label: bool = proto.Field( proto.BOOL, number=1, ) @@ -236,11 +238,11 @@ class GcsSource(proto.Message): "text/csv" is supported. """ - input_uri = proto.Field( + input_uri: str = proto.Field( proto.STRING, number=1, ) - mime_type = proto.Field( + mime_type: str = proto.Field( proto.STRING, number=2, ) @@ -271,7 +273,7 @@ class BigQuerySource(proto.Message): more `__. """ - input_uri = proto.Field( + input_uri: str = proto.Field( proto.STRING, number=1, ) @@ -301,13 +303,13 @@ class OutputConfig(proto.Message): This field is a member of `oneof`_ ``destination``. """ - gcs_destination = proto.Field( + gcs_destination: "GcsDestination" = proto.Field( proto.MESSAGE, number=1, oneof="destination", message="GcsDestination", ) - gcs_folder_destination = proto.Field( + gcs_folder_destination: "GcsFolderDestination" = proto.Field( proto.MESSAGE, number=2, oneof="destination", @@ -328,11 +330,11 @@ class GcsDestination(proto.Message): are supported. """ - output_uri = proto.Field( + output_uri: str = proto.Field( proto.STRING, number=1, ) - mime_type = proto.Field( + mime_type: str = proto.Field( proto.STRING, number=2, ) @@ -347,7 +349,7 @@ class GcsFolderDestination(proto.Message): data to. """ - output_folder_uri = proto.Field( + output_folder_uri: str = proto.Field( proto.STRING, number=1, ) @@ -385,25 +387,25 @@ class DataItem(proto.Message): projects/{project_id}/datasets/{dataset_id}/dataItems/{data_item_id} """ - image_payload = proto.Field( + image_payload: data_payloads.ImagePayload = proto.Field( proto.MESSAGE, number=2, oneof="payload", message=data_payloads.ImagePayload, ) - text_payload = proto.Field( + text_payload: data_payloads.TextPayload = proto.Field( proto.MESSAGE, number=3, oneof="payload", message=data_payloads.TextPayload, ) - video_payload = proto.Field( + video_payload: data_payloads.VideoPayload = proto.Field( proto.MESSAGE, number=4, oneof="payload", message=data_payloads.VideoPayload, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -448,58 +450,58 @@ class AnnotatedDataset(proto.Message): metadata (google.cloud.datalabeling_v1beta1.types.AnnotatedDatasetMetadata): Output only. Additional information about AnnotatedDataset. - blocking_resources (Sequence[str]): + blocking_resources (MutableSequence[str]): Output only. The names of any related resources that are blocking changes to the annotated dataset. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - display_name = proto.Field( + display_name: str = proto.Field( proto.STRING, number=2, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=9, ) - annotation_source = proto.Field( + annotation_source: annotation.AnnotationSource = proto.Field( proto.ENUM, number=3, enum=annotation.AnnotationSource, ) - annotation_type = proto.Field( + annotation_type: annotation.AnnotationType = proto.Field( proto.ENUM, number=8, enum=annotation.AnnotationType, ) - example_count = proto.Field( + example_count: int = proto.Field( proto.INT64, number=4, ) - completed_example_count = proto.Field( + completed_example_count: int = proto.Field( proto.INT64, number=5, ) - label_stats = proto.Field( + label_stats: "LabelStats" = proto.Field( proto.MESSAGE, number=6, message="LabelStats", ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp, ) - metadata = proto.Field( + metadata: "AnnotatedDatasetMetadata" = proto.Field( proto.MESSAGE, number=10, message="AnnotatedDatasetMetadata", ) - blocking_resources = proto.RepeatedField( + blocking_resources: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=11, ) @@ -509,7 +511,7 @@ class LabelStats(proto.Message): r"""Statistics about annotation specs. Attributes: - example_count (Mapping[str, int]): + example_count (MutableMapping[str, int]): Map of each annotation spec's example count. Key is the annotation spec name and value is the number of examples for that annotation spec. If @@ -519,7 +521,7 @@ class LabelStats(proto.Message): annotations. """ - example_count = proto.MapField( + example_count: MutableMapping[str, int] = proto.MapField( proto.STRING, proto.INT64, number=1, @@ -586,70 +588,78 @@ class AnnotatedDatasetMetadata(proto.Message): AnnotatedDataset. """ - image_classification_config = proto.Field( + image_classification_config: gcd_human_annotation_config.ImageClassificationConfig = proto.Field( proto.MESSAGE, number=2, oneof="annotation_request_config", message=gcd_human_annotation_config.ImageClassificationConfig, ) - bounding_poly_config = proto.Field( + bounding_poly_config: gcd_human_annotation_config.BoundingPolyConfig = proto.Field( proto.MESSAGE, number=3, oneof="annotation_request_config", message=gcd_human_annotation_config.BoundingPolyConfig, ) - polyline_config = proto.Field( + polyline_config: gcd_human_annotation_config.PolylineConfig = proto.Field( proto.MESSAGE, number=4, oneof="annotation_request_config", message=gcd_human_annotation_config.PolylineConfig, ) - segmentation_config = proto.Field( + segmentation_config: gcd_human_annotation_config.SegmentationConfig = proto.Field( proto.MESSAGE, number=5, oneof="annotation_request_config", message=gcd_human_annotation_config.SegmentationConfig, ) - video_classification_config = proto.Field( + video_classification_config: gcd_human_annotation_config.VideoClassificationConfig = proto.Field( proto.MESSAGE, number=6, oneof="annotation_request_config", message=gcd_human_annotation_config.VideoClassificationConfig, ) - object_detection_config = proto.Field( - proto.MESSAGE, - number=7, - oneof="annotation_request_config", - message=gcd_human_annotation_config.ObjectDetectionConfig, - ) - object_tracking_config = proto.Field( - proto.MESSAGE, - number=8, - oneof="annotation_request_config", - message=gcd_human_annotation_config.ObjectTrackingConfig, - ) - event_config = proto.Field( + object_detection_config: gcd_human_annotation_config.ObjectDetectionConfig = ( + proto.Field( + proto.MESSAGE, + number=7, + oneof="annotation_request_config", + message=gcd_human_annotation_config.ObjectDetectionConfig, + ) + ) + object_tracking_config: gcd_human_annotation_config.ObjectTrackingConfig = ( + proto.Field( + proto.MESSAGE, + number=8, + oneof="annotation_request_config", + message=gcd_human_annotation_config.ObjectTrackingConfig, + ) + ) + event_config: gcd_human_annotation_config.EventConfig = proto.Field( proto.MESSAGE, number=9, oneof="annotation_request_config", message=gcd_human_annotation_config.EventConfig, ) - text_classification_config = proto.Field( - proto.MESSAGE, - number=10, - oneof="annotation_request_config", - message=gcd_human_annotation_config.TextClassificationConfig, + text_classification_config: gcd_human_annotation_config.TextClassificationConfig = ( + proto.Field( + proto.MESSAGE, + number=10, + oneof="annotation_request_config", + message=gcd_human_annotation_config.TextClassificationConfig, + ) ) - text_entity_extraction_config = proto.Field( + text_entity_extraction_config: gcd_human_annotation_config.TextEntityExtractionConfig = proto.Field( proto.MESSAGE, number=11, oneof="annotation_request_config", message=gcd_human_annotation_config.TextEntityExtractionConfig, ) - human_annotation_config = proto.Field( - proto.MESSAGE, - number=1, - message=gcd_human_annotation_config.HumanAnnotationConfig, + human_annotation_config: gcd_human_annotation_config.HumanAnnotationConfig = ( + proto.Field( + proto.MESSAGE, + number=1, + message=gcd_human_annotation_config.HumanAnnotationConfig, + ) ) @@ -684,35 +694,35 @@ class Example(proto.Message): Output only. Name of the example, in format of: projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/ {annotated_dataset_id}/examples/{example_id} - annotations (Sequence[google.cloud.datalabeling_v1beta1.types.Annotation]): + annotations (MutableSequence[google.cloud.datalabeling_v1beta1.types.Annotation]): Output only. Annotations for the piece of data in Example. One piece of data can have multiple annotations. """ - image_payload = proto.Field( + image_payload: data_payloads.ImagePayload = proto.Field( proto.MESSAGE, number=2, oneof="payload", message=data_payloads.ImagePayload, ) - text_payload = proto.Field( + text_payload: data_payloads.TextPayload = proto.Field( proto.MESSAGE, number=6, oneof="payload", message=data_payloads.TextPayload, ) - video_payload = proto.Field( + video_payload: data_payloads.VideoPayload = proto.Field( proto.MESSAGE, number=7, oneof="payload", message=data_payloads.VideoPayload, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - annotations = proto.RepeatedField( + annotations: MutableSequence[annotation.Annotation] = proto.RepeatedField( proto.MESSAGE, number=5, message=annotation.Annotation, diff --git a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/evaluation.py b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/evaluation.py index e524276b9be0..f1b506e15845 100644 --- a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/evaluation.py +++ b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/evaluation.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore @@ -70,36 +72,36 @@ class Evaluation(proto.Message): is for certain AnnotationTypes. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - config = proto.Field( + config: "EvaluationConfig" = proto.Field( proto.MESSAGE, number=2, message="EvaluationConfig", ) - evaluation_job_run_time = proto.Field( + evaluation_job_run_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, ) - evaluation_metrics = proto.Field( + evaluation_metrics: "EvaluationMetrics" = proto.Field( proto.MESSAGE, number=5, message="EvaluationMetrics", ) - annotation_type = proto.Field( + annotation_type: annotation.AnnotationType = proto.Field( proto.ENUM, number=6, enum=annotation.AnnotationType, ) - evaluated_item_count = proto.Field( + evaluated_item_count: int = proto.Field( proto.INT64, number=7, ) @@ -122,7 +124,7 @@ class EvaluationConfig(proto.Message): This field is a member of `oneof`_ ``vertical_option``. """ - bounding_box_evaluation_options = proto.Field( + bounding_box_evaluation_options: "BoundingBoxEvaluationOptions" = proto.Field( proto.MESSAGE, number=1, oneof="vertical_option", @@ -142,7 +144,7 @@ class BoundingBoxEvaluationOptions(proto.Message): must be a number between 0 and 1. """ - iou_threshold = proto.Field( + iou_threshold: float = proto.Field( proto.FLOAT, number=1, ) @@ -167,13 +169,13 @@ class EvaluationMetrics(proto.Message): This field is a member of `oneof`_ ``metrics``. """ - classification_metrics = proto.Field( + classification_metrics: "ClassificationMetrics" = proto.Field( proto.MESSAGE, number=1, oneof="metrics", message="ClassificationMetrics", ) - object_detection_metrics = proto.Field( + object_detection_metrics: "ObjectDetectionMetrics" = proto.Field( proto.MESSAGE, number=2, oneof="metrics", @@ -194,12 +196,12 @@ class ClassificationMetrics(proto.Message): ground truth labels. """ - pr_curve = proto.Field( + pr_curve: "PrCurve" = proto.Field( proto.MESSAGE, number=1, message="PrCurve", ) - confusion_matrix = proto.Field( + confusion_matrix: "ConfusionMatrix" = proto.Field( proto.MESSAGE, number=2, message="ConfusionMatrix", @@ -215,7 +217,7 @@ class ObjectDetectionMetrics(proto.Message): Precision-recall curve. """ - pr_curve = proto.Field( + pr_curve: "PrCurve" = proto.Field( proto.MESSAGE, number=1, message="PrCurve", @@ -235,7 +237,7 @@ class PrCurve(proto.Message): Area under the precision-recall curve. Not to be confused with area under a receiver operating characteristic (ROC) curve. - confidence_metrics_entries (Sequence[google.cloud.datalabeling_v1beta1.types.PrCurve.ConfidenceMetricsEntry]): + confidence_metrics_entries (MutableSequence[google.cloud.datalabeling_v1beta1.types.PrCurve.ConfidenceMetricsEntry]): Entries that make up the precision-recall graph. Each entry is a "point" on the graph drawn for a different ``confidence_threshold``. @@ -290,62 +292,64 @@ class ConfidenceMetricsEntry(proto.Message): [precision_at5][google.cloud.datalabeling.v1beta1.PrCurve.ConfidenceMetricsEntry.precision_at5]. """ - confidence_threshold = proto.Field( + confidence_threshold: float = proto.Field( proto.FLOAT, number=1, ) - recall = proto.Field( + recall: float = proto.Field( proto.FLOAT, number=2, ) - precision = proto.Field( + precision: float = proto.Field( proto.FLOAT, number=3, ) - f1_score = proto.Field( + f1_score: float = proto.Field( proto.FLOAT, number=4, ) - recall_at1 = proto.Field( + recall_at1: float = proto.Field( proto.FLOAT, number=5, ) - precision_at1 = proto.Field( + precision_at1: float = proto.Field( proto.FLOAT, number=6, ) - f1_score_at1 = proto.Field( + f1_score_at1: float = proto.Field( proto.FLOAT, number=7, ) - recall_at5 = proto.Field( + recall_at5: float = proto.Field( proto.FLOAT, number=8, ) - precision_at5 = proto.Field( + precision_at5: float = proto.Field( proto.FLOAT, number=9, ) - f1_score_at5 = proto.Field( + f1_score_at5: float = proto.Field( proto.FLOAT, number=10, ) - annotation_spec = proto.Field( + annotation_spec: annotation_spec_set.AnnotationSpec = proto.Field( proto.MESSAGE, number=1, message=annotation_spec_set.AnnotationSpec, ) - area_under_curve = proto.Field( + area_under_curve: float = proto.Field( proto.FLOAT, number=2, ) - confidence_metrics_entries = proto.RepeatedField( + confidence_metrics_entries: MutableSequence[ + ConfidenceMetricsEntry + ] = proto.RepeatedField( proto.MESSAGE, number=3, message=ConfidenceMetricsEntry, ) - mean_average_precision = proto.Field( + mean_average_precision: float = proto.Field( proto.FLOAT, number=4, ) @@ -357,7 +361,7 @@ class ConfusionMatrix(proto.Message): labels. Not applicable when the entry is for a single label. Attributes: - row (Sequence[google.cloud.datalabeling_v1beta1.types.ConfusionMatrix.Row]): + row (MutableSequence[google.cloud.datalabeling_v1beta1.types.ConfusionMatrix.Row]): """ @@ -373,12 +377,12 @@ class ConfusionMatrixEntry(proto.Message): this entry's parent.) """ - annotation_spec = proto.Field( + annotation_spec: annotation_spec_set.AnnotationSpec = proto.Field( proto.MESSAGE, number=1, message=annotation_spec_set.AnnotationSpec, ) - item_count = proto.Field( + item_count: int = proto.Field( proto.INT32, number=2, ) @@ -391,23 +395,25 @@ class Row(proto.Message): annotation_spec (google.cloud.datalabeling_v1beta1.types.AnnotationSpec): The annotation spec of the ground truth label for this row. - entries (Sequence[google.cloud.datalabeling_v1beta1.types.ConfusionMatrix.ConfusionMatrixEntry]): + entries (MutableSequence[google.cloud.datalabeling_v1beta1.types.ConfusionMatrix.ConfusionMatrixEntry]): A list of the confusion matrix entries. One entry for each possible predicted label. """ - annotation_spec = proto.Field( + annotation_spec: annotation_spec_set.AnnotationSpec = proto.Field( proto.MESSAGE, number=1, message=annotation_spec_set.AnnotationSpec, ) - entries = proto.RepeatedField( + entries: MutableSequence[ + "ConfusionMatrix.ConfusionMatrixEntry" + ] = proto.RepeatedField( proto.MESSAGE, number=2, message="ConfusionMatrix.ConfusionMatrixEntry", ) - row = proto.RepeatedField( + row: MutableSequence[Row] = proto.RepeatedField( proto.MESSAGE, number=1, message=Row, diff --git a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/evaluation_job.py b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/evaluation_job.py index c46ac1e755a9..01c102b8d529 100644 --- a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/evaluation_job.py +++ b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/evaluation_job.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import timestamp_pb2 # type: ignore from google.rpc import status_pb2 # type: ignore import proto # type: ignore @@ -94,7 +96,7 @@ class EvaluationJob(proto.Message): this to ``true``. If you want to provide your own ground truth labels in the evaluation job's BigQuery table, set this to ``false``. - attempts (Sequence[google.cloud.datalabeling_v1beta1.types.Attempt]): + attempts (MutableSequence[google.cloud.datalabeling_v1beta1.types.Attempt]): Output only. Every time the evaluation job runs and an error occurs, the failed attempt is appended to this array. @@ -111,46 +113,46 @@ class State(proto.Enum): PAUSED = 3 STOPPED = 4 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=2, ) - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=3, enum=State, ) - schedule = proto.Field( + schedule: str = proto.Field( proto.STRING, number=4, ) - model_version = proto.Field( + model_version: str = proto.Field( proto.STRING, number=5, ) - evaluation_job_config = proto.Field( + evaluation_job_config: "EvaluationJobConfig" = proto.Field( proto.MESSAGE, number=6, message="EvaluationJobConfig", ) - annotation_spec_set = proto.Field( + annotation_spec_set: str = proto.Field( proto.STRING, number=7, ) - label_missing_ground_truth = proto.Field( + label_missing_ground_truth: bool = proto.Field( proto.BOOL, number=8, ) - attempts = proto.RepeatedField( + attempts: MutableSequence["Attempt"] = proto.RepeatedField( proto.MESSAGE, number=9, message="Attempt", ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=10, message=timestamp_pb2.Timestamp, @@ -237,7 +239,7 @@ class EvaluationJobConfig(proto.Message): resource before you can specify this field. Provide the name of the instruction resource in the ``instruction`` field within this configuration. - bigquery_import_keys (Mapping[str, str]): + bigquery_import_keys (MutableMapping[str, str]): Required. Prediction keys that tell Data Labeling Service where to find the data for evaluation in your BigQuery table. When the service samples prediction input and output @@ -284,53 +286,57 @@ class EvaluationJobConfig(proto.Message): average precision during a run. """ - image_classification_config = proto.Field( + image_classification_config: gcd_human_annotation_config.ImageClassificationConfig = proto.Field( proto.MESSAGE, number=4, oneof="human_annotation_request_config", message=gcd_human_annotation_config.ImageClassificationConfig, ) - bounding_poly_config = proto.Field( + bounding_poly_config: gcd_human_annotation_config.BoundingPolyConfig = proto.Field( proto.MESSAGE, number=5, oneof="human_annotation_request_config", message=gcd_human_annotation_config.BoundingPolyConfig, ) - text_classification_config = proto.Field( - proto.MESSAGE, - number=8, - oneof="human_annotation_request_config", - message=gcd_human_annotation_config.TextClassificationConfig, + text_classification_config: gcd_human_annotation_config.TextClassificationConfig = ( + proto.Field( + proto.MESSAGE, + number=8, + oneof="human_annotation_request_config", + message=gcd_human_annotation_config.TextClassificationConfig, + ) ) - input_config = proto.Field( + input_config: dataset.InputConfig = proto.Field( proto.MESSAGE, number=1, message=dataset.InputConfig, ) - evaluation_config = proto.Field( + evaluation_config: evaluation.EvaluationConfig = proto.Field( proto.MESSAGE, number=2, message=evaluation.EvaluationConfig, ) - human_annotation_config = proto.Field( - proto.MESSAGE, - number=3, - message=gcd_human_annotation_config.HumanAnnotationConfig, + human_annotation_config: gcd_human_annotation_config.HumanAnnotationConfig = ( + proto.Field( + proto.MESSAGE, + number=3, + message=gcd_human_annotation_config.HumanAnnotationConfig, + ) ) - bigquery_import_keys = proto.MapField( + bigquery_import_keys: MutableMapping[str, str] = proto.MapField( proto.STRING, proto.STRING, number=9, ) - example_count = proto.Field( + example_count: int = proto.Field( proto.INT32, number=10, ) - example_sample_percentage = proto.Field( + example_sample_percentage: float = proto.Field( proto.DOUBLE, number=11, ) - evaluation_job_alert_config = proto.Field( + evaluation_job_alert_config: "EvaluationJobAlertConfig" = proto.Field( proto.MESSAGE, number=13, message="EvaluationJobAlertConfig", @@ -354,11 +360,11 @@ class EvaluationJobAlertConfig(proto.Message): specified email. """ - email = proto.Field( + email: str = proto.Field( proto.STRING, number=1, ) - min_acceptable_mean_average_precision = proto.Field( + min_acceptable_mean_average_precision: float = proto.Field( proto.DOUBLE, number=2, ) @@ -370,16 +376,16 @@ class Attempt(proto.Message): Attributes: attempt_time (google.protobuf.timestamp_pb2.Timestamp): - partial_failures (Sequence[google.rpc.status_pb2.Status]): + partial_failures (MutableSequence[google.rpc.status_pb2.Status]): Details of errors that occurred. """ - attempt_time = proto.Field( + attempt_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp, ) - partial_failures = proto.RepeatedField( + partial_failures: MutableSequence[status_pb2.Status] = proto.RepeatedField( proto.MESSAGE, number=2, message=status_pb2.Status, diff --git a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/human_annotation_config.py b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/human_annotation_config.py index 8fc6e492e341..b3c3d468ca0c 100644 --- a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/human_annotation_config.py +++ b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/human_annotation_config.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import duration_pb2 # type: ignore import proto # type: ignore @@ -78,7 +80,7 @@ class HumanAnnotationConfig(proto.Message): Optional. Maximum duration for contributors to answer a question. Maximum is 3600 seconds. Default is 3600 seconds. - contributor_emails (Sequence[str]): + contributor_emails (MutableSequence[str]): Optional. If you want your own labeling contributors to manage and work on this labeling request, you can set these contributors here. We @@ -92,40 +94,40 @@ class HumanAnnotationConfig(proto.Message): no notification will be sent. """ - instruction = proto.Field( + instruction: str = proto.Field( proto.STRING, number=1, ) - annotated_dataset_display_name = proto.Field( + annotated_dataset_display_name: str = proto.Field( proto.STRING, number=2, ) - annotated_dataset_description = proto.Field( + annotated_dataset_description: str = proto.Field( proto.STRING, number=3, ) - label_group = proto.Field( + label_group: str = proto.Field( proto.STRING, number=4, ) - language_code = proto.Field( + language_code: str = proto.Field( proto.STRING, number=5, ) - replica_count = proto.Field( + replica_count: int = proto.Field( proto.INT32, number=6, ) - question_duration = proto.Field( + question_duration: duration_pb2.Duration = proto.Field( proto.MESSAGE, number=7, message=duration_pb2.Duration, ) - contributor_emails = proto.RepeatedField( + contributor_emails: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=9, ) - user_email_address = proto.Field( + user_email_address: str = proto.Field( proto.STRING, number=10, ) @@ -145,15 +147,15 @@ class ImageClassificationConfig(proto.Message): answers. """ - annotation_spec_set = proto.Field( + annotation_spec_set: str = proto.Field( proto.STRING, number=1, ) - allow_multi_label = proto.Field( + allow_multi_label: bool = proto.Field( proto.BOOL, number=2, ) - answer_aggregation_type = proto.Field( + answer_aggregation_type: "StringAggregationType" = proto.Field( proto.ENUM, number=3, enum="StringAggregationType", @@ -172,11 +174,11 @@ class BoundingPolyConfig(proto.Message): contributors UI. """ - annotation_spec_set = proto.Field( + annotation_spec_set: str = proto.Field( proto.STRING, number=1, ) - instruction_message = proto.Field( + instruction_message: str = proto.Field( proto.STRING, number=2, ) @@ -193,11 +195,11 @@ class PolylineConfig(proto.Message): contributors UI. """ - annotation_spec_set = proto.Field( + annotation_spec_set: str = proto.Field( proto.STRING, number=1, ) - instruction_message = proto.Field( + instruction_message: str = proto.Field( proto.STRING, number=2, ) @@ -214,11 +216,11 @@ class SegmentationConfig(proto.Message): Instruction message showed on labelers UI. """ - annotation_spec_set = proto.Field( + annotation_spec_set: str = proto.Field( proto.STRING, number=1, ) - instruction_message = proto.Field( + instruction_message: str = proto.Field( proto.STRING, number=2, ) @@ -232,7 +234,7 @@ class VideoClassificationConfig(proto.Message): shot, and assign labels on each video clip. Attributes: - annotation_spec_set_configs (Sequence[google.cloud.datalabeling_v1beta1.types.VideoClassificationConfig.AnnotationSpecSetConfig]): + annotation_spec_set_configs (MutableSequence[google.cloud.datalabeling_v1beta1.types.VideoClassificationConfig.AnnotationSpecSetConfig]): Required. The list of annotation spec set configs. Since watching a video clip takes much longer time than an image, we support label with @@ -258,21 +260,23 @@ class AnnotationSpecSetConfig(proto.Message): able to choose multiple labels from one annotation spec set. """ - annotation_spec_set = proto.Field( + annotation_spec_set: str = proto.Field( proto.STRING, number=1, ) - allow_multi_label = proto.Field( + allow_multi_label: bool = proto.Field( proto.BOOL, number=2, ) - annotation_spec_set_configs = proto.RepeatedField( + annotation_spec_set_configs: MutableSequence[ + AnnotationSpecSetConfig + ] = proto.RepeatedField( proto.MESSAGE, number=1, message=AnnotationSpecSetConfig, ) - apply_shot_detection = proto.Field( + apply_shot_detection: bool = proto.Field( proto.BOOL, number=2, ) @@ -293,11 +297,11 @@ class ObjectDetectionConfig(proto.Message): extracted from the video. """ - annotation_spec_set = proto.Field( + annotation_spec_set: str = proto.Field( proto.STRING, number=1, ) - extraction_frame_rate = proto.Field( + extraction_frame_rate: float = proto.Field( proto.DOUBLE, number=3, ) @@ -311,7 +315,7 @@ class ObjectTrackingConfig(proto.Message): Required. Annotation spec set resource name. """ - annotation_spec_set = proto.Field( + annotation_spec_set: str = proto.Field( proto.STRING, number=1, ) @@ -321,14 +325,14 @@ class EventConfig(proto.Message): r"""Config for video event human labeling task. Attributes: - annotation_spec_sets (Sequence[str]): + annotation_spec_sets (MutableSequence[str]): Required. The list of annotation spec set resource name. Similar to video classification, we support selecting event from multiple AnnotationSpecSet at the same time. """ - annotation_spec_sets = proto.RepeatedField( + annotation_spec_sets: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) @@ -347,15 +351,15 @@ class TextClassificationConfig(proto.Message): Optional. Configs for sentiment selection. """ - allow_multi_label = proto.Field( + allow_multi_label: bool = proto.Field( proto.BOOL, number=1, ) - annotation_spec_set = proto.Field( + annotation_spec_set: str = proto.Field( proto.STRING, number=2, ) - sentiment_config = proto.Field( + sentiment_config: "SentimentConfig" = proto.Field( proto.MESSAGE, number=3, message="SentimentConfig", @@ -373,7 +377,7 @@ class SentimentConfig(proto.Message): label. Default is false. """ - enable_label_sentiment_selection = proto.Field( + enable_label_sentiment_selection: bool = proto.Field( proto.BOOL, number=1, ) @@ -387,7 +391,7 @@ class TextEntityExtractionConfig(proto.Message): Required. Annotation spec set resource name. """ - annotation_spec_set = proto.Field( + annotation_spec_set: str = proto.Field( proto.STRING, number=1, ) diff --git a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/instruction.py b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/instruction.py index 03e8901136e0..2f7b8e864d55 100644 --- a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/instruction.py +++ b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/instruction.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore @@ -62,50 +64,50 @@ class Instruction(proto.Message): pdf_instruction (google.cloud.datalabeling_v1beta1.types.PdfInstruction): Instruction from a PDF document. The PDF should be in a Cloud Storage bucket. - blocking_resources (Sequence[str]): + blocking_resources (MutableSequence[str]): Output only. The names of any related resources that are blocking changes to the instruction. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - display_name = proto.Field( + display_name: str = proto.Field( proto.STRING, number=2, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=3, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp, ) - data_type = proto.Field( + data_type: dataset.DataType = proto.Field( proto.ENUM, number=6, enum=dataset.DataType, ) - csv_instruction = proto.Field( + csv_instruction: "CsvInstruction" = proto.Field( proto.MESSAGE, number=7, message="CsvInstruction", ) - pdf_instruction = proto.Field( + pdf_instruction: "PdfInstruction" = proto.Field( proto.MESSAGE, number=9, message="PdfInstruction", ) - blocking_resources = proto.RepeatedField( + blocking_resources: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=10, ) @@ -121,7 +123,7 @@ class CsvInstruction(proto.Message): is allowed. """ - gcs_file_uri = proto.Field( + gcs_file_uri: str = proto.Field( proto.STRING, number=1, ) @@ -136,7 +138,7 @@ class PdfInstruction(proto.Message): is allowed. """ - gcs_file_uri = proto.Field( + gcs_file_uri: str = proto.Field( proto.STRING, number=1, ) diff --git a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/operations.py b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/operations.py index 016e2b0f1d07..e28a2a74fa16 100644 --- a/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/operations.py +++ b/packages/google-cloud-datalabeling/google/cloud/datalabeling_v1beta1/types/operations.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import timestamp_pb2 # type: ignore from google.rpc import status_pb2 # type: ignore import proto # type: ignore @@ -59,15 +61,15 @@ class ImportDataOperationResponse(proto.Message): successfully. """ - dataset = proto.Field( + dataset: str = proto.Field( proto.STRING, number=1, ) - total_count = proto.Field( + total_count: int = proto.Field( proto.INT32, number=2, ) - import_count = proto.Field( + import_count: int = proto.Field( proto.INT32, number=3, ) @@ -92,24 +94,24 @@ class ExportDataOperationResponse(proto.Message): Output only. output_config in the ExportData request. """ - dataset = proto.Field( + dataset: str = proto.Field( proto.STRING, number=1, ) - total_count = proto.Field( + total_count: int = proto.Field( proto.INT32, number=2, ) - export_count = proto.Field( + export_count: int = proto.Field( proto.INT32, number=3, ) - label_stats = proto.Field( + label_stats: gcd_dataset.LabelStats = proto.Field( proto.MESSAGE, number=4, message=gcd_dataset.LabelStats, ) - output_config = proto.Field( + output_config: gcd_dataset.OutputConfig = proto.Field( proto.MESSAGE, number=5, message=gcd_dataset.OutputConfig, @@ -123,7 +125,7 @@ class ImportDataOperationMetadata(proto.Message): dataset (str): Output only. The name of imported dataset. "projects/*/datasets/*". - partial_failures (Sequence[google.rpc.status_pb2.Status]): + partial_failures (MutableSequence[google.rpc.status_pb2.Status]): Output only. Partial failures encountered. E.g. single files that couldn't be read. Status details field will contain standard GCP @@ -133,16 +135,16 @@ class ImportDataOperationMetadata(proto.Message): request was created. """ - dataset = proto.Field( + dataset: str = proto.Field( proto.STRING, number=1, ) - partial_failures = proto.RepeatedField( + partial_failures: MutableSequence[status_pb2.Status] = proto.RepeatedField( proto.MESSAGE, number=2, message=status_pb2.Status, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, @@ -156,7 +158,7 @@ class ExportDataOperationMetadata(proto.Message): dataset (str): Output only. The name of dataset to be exported. "projects/*/datasets/*". - partial_failures (Sequence[google.rpc.status_pb2.Status]): + partial_failures (MutableSequence[google.rpc.status_pb2.Status]): Output only. Partial failures encountered. E.g. single files that couldn't be read. Status details field will contain standard GCP @@ -166,16 +168,16 @@ class ExportDataOperationMetadata(proto.Message): request was created. """ - dataset = proto.Field( + dataset: str = proto.Field( proto.STRING, number=1, ) - partial_failures = proto.RepeatedField( + partial_failures: MutableSequence[status_pb2.Status] = proto.RepeatedField( proto.MESSAGE, number=2, message=status_pb2.Status, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, @@ -254,7 +256,7 @@ class LabelOperationMetadata(proto.Message): This field is a member of `oneof`_ ``details``. progress_percent (int): Output only. Progress of label operation. Range: [0, 100]. - partial_failures (Sequence[google.rpc.status_pb2.Status]): + partial_failures (MutableSequence[google.rpc.status_pb2.Status]): Output only. Partial failures encountered. E.g. single files that couldn't be read. Status details field will contain standard GCP @@ -264,88 +266,102 @@ class LabelOperationMetadata(proto.Message): was created. """ - image_classification_details = proto.Field( - proto.MESSAGE, - number=3, - oneof="details", - message="LabelImageClassificationOperationMetadata", + image_classification_details: "LabelImageClassificationOperationMetadata" = ( + proto.Field( + proto.MESSAGE, + number=3, + oneof="details", + message="LabelImageClassificationOperationMetadata", + ) ) - image_bounding_box_details = proto.Field( + image_bounding_box_details: "LabelImageBoundingBoxOperationMetadata" = proto.Field( proto.MESSAGE, number=4, oneof="details", message="LabelImageBoundingBoxOperationMetadata", ) - image_bounding_poly_details = proto.Field( - proto.MESSAGE, - number=11, - oneof="details", - message="LabelImageBoundingPolyOperationMetadata", + image_bounding_poly_details: "LabelImageBoundingPolyOperationMetadata" = ( + proto.Field( + proto.MESSAGE, + number=11, + oneof="details", + message="LabelImageBoundingPolyOperationMetadata", + ) ) - image_oriented_bounding_box_details = proto.Field( + image_oriented_bounding_box_details: "LabelImageOrientedBoundingBoxOperationMetadata" = proto.Field( proto.MESSAGE, number=14, oneof="details", message="LabelImageOrientedBoundingBoxOperationMetadata", ) - image_polyline_details = proto.Field( + image_polyline_details: "LabelImagePolylineOperationMetadata" = proto.Field( proto.MESSAGE, number=12, oneof="details", message="LabelImagePolylineOperationMetadata", ) - image_segmentation_details = proto.Field( + image_segmentation_details: "LabelImageSegmentationOperationMetadata" = proto.Field( proto.MESSAGE, number=15, oneof="details", message="LabelImageSegmentationOperationMetadata", ) - video_classification_details = proto.Field( - proto.MESSAGE, - number=5, - oneof="details", - message="LabelVideoClassificationOperationMetadata", - ) - video_object_detection_details = proto.Field( - proto.MESSAGE, - number=6, - oneof="details", - message="LabelVideoObjectDetectionOperationMetadata", - ) - video_object_tracking_details = proto.Field( - proto.MESSAGE, - number=7, - oneof="details", - message="LabelVideoObjectTrackingOperationMetadata", - ) - video_event_details = proto.Field( + video_classification_details: "LabelVideoClassificationOperationMetadata" = ( + proto.Field( + proto.MESSAGE, + number=5, + oneof="details", + message="LabelVideoClassificationOperationMetadata", + ) + ) + video_object_detection_details: "LabelVideoObjectDetectionOperationMetadata" = ( + proto.Field( + proto.MESSAGE, + number=6, + oneof="details", + message="LabelVideoObjectDetectionOperationMetadata", + ) + ) + video_object_tracking_details: "LabelVideoObjectTrackingOperationMetadata" = ( + proto.Field( + proto.MESSAGE, + number=7, + oneof="details", + message="LabelVideoObjectTrackingOperationMetadata", + ) + ) + video_event_details: "LabelVideoEventOperationMetadata" = proto.Field( proto.MESSAGE, number=8, oneof="details", message="LabelVideoEventOperationMetadata", ) - text_classification_details = proto.Field( - proto.MESSAGE, - number=9, - oneof="details", - message="LabelTextClassificationOperationMetadata", - ) - text_entity_extraction_details = proto.Field( - proto.MESSAGE, - number=13, - oneof="details", - message="LabelTextEntityExtractionOperationMetadata", - ) - progress_percent = proto.Field( + text_classification_details: "LabelTextClassificationOperationMetadata" = ( + proto.Field( + proto.MESSAGE, + number=9, + oneof="details", + message="LabelTextClassificationOperationMetadata", + ) + ) + text_entity_extraction_details: "LabelTextEntityExtractionOperationMetadata" = ( + proto.Field( + proto.MESSAGE, + number=13, + oneof="details", + message="LabelTextEntityExtractionOperationMetadata", + ) + ) + progress_percent: int = proto.Field( proto.INT32, number=1, ) - partial_failures = proto.RepeatedField( + partial_failures: MutableSequence[status_pb2.Status] = proto.RepeatedField( proto.MESSAGE, number=2, message=status_pb2.Status, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=16, message=timestamp_pb2.Timestamp, @@ -361,7 +377,7 @@ class LabelImageClassificationOperationMetadata(proto.Message): labeling request. """ - basic_config = proto.Field( + basic_config: human_annotation_config.HumanAnnotationConfig = proto.Field( proto.MESSAGE, number=1, message=human_annotation_config.HumanAnnotationConfig, @@ -377,7 +393,7 @@ class LabelImageBoundingBoxOperationMetadata(proto.Message): labeling request. """ - basic_config = proto.Field( + basic_config: human_annotation_config.HumanAnnotationConfig = proto.Field( proto.MESSAGE, number=1, message=human_annotation_config.HumanAnnotationConfig, @@ -393,7 +409,7 @@ class LabelImageOrientedBoundingBoxOperationMetadata(proto.Message): Basic human annotation config. """ - basic_config = proto.Field( + basic_config: human_annotation_config.HumanAnnotationConfig = proto.Field( proto.MESSAGE, number=1, message=human_annotation_config.HumanAnnotationConfig, @@ -409,7 +425,7 @@ class LabelImageBoundingPolyOperationMetadata(proto.Message): labeling request. """ - basic_config = proto.Field( + basic_config: human_annotation_config.HumanAnnotationConfig = proto.Field( proto.MESSAGE, number=1, message=human_annotation_config.HumanAnnotationConfig, @@ -425,7 +441,7 @@ class LabelImagePolylineOperationMetadata(proto.Message): labeling request. """ - basic_config = proto.Field( + basic_config: human_annotation_config.HumanAnnotationConfig = proto.Field( proto.MESSAGE, number=1, message=human_annotation_config.HumanAnnotationConfig, @@ -440,7 +456,7 @@ class LabelImageSegmentationOperationMetadata(proto.Message): Basic human annotation config. """ - basic_config = proto.Field( + basic_config: human_annotation_config.HumanAnnotationConfig = proto.Field( proto.MESSAGE, number=1, message=human_annotation_config.HumanAnnotationConfig, @@ -456,7 +472,7 @@ class LabelVideoClassificationOperationMetadata(proto.Message): labeling request. """ - basic_config = proto.Field( + basic_config: human_annotation_config.HumanAnnotationConfig = proto.Field( proto.MESSAGE, number=1, message=human_annotation_config.HumanAnnotationConfig, @@ -472,7 +488,7 @@ class LabelVideoObjectDetectionOperationMetadata(proto.Message): labeling request. """ - basic_config = proto.Field( + basic_config: human_annotation_config.HumanAnnotationConfig = proto.Field( proto.MESSAGE, number=1, message=human_annotation_config.HumanAnnotationConfig, @@ -488,7 +504,7 @@ class LabelVideoObjectTrackingOperationMetadata(proto.Message): labeling request. """ - basic_config = proto.Field( + basic_config: human_annotation_config.HumanAnnotationConfig = proto.Field( proto.MESSAGE, number=1, message=human_annotation_config.HumanAnnotationConfig, @@ -504,7 +520,7 @@ class LabelVideoEventOperationMetadata(proto.Message): labeling request. """ - basic_config = proto.Field( + basic_config: human_annotation_config.HumanAnnotationConfig = proto.Field( proto.MESSAGE, number=1, message=human_annotation_config.HumanAnnotationConfig, @@ -520,7 +536,7 @@ class LabelTextClassificationOperationMetadata(proto.Message): labeling request. """ - basic_config = proto.Field( + basic_config: human_annotation_config.HumanAnnotationConfig = proto.Field( proto.MESSAGE, number=1, message=human_annotation_config.HumanAnnotationConfig, @@ -536,7 +552,7 @@ class LabelTextEntityExtractionOperationMetadata(proto.Message): labeling request. """ - basic_config = proto.Field( + basic_config: human_annotation_config.HumanAnnotationConfig = proto.Field( proto.MESSAGE, number=1, message=human_annotation_config.HumanAnnotationConfig, @@ -550,7 +566,7 @@ class CreateInstructionMetadata(proto.Message): instruction (str): The name of the created Instruction. projects/{project_id}/instructions/{instruction_id} - partial_failures (Sequence[google.rpc.status_pb2.Status]): + partial_failures (MutableSequence[google.rpc.status_pb2.Status]): Partial failures encountered. E.g. single files that couldn't be read. Status details field will contain standard GCP @@ -560,16 +576,16 @@ class CreateInstructionMetadata(proto.Message): created. """ - instruction = proto.Field( + instruction: str = proto.Field( proto.STRING, number=1, ) - partial_failures = proto.RepeatedField( + partial_failures: MutableSequence[status_pb2.Status] = proto.RepeatedField( proto.MESSAGE, number=2, message=status_pb2.Status, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, diff --git a/packages/google-cloud-datalabeling/owlbot.py b/packages/google-cloud-datalabeling/owlbot.py new file mode 100644 index 000000000000..ce738f01d012 --- /dev/null +++ b/packages/google-cloud-datalabeling/owlbot.py @@ -0,0 +1,56 @@ +# 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. + +import json +from pathlib import Path +import shutil + +import synthtool as s +import synthtool.gcp as gcp +from synthtool.languages import python + +# ---------------------------------------------------------------------------- +# Copy the generated client from the owl-bot staging directory +# ---------------------------------------------------------------------------- + +clean_up_generated_samples = True + +# Load the default version defined in .repo-metadata.json. +default_version = json.load(open(".repo-metadata.json", "rt")).get( + "default_version" +) + +for library in s.get_staging_dirs(default_version): + if clean_up_generated_samples: + shutil.rmtree("samples/generated_samples", ignore_errors=True) + clean_up_generated_samples = False + s.move([library], excludes=["**/gapic_version.py"]) +s.remove_staging_dirs() + +# ---------------------------------------------------------------------------- +# Add templated files +# ---------------------------------------------------------------------------- + +templated_files = gcp.CommonTemplates().py_library( + cov_level=100, + microgenerator=True, + versions=gcp.common.detect_versions(path="./google", default_first=True), +) +s.move(templated_files, excludes=[".coveragerc", ".github/release-please.yml"]) + +python.py_samples(skip_readmes=True) + +# run format session for all directories which have a noxfile +for noxfile in Path(".").glob("**/noxfile.py"): + s.shell.run(["nox", "-s", "format"], cwd=noxfile.parent, hide_output=False) diff --git a/packages/google-cloud-datalabeling/release-please-config.json b/packages/google-cloud-datalabeling/release-please-config.json new file mode 100644 index 000000000000..7dc9d5134827 --- /dev/null +++ b/packages/google-cloud-datalabeling/release-please-config.json @@ -0,0 +1,23 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "packages": { + ".": { + "release-type": "python", + "extra-files": [ + "google/cloud/datalabeling/gapic_version.py", + { + "type": "json", + "path": "samples/generated_samples/snippet_metadata_google.cloud.datalabeling.v1beta1.json", + "jsonpath": "$.clientLibrary.version" + } + ] + } + }, + "release-type": "python", + "plugins": [ + { + "type": "sentence-case" + } + ], + "initial-version": "0.1.0" +} diff --git a/packages/google-cloud-datalabeling/samples/generated_samples/snippet_metadata_datalabeling_v1beta1.json b/packages/google-cloud-datalabeling/samples/generated_samples/snippet_metadata_google.cloud.datalabeling.v1beta1.json similarity index 99% rename from packages/google-cloud-datalabeling/samples/generated_samples/snippet_metadata_datalabeling_v1beta1.json rename to packages/google-cloud-datalabeling/samples/generated_samples/snippet_metadata_google.cloud.datalabeling.v1beta1.json index ec0ef820818c..4a6f501c7672 100644 --- a/packages/google-cloud-datalabeling/samples/generated_samples/snippet_metadata_datalabeling_v1beta1.json +++ b/packages/google-cloud-datalabeling/samples/generated_samples/snippet_metadata_google.cloud.datalabeling.v1beta1.json @@ -7,7 +7,8 @@ } ], "language": "PYTHON", - "name": "google-cloud-datalabeling" + "name": "google-cloud-datalabeling", + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-datalabeling/setup.py b/packages/google-cloud-datalabeling/setup.py index 8cf6a981f469..04a65f559f18 100644 --- a/packages/google-cloud-datalabeling/setup.py +++ b/packages/google-cloud-datalabeling/setup.py @@ -1,35 +1,48 @@ # -*- coding: utf-8 -*- -# -# Copyright 2019 Google LLC +# 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 # -# https://www.apache.org/licenses/LICENSE-2.0 +# 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. - +# import io import os -import setuptools +import setuptools # type: ignore + +package_root = os.path.abspath(os.path.dirname(__file__)) name = "google-cloud-datalabeling" -description = "Data Labeling API client library" -version = "1.6.3" -release_status = "Development Status :: 4 - Beta" + + +description = "Google Cloud Datalabeling API client library" + +version = {} +with open( + os.path.join(package_root, "google/cloud/datalabeling/gapic_version.py") +) as fp: + exec(fp.read(), version) +version = version["__version__"] + +if version[0] == "0": + release_status = "Development Status :: 4 - Beta" +else: + release_status = "Development Status :: 5 - Production/Stable" + dependencies = [ - "google-api-core[grpc] >= 1.32.0, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", + "google-api-core[grpc] >= 1.33.2, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,!=2.6.*,!=2.7.*", "proto-plus >= 1.22.0, <2.0.0dev", "protobuf>=3.19.5,<5.0.0dev,!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5", ] - -extras = {"libcst": "libcst >= 0.2.5"} +url = "https://github.com/googleapis/python-datalabeling" package_root = os.path.abspath(os.path.dirname(__file__)) @@ -55,7 +68,7 @@ author="Google LLC", author_email="googleapis-packages@google.com", license="Apache 2.0", - url="https://github.com/googleapis/python-datalabeling", + url=url, classifiers=[ release_status, "Intended Audience :: Developers", @@ -72,10 +85,8 @@ platforms="Posix; MacOS X; Windows", packages=packages, python_requires=">=3.7", - scripts=["scripts/fixup_datalabeling_v1beta1_keywords.py"], namespace_packages=namespaces, install_requires=dependencies, - extras_require=extras, include_package_data=True, zip_safe=False, ) diff --git a/packages/google-cloud-datalabeling/testing/constraints-3.10.txt b/packages/google-cloud-datalabeling/testing/constraints-3.10.txt index e69de29bb2d1..ed7f9aed2559 100644 --- a/packages/google-cloud-datalabeling/testing/constraints-3.10.txt +++ b/packages/google-cloud-datalabeling/testing/constraints-3.10.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/packages/google-cloud-datalabeling/testing/constraints-3.11.txt b/packages/google-cloud-datalabeling/testing/constraints-3.11.txt index e69de29bb2d1..ed7f9aed2559 100644 --- a/packages/google-cloud-datalabeling/testing/constraints-3.11.txt +++ b/packages/google-cloud-datalabeling/testing/constraints-3.11.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/packages/google-cloud-datalabeling/testing/constraints-3.7.txt b/packages/google-cloud-datalabeling/testing/constraints-3.7.txt index 12b4d1428b2b..6f3158cc2034 100644 --- a/packages/google-cloud-datalabeling/testing/constraints-3.7.txt +++ b/packages/google-cloud-datalabeling/testing/constraints-3.7.txt @@ -1,11 +1,9 @@ # This constraints file is used to check that lower bounds # are correct in setup.py -# List *all* library dependencies and extras in this file. +# List all library dependencies and extras in this file. # Pin the version to the lower bound. -# -# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", -# Then this file should have foo==1.14.0 -google-api-core==1.32.0 -libcst==0.2.5 +# e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", +# Then this file should have google-cloud-foo==1.14.0 +google-api-core==1.33.2 proto-plus==1.22.0 protobuf==3.19.5 diff --git a/packages/google-cloud-datalabeling/testing/constraints-3.8.txt b/packages/google-cloud-datalabeling/testing/constraints-3.8.txt index e69de29bb2d1..ed7f9aed2559 100644 --- a/packages/google-cloud-datalabeling/testing/constraints-3.8.txt +++ b/packages/google-cloud-datalabeling/testing/constraints-3.8.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf diff --git a/packages/google-cloud-datalabeling/testing/constraints-3.9.txt b/packages/google-cloud-datalabeling/testing/constraints-3.9.txt index e69de29bb2d1..ed7f9aed2559 100644 --- a/packages/google-cloud-datalabeling/testing/constraints-3.9.txt +++ b/packages/google-cloud-datalabeling/testing/constraints-3.9.txt @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# This constraints file is required for unit tests. +# List all library dependencies and extras in this file. +google-api-core +proto-plus +protobuf