diff --git a/.coveragerc b/.coveragerc index a70f56b..7f3e86d 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,27 +1,11 @@ -# -*- coding: utf-8 -*- -# -# Copyright 2020 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# https://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. - -# Generated by synthtool. DO NOT EDIT! [run] branch = True [report] fail_under = 100 show_missing = True -omit = google/cloud/datalabeling/__init__.py +omit = + google/cloud/datalabeling/__init__.py exclude_lines = # Re-enable the standard pragma pragma: NO COVER @@ -31,4 +15,4 @@ exclude_lines = # This is added at the module level as a safeguard for if someone # generates the code and tries to run it without pip installing. This # makes it virtually impossible to test properly. - except pkg_resources.DistributionNotFound \ No newline at end of file + except pkg_resources.DistributionNotFound diff --git a/.kokoro/samples/python3.6/periodic-head.cfg b/.kokoro/samples/python3.6/periodic-head.cfg new file mode 100644 index 0000000..f9cfcd3 --- /dev/null +++ b/.kokoro/samples/python3.6/periodic-head.cfg @@ -0,0 +1,11 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-pubsub/.kokoro/test-samples-against-head.sh" +} diff --git a/.kokoro/samples/python3.7/periodic-head.cfg b/.kokoro/samples/python3.7/periodic-head.cfg new file mode 100644 index 0000000..f9cfcd3 --- /dev/null +++ b/.kokoro/samples/python3.7/periodic-head.cfg @@ -0,0 +1,11 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-pubsub/.kokoro/test-samples-against-head.sh" +} diff --git a/.kokoro/samples/python3.8/periodic-head.cfg b/.kokoro/samples/python3.8/periodic-head.cfg new file mode 100644 index 0000000..f9cfcd3 --- /dev/null +++ b/.kokoro/samples/python3.8/periodic-head.cfg @@ -0,0 +1,11 @@ +# Format: //devtools/kokoro/config/proto/build.proto + +env_vars: { + key: "INSTALL_LIBRARY_FROM_SOURCE" + value: "True" +} + +env_vars: { + key: "TRAMPOLINE_BUILD_FILE" + value: "github/python-pubsub/.kokoro/test-samples-against-head.sh" +} diff --git a/.kokoro/test-samples-against-head.sh b/.kokoro/test-samples-against-head.sh new file mode 100755 index 0000000..83a82e2 --- /dev/null +++ b/.kokoro/test-samples-against-head.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://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. + +# A customized test runner for samples. +# +# For periodic builds, you can specify this file for testing against head. + +# `-e` enables the script to automatically fail when a command fails +# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero +set -eo pipefail +# Enables `**` to include files nested inside sub-folders +shopt -s globstar + +cd github/python-datalabeling + +exec .kokoro/test-samples-impl.sh diff --git a/.kokoro/test-samples-impl.sh b/.kokoro/test-samples-impl.sh new file mode 100755 index 0000000..cf5de74 --- /dev/null +++ b/.kokoro/test-samples-impl.sh @@ -0,0 +1,102 @@ +#!/bin/bash +# Copyright 2021 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 +# +# 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. + + +# `-e` enables the script to automatically fail when a command fails +# `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero +set -eo pipefail +# Enables `**` to include files nested inside sub-folders +shopt -s globstar + +# Exit early if samples directory doesn't exist +if [ ! -d "./samples" ]; then + echo "No tests run. `./samples` not found" + exit 0 +fi + +# Disable buffering, so that the logs stream through. +export PYTHONUNBUFFERED=1 + +# Debug: show build environment +env | grep KOKORO + +# Install nox +python3.6 -m pip install --upgrade --quiet nox + +# Use secrets acessor service account to get secrets +if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then + gcloud auth activate-service-account \ + --key-file="${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" \ + --project="cloud-devrel-kokoro-resources" +fi + +# This script will create 3 files: +# - testing/test-env.sh +# - testing/service-account.json +# - testing/client-secrets.json +./scripts/decrypt-secrets.sh + +source ./testing/test-env.sh +export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/testing/service-account.json + +# For cloud-run session, we activate the service account for gcloud sdk. +gcloud auth activate-service-account \ + --key-file "${GOOGLE_APPLICATION_CREDENTIALS}" + +export GOOGLE_CLIENT_SECRETS=$(pwd)/testing/client-secrets.json + +echo -e "\n******************** TESTING PROJECTS ********************" + +# Switch to 'fail at end' to allow all tests to complete before exiting. +set +e +# Use RTN to return a non-zero value if the test fails. +RTN=0 +ROOT=$(pwd) +# Find all requirements.txt in the samples directory (may break on whitespace). +for file in samples/**/requirements.txt; do + cd "$ROOT" + # Navigate to the project folder. + file=$(dirname "$file") + cd "$file" + + echo "------------------------------------------------------------" + echo "- testing $file" + echo "------------------------------------------------------------" + + # Use nox to execute the tests for the project. + python3.6 -m nox -s "$RUN_TESTS_SESSION" + EXIT=$? + + # If this is a periodic build, send the test log to the FlakyBot. + # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot. + if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then + chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot + $KOKORO_GFILE_DIR/linux_amd64/flakybot + fi + + if [[ $EXIT -ne 0 ]]; then + RTN=1 + echo -e "\n Testing failed: Nox returned a non-zero exit code. \n" + else + echo -e "\n Testing completed.\n" + fi + +done +cd "$ROOT" + +# Workaround for Kokoro permissions issue: delete secrets +rm testing/{test-env.sh,client-secrets.json,service-account.json} + +exit "$RTN" diff --git a/.kokoro/test-samples.sh b/.kokoro/test-samples.sh index 5432068..636d0e4 100755 --- a/.kokoro/test-samples.sh +++ b/.kokoro/test-samples.sh @@ -13,6 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +# The default test runner for samples. +# +# For periodic builds, we rewinds the repo to the latest release, and +# run test-samples-impl.sh. # `-e` enables the script to automatically fail when a command fails # `-o pipefail` sets the exit code to the rightmost comment to exit with a non-zero @@ -24,87 +28,19 @@ cd github/python-datalabeling # Run periodic samples tests at latest release if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then + # preserving the test runner implementation. + cp .kokoro/test-samples-impl.sh "${TMPDIR}/test-samples-impl.sh" + echo "--- IMPORTANT IMPORTANT IMPORTANT ---" + echo "Now we rewind the repo back to the latest release..." LATEST_RELEASE=$(git describe --abbrev=0 --tags) git checkout $LATEST_RELEASE -fi - -# Exit early if samples directory doesn't exist -if [ ! -d "./samples" ]; then - echo "No tests run. `./samples` not found" - exit 0 -fi - -# Disable buffering, so that the logs stream through. -export PYTHONUNBUFFERED=1 - -# Debug: show build environment -env | grep KOKORO - -# Install nox -python3.6 -m pip install --upgrade --quiet nox - -# Use secrets acessor service account to get secrets -if [[ -f "${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" ]]; then - gcloud auth activate-service-account \ - --key-file="${KOKORO_GFILE_DIR}/secrets_viewer_service_account.json" \ - --project="cloud-devrel-kokoro-resources" -fi - -# This script will create 3 files: -# - testing/test-env.sh -# - testing/service-account.json -# - testing/client-secrets.json -./scripts/decrypt-secrets.sh - -source ./testing/test-env.sh -export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/testing/service-account.json - -# For cloud-run session, we activate the service account for gcloud sdk. -gcloud auth activate-service-account \ - --key-file "${GOOGLE_APPLICATION_CREDENTIALS}" - -export GOOGLE_CLIENT_SECRETS=$(pwd)/testing/client-secrets.json - -echo -e "\n******************** TESTING PROJECTS ********************" - -# Switch to 'fail at end' to allow all tests to complete before exiting. -set +e -# Use RTN to return a non-zero value if the test fails. -RTN=0 -ROOT=$(pwd) -# Find all requirements.txt in the samples directory (may break on whitespace). -for file in samples/**/requirements.txt; do - cd "$ROOT" - # Navigate to the project folder. - file=$(dirname "$file") - cd "$file" - - echo "------------------------------------------------------------" - echo "- testing $file" - echo "------------------------------------------------------------" - - # Use nox to execute the tests for the project. - python3.6 -m nox -s "$RUN_TESTS_SESSION" - EXIT=$? - - # If this is a periodic build, send the test log to the FlakyBot. - # See https://github.com/googleapis/repo-automation-bots/tree/master/packages/flakybot. - if [[ $KOKORO_BUILD_ARTIFACTS_SUBDIR = *"periodic"* ]]; then - chmod +x $KOKORO_GFILE_DIR/linux_amd64/flakybot - $KOKORO_GFILE_DIR/linux_amd64/flakybot + echo "The current head is: " + echo $(git rev-parse --verify HEAD) + echo "--- IMPORTANT IMPORTANT IMPORTANT ---" + # move back the test runner implementation if there's no file. + if [ ! -f .kokoro/test-samples-impl.sh ]; then + cp "${TMPDIR}/test-samples-impl.sh" .kokoro/test-samples-impl.sh fi +fi - if [[ $EXIT -ne 0 ]]; then - RTN=1 - echo -e "\n Testing failed: Nox returned a non-zero exit code. \n" - else - echo -e "\n Testing completed.\n" - fi - -done -cd "$ROOT" - -# Workaround for Kokoro permissions issue: delete secrets -rm testing/{test-env.sh,client-secrets.json,service-account.json} - -exit "$RTN" +exec .kokoro/test-samples-impl.sh diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a9024b1..32302e4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,6 +12,6 @@ repos: hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.4 + rev: 3.9.0 hooks: - id: flake8 diff --git a/UPGRADING.md b/UPGRADING.md index b7f71dd..553cde7 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -20,7 +20,7 @@ Methods expect request objects. We provide a script that will convert most commo * Install the library ```py -python3 -m pip install google-cloud-datalabeling +python3 -m pip install google-cloud-datalabeling[libcst] ``` * The script `fixup_datalabeling_v1_keywords.py` is shipped with the library. It expects an input directory (with the code to convert) and an empty destination directory. diff --git a/docs/datalabeling_v1beta1/data_labeling_service.rst b/docs/datalabeling_v1beta1/data_labeling_service.rst new file mode 100644 index 0000000..459f4d0 --- /dev/null +++ b/docs/datalabeling_v1beta1/data_labeling_service.rst @@ -0,0 +1,11 @@ +DataLabelingService +------------------------------------- + +.. automodule:: google.cloud.datalabeling_v1beta1.services.data_labeling_service + :members: + :inherited-members: + + +.. automodule:: google.cloud.datalabeling_v1beta1.services.data_labeling_service.pagers + :members: + :inherited-members: diff --git a/docs/datalabeling_v1beta1/services.rst b/docs/datalabeling_v1beta1/services.rst index 29f66fb..2ddfb76 100644 --- a/docs/datalabeling_v1beta1/services.rst +++ b/docs/datalabeling_v1beta1/services.rst @@ -1,6 +1,6 @@ Services for Google Cloud Datalabeling v1beta1 API ================================================== +.. toctree:: + :maxdepth: 2 -.. automodule:: google.cloud.datalabeling_v1beta1.services.data_labeling_service - :members: - :inherited-members: + data_labeling_service diff --git a/docs/datalabeling_v1beta1/types.rst b/docs/datalabeling_v1beta1/types.rst index 2722f06..452ea6c 100644 --- a/docs/datalabeling_v1beta1/types.rst +++ b/docs/datalabeling_v1beta1/types.rst @@ -3,4 +3,5 @@ Types for Google Cloud Datalabeling v1beta1 API .. automodule:: google.cloud.datalabeling_v1beta1.types :members: + :undoc-members: :show-inheritance: diff --git a/google/cloud/datalabeling_v1beta1/services/data_labeling_service/async_client.py b/google/cloud/datalabeling_v1beta1/services/data_labeling_service/async_client.py index 569bf03..76886fa 100644 --- a/google/cloud/datalabeling_v1beta1/services/data_labeling_service/async_client.py +++ b/google/cloud/datalabeling_v1beta1/services/data_labeling_service/async_client.py @@ -123,7 +123,36 @@ class DataLabelingServiceAsyncClient: DataLabelingServiceClient.parse_common_location_path ) - from_service_account_file = DataLabelingServiceClient.from_service_account_file + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + DataLabelingServiceAsyncClient: The constructed client. + """ + return DataLabelingServiceClient.from_service_account_info.__func__(DataLabelingServiceAsyncClient, info, *args, **kwargs) # type: ignore + + @classmethod + def from_service_account_file(cls, filename: str, *args, **kwargs): + """Creates an instance of this client using the provided credentials + file. + + Args: + filename (str): The path to the service account private key json + file. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + DataLabelingServiceAsyncClient: The constructed client. + """ + return DataLabelingServiceClient.from_service_account_file.__func__(DataLabelingServiceAsyncClient, filename, *args, **kwargs) # type: ignore + from_service_account_json = from_service_account_file @property @@ -202,15 +231,16 @@ async def create_dataset( resource. Args: - request (:class:`~.data_labeling_service.CreateDatasetRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.CreateDatasetRequest`): The request object. Request message for CreateDataset. parent (:class:`str`): Required. Dataset resource parent, format: projects/{project_id} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - dataset (:class:`~.gcd_dataset.Dataset`): + dataset (:class:`google.cloud.datalabeling_v1beta1.types.Dataset`): Required. The dataset to be created. This corresponds to the ``dataset`` field on the ``request`` instance; if ``request`` is provided, this @@ -223,7 +253,7 @@ async def create_dataset( sent along with the request as metadata. Returns: - ~.gcd_dataset.Dataset: + google.cloud.datalabeling_v1beta1.types.Dataset: Dataset is the resource to hold your data. You can request multiple labeling tasks for a dataset while each one will @@ -282,11 +312,12 @@ async def get_dataset( r"""Gets dataset by resource name. Args: - request (:class:`~.data_labeling_service.GetDatasetRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.GetDatasetRequest`): The request object. Request message for GetDataSet. name (:class:`str`): Required. Dataset resource name, format: projects/{project_id}/datasets/{dataset_id} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -298,7 +329,7 @@ async def get_dataset( sent along with the request as metadata. Returns: - ~.dataset.Dataset: + google.cloud.datalabeling_v1beta1.types.Dataset: Dataset is the resource to hold your data. You can request multiple labeling tasks for a dataset while each one will @@ -334,6 +365,7 @@ async def get_dataset( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -365,17 +397,19 @@ async def list_datasets( supported. Args: - request (:class:`~.data_labeling_service.ListDatasetsRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.ListDatasetsRequest`): The request object. Request message for ListDataset. parent (:class:`str`): Required. Dataset resource parent, format: projects/{project_id} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. filter (:class:`str`): Optional. Filter on dataset is not supported at this moment. + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -387,7 +421,7 @@ async def list_datasets( sent along with the request as metadata. Returns: - ~.pagers.ListDatasetsAsyncPager: + google.cloud.datalabeling_v1beta1.services.data_labeling_service.pagers.ListDatasetsAsyncPager: Results of listing datasets within a project. Iterating over this object will yield @@ -426,6 +460,7 @@ async def list_datasets( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -461,11 +496,12 @@ async def delete_dataset( r"""Deletes a dataset by resource name. Args: - request (:class:`~.data_labeling_service.DeleteDatasetRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.DeleteDatasetRequest`): The request object. Request message for DeleteDataset. name (:class:`str`): Required. Dataset resource name, format: projects/{project_id}/datasets/{dataset_id} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -505,6 +541,7 @@ async def delete_dataset( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -539,17 +576,19 @@ async def import_data( started while importing is still ongoing. Vice versa. Args: - request (:class:`~.data_labeling_service.ImportDataRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.ImportDataRequest`): The request object. Request message for ImportData API. name (:class:`str`): Required. Dataset resource name, format: projects/{project_id}/datasets/{dataset_id} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - input_config (:class:`~.dataset.InputConfig`): + input_config (:class:`google.cloud.datalabeling_v1beta1.types.InputConfig`): Required. Specify the input source of the data. + This corresponds to the ``input_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -561,11 +600,11 @@ async def import_data( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:``~.operations.ImportDataOperationResponse``: + :class:`google.cloud.datalabeling_v1beta1.types.ImportDataOperationResponse` Response used for ImportData longrunning operation. """ @@ -632,11 +671,12 @@ async def export_data( r"""Exports data and annotations from dataset. Args: - request (:class:`~.data_labeling_service.ExportDataRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.ExportDataRequest`): The request object. Request message for ExportData API. name (:class:`str`): Required. Dataset resource name, format: projects/{project_id}/datasets/{dataset_id} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -646,18 +686,21 @@ async def export_data( dataset will be exported. It's in format of projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/ {annotated_dataset_id} + This corresponds to the ``annotated_dataset`` field on the ``request`` instance; if ``request`` is provided, this should not be set. filter (:class:`str`): Optional. Filter is not supported at this moment. + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - output_config (:class:`~.dataset.OutputConfig`): + output_config (:class:`google.cloud.datalabeling_v1beta1.types.OutputConfig`): Required. Specify the output destination. + This corresponds to the ``output_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -669,11 +712,11 @@ async def export_data( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. The result type for the operation will be - :class:``~.operations.ExportDataOperationResponse``: + :class:`google.cloud.datalabeling_v1beta1.types.ExportDataOperationResponse` Response used for ExportDataset longrunning operation. """ @@ -712,6 +755,7 @@ async def export_data( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -750,11 +794,12 @@ async def get_data_item( API can be called after data are imported into dataset. Args: - request (:class:`~.data_labeling_service.GetDataItemRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.GetDataItemRequest`): The request object. Request message for GetDataItem. name (:class:`str`): Required. The name of the data item to get, format: projects/{project_id}/datasets/{dataset_id}/dataItems/{data_item_id} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -766,7 +811,7 @@ async def get_data_item( sent along with the request as metadata. Returns: - ~.dataset.DataItem: + google.cloud.datalabeling_v1beta1.types.DataItem: DataItem is a piece of data, without annotation. For example, an image. @@ -800,6 +845,7 @@ async def get_data_item( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -832,17 +878,19 @@ async def list_data_items( supported. Args: - request (:class:`~.data_labeling_service.ListDataItemsRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.ListDataItemsRequest`): The request object. Request message for ListDataItems. parent (:class:`str`): Required. Name of the dataset to list data items, format: projects/{project_id}/datasets/{dataset_id} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. filter (:class:`str`): Optional. Filter is not supported at this moment. + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -854,7 +902,7 @@ async def list_data_items( sent along with the request as metadata. Returns: - ~.pagers.ListDataItemsAsyncPager: + google.cloud.datalabeling_v1beta1.services.data_labeling_service.pagers.ListDataItemsAsyncPager: Results of listing data items in a dataset. Iterating over this object will yield @@ -893,6 +941,7 @@ async def list_data_items( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -928,13 +977,14 @@ async def get_annotated_dataset( r"""Gets an annotated dataset by resource name. Args: - request (:class:`~.data_labeling_service.GetAnnotatedDatasetRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.GetAnnotatedDatasetRequest`): The request object. Request message for GetAnnotatedDataset. name (:class:`str`): Required. Name of the annotated dataset to get, format: projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/ {annotated_dataset_id} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -946,7 +996,7 @@ async def get_annotated_dataset( sent along with the request as metadata. Returns: - ~.dataset.AnnotatedDataset: + google.cloud.datalabeling_v1beta1.types.AnnotatedDataset: AnnotatedDataset is a set holding annotations for data in a Dataset. Each labeling task will generate an @@ -983,6 +1033,7 @@ async def get_annotated_dataset( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -1014,19 +1065,21 @@ async def list_annotated_datasets( supported. Args: - request (:class:`~.data_labeling_service.ListAnnotatedDatasetsRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.ListAnnotatedDatasetsRequest`): The request object. Request message for ListAnnotatedDatasets. parent (:class:`str`): Required. Name of the dataset to list annotated datasets, format: projects/{project_id}/datasets/{dataset_id} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. filter (:class:`str`): Optional. Filter is not supported at this moment. + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1038,7 +1091,7 @@ async def list_annotated_datasets( sent along with the request as metadata. Returns: - ~.pagers.ListAnnotatedDatasetsAsyncPager: + google.cloud.datalabeling_v1beta1.services.data_labeling_service.pagers.ListAnnotatedDatasetsAsyncPager: Results of listing annotated datasets for a dataset. Iterating over this object will yield @@ -1077,6 +1130,7 @@ async def list_annotated_datasets( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -1111,7 +1165,7 @@ async def delete_annotated_dataset( r"""Deletes an annotated dataset by resource name. Args: - request (:class:`~.data_labeling_service.DeleteAnnotatedDatasetRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.DeleteAnnotatedDatasetRequest`): The request object. Request message for DeleteAnnotatedDataset. @@ -1159,24 +1213,27 @@ async def label_image( labeling task is configured by feature in the request. Args: - request (:class:`~.data_labeling_service.LabelImageRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.LabelImageRequest`): The request object. Request message for starting an image labeling task. parent (:class:`str`): Required. Name of the dataset to request labeling task, format: projects/{project_id}/datasets/{dataset_id} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - basic_config (:class:`~.human_annotation_config.HumanAnnotationConfig`): + basic_config (:class:`google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig`): Required. Basic human annotation config. + This corresponds to the ``basic_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - feature (:class:`~.data_labeling_service.LabelImageRequest.Feature`): + feature (:class:`google.cloud.datalabeling_v1beta1.types.LabelImageRequest.Feature`): Required. The type of image labeling task. + This corresponds to the ``feature`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1188,14 +1245,12 @@ async def label_image( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.dataset.AnnotatedDataset``: AnnotatedDataset - is a set holding annotations for data in a Dataset. Each - labeling task will generate an AnnotatedDataset under - the Dataset that the task is requested for. + The result type for the operation will be :class:`google.cloud.datalabeling_v1beta1.types.AnnotatedDataset` AnnotatedDataset is a set holding annotations for data in a Dataset. Each + labeling task will generate an AnnotatedDataset under + the Dataset that the task is requested for. """ # Create or coerce a protobuf request object. @@ -1263,23 +1318,26 @@ async def label_video( labeling task is configured by feature in the request. Args: - request (:class:`~.data_labeling_service.LabelVideoRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.LabelVideoRequest`): The request object. Request message for LabelVideo. parent (:class:`str`): Required. Name of the dataset to request labeling task, format: projects/{project_id}/datasets/{dataset_id} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - basic_config (:class:`~.human_annotation_config.HumanAnnotationConfig`): + basic_config (:class:`google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig`): Required. Basic human annotation config. + This corresponds to the ``basic_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - feature (:class:`~.data_labeling_service.LabelVideoRequest.Feature`): + feature (:class:`google.cloud.datalabeling_v1beta1.types.LabelVideoRequest.Feature`): Required. The type of video labeling task. + This corresponds to the ``feature`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1291,14 +1349,12 @@ async def label_video( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.dataset.AnnotatedDataset``: AnnotatedDataset - is a set holding annotations for data in a Dataset. Each - labeling task will generate an AnnotatedDataset under - the Dataset that the task is requested for. + The result type for the operation will be :class:`google.cloud.datalabeling_v1beta1.types.AnnotatedDataset` AnnotatedDataset is a set holding annotations for data in a Dataset. Each + labeling task will generate an AnnotatedDataset under + the Dataset that the task is requested for. """ # Create or coerce a protobuf request object. @@ -1366,23 +1422,26 @@ async def label_text( labeling task is configured by feature in the request. Args: - request (:class:`~.data_labeling_service.LabelTextRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.LabelTextRequest`): The request object. Request message for LabelText. parent (:class:`str`): Required. Name of the data set to request labeling task, format: projects/{project_id}/datasets/{dataset_id} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - basic_config (:class:`~.human_annotation_config.HumanAnnotationConfig`): + basic_config (:class:`google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig`): Required. Basic human annotation config. + This corresponds to the ``basic_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - feature (:class:`~.data_labeling_service.LabelTextRequest.Feature`): + feature (:class:`google.cloud.datalabeling_v1beta1.types.LabelTextRequest.Feature`): Required. The type of text labeling task. + This corresponds to the ``feature`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1394,14 +1453,12 @@ async def label_text( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.dataset.AnnotatedDataset``: AnnotatedDataset - is a set holding annotations for data in a Dataset. Each - labeling task will generate an AnnotatedDataset under - the Dataset that the task is requested for. + The result type for the operation will be :class:`google.cloud.datalabeling_v1beta1.types.AnnotatedDataset` AnnotatedDataset is a set holding annotations for data in a Dataset. Each + labeling task will generate an AnnotatedDataset under + the Dataset that the task is requested for. """ # Create or coerce a protobuf request object. @@ -1468,19 +1525,21 @@ async def get_example( and annotation. Args: - request (:class:`~.data_labeling_service.GetExampleRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.GetExampleRequest`): The request object. Request message for GetExample name (:class:`str`): Required. Name of example, format: projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/ {annotated_dataset_id}/examples/{example_id} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. filter (:class:`str`): Optional. An expression for filtering Examples. Filter by annotation_spec.display_name is supported. Format - "annotation_spec.display_name = {display_name}". + "annotation_spec.display_name = {display_name}" + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1492,7 +1551,7 @@ async def get_example( sent along with the request as metadata. Returns: - ~.dataset.Example: + google.cloud.datalabeling_v1beta1.types.Example: An Example is a piece of data and its annotation. For example, an image with label "house". @@ -1529,6 +1588,7 @@ async def get_example( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -1560,7 +1620,7 @@ async def list_examples( supported. Args: - request (:class:`~.data_labeling_service.ListExamplesRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.ListExamplesRequest`): The request object. Request message for ListExamples. parent (:class:`str`): Required. Example resource parent. @@ -1571,7 +1631,8 @@ async def list_examples( Optional. An expression for filtering Examples. For annotated datasets that have annotation spec set, filter by annotation_spec.display_name is supported. Format - "annotation_spec.display_name = {display_name}". + "annotation_spec.display_name = {display_name}" + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1583,7 +1644,7 @@ async def list_examples( sent along with the request as metadata. Returns: - ~.pagers.ListExamplesAsyncPager: + google.cloud.datalabeling_v1beta1.services.data_labeling_service.pagers.ListExamplesAsyncPager: Results of listing Examples in and annotated dataset. Iterating over this object will yield @@ -1622,6 +1683,7 @@ async def list_examples( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -1659,19 +1721,21 @@ async def create_annotation_spec_set( labels. Args: - request (:class:`~.data_labeling_service.CreateAnnotationSpecSetRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.CreateAnnotationSpecSetRequest`): The request object. Request message for CreateAnnotationSpecSet. parent (:class:`str`): Required. AnnotationSpecSet resource parent, format: projects/{project_id} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - annotation_spec_set (:class:`~.gcd_annotation_spec_set.AnnotationSpecSet`): + annotation_spec_set (:class:`google.cloud.datalabeling_v1beta1.types.AnnotationSpecSet`): Required. Annotation spec set to create. Annotation specs must be included. Only one annotation spec will be accepted for annotation specs with same display_name. + This corresponds to the ``annotation_spec_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1683,7 +1747,7 @@ async def create_annotation_spec_set( sent along with the request as metadata. Returns: - ~.gcd_annotation_spec_set.AnnotationSpecSet: + google.cloud.datalabeling_v1beta1.types.AnnotationSpecSet: An AnnotationSpecSet is a collection of label definitions. For example, in image classification tasks, you define a @@ -1744,12 +1808,13 @@ async def get_annotation_spec_set( r"""Gets an annotation spec set by resource name. Args: - request (:class:`~.data_labeling_service.GetAnnotationSpecSetRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.GetAnnotationSpecSetRequest`): The request object. Request message for GetAnnotationSpecSet. name (:class:`str`): Required. AnnotationSpecSet resource name, format: projects/{project_id}/annotationSpecSets/{annotation_spec_set_id} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1761,7 +1826,7 @@ async def get_annotation_spec_set( sent along with the request as metadata. Returns: - ~.annotation_spec_set.AnnotationSpecSet: + google.cloud.datalabeling_v1beta1.types.AnnotationSpecSet: An AnnotationSpecSet is a collection of label definitions. For example, in image classification tasks, you define a @@ -1799,6 +1864,7 @@ async def get_annotation_spec_set( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -1830,18 +1896,20 @@ async def list_annotation_spec_sets( is supported. Args: - request (:class:`~.data_labeling_service.ListAnnotationSpecSetsRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.ListAnnotationSpecSetsRequest`): The request object. Request message for ListAnnotationSpecSets. parent (:class:`str`): Required. Parent of AnnotationSpecSet resource, format: projects/{project_id} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. filter (:class:`str`): Optional. Filter is not supported at this moment. + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1853,7 +1921,7 @@ async def list_annotation_spec_sets( sent along with the request as metadata. Returns: - ~.pagers.ListAnnotationSpecSetsAsyncPager: + google.cloud.datalabeling_v1beta1.services.data_labeling_service.pagers.ListAnnotationSpecSetsAsyncPager: Results of listing annotation spec set under a project. Iterating over this object will yield @@ -1892,6 +1960,7 @@ async def list_annotation_spec_sets( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -1927,12 +1996,13 @@ async def delete_annotation_spec_set( r"""Deletes an annotation spec set by resource name. Args: - request (:class:`~.data_labeling_service.DeleteAnnotationSpecSetRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.DeleteAnnotationSpecSetRequest`): The request object. Request message for DeleteAnnotationSpecSet. name (:class:`str`): Required. AnnotationSpec resource name, format: ``projects/{project_id}/annotationSpecSets/{annotation_spec_set_id}``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1972,6 +2042,7 @@ async def delete_annotation_spec_set( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -2002,18 +2073,20 @@ async def create_instruction( labeled. Args: - request (:class:`~.data_labeling_service.CreateInstructionRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.CreateInstructionRequest`): The request object. Request message for CreateInstruction. parent (:class:`str`): Required. Instruction resource parent, format: projects/{project_id} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - instruction (:class:`~.gcd_instruction.Instruction`): + instruction (:class:`google.cloud.datalabeling_v1beta1.types.Instruction`): Required. Instruction of how to perform the labeling task. + This corresponds to the ``instruction`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2025,13 +2098,11 @@ async def create_instruction( sent along with the request as metadata. Returns: - ~.operation_async.AsyncOperation: + google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.gcd_instruction.Instruction``: Instruction of - how to perform the labeling task for human operators. - Currently only PDF instruction is supported. + The result type for the operation will be :class:`google.cloud.datalabeling_v1beta1.types.Instruction` Instruction of how to perform the labeling task for human operators. + Currently only PDF instruction is supported. """ # Create or coerce a protobuf request object. @@ -2094,11 +2165,12 @@ async def get_instruction( r"""Gets an instruction by resource name. Args: - request (:class:`~.data_labeling_service.GetInstructionRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.GetInstructionRequest`): The request object. Request message for GetInstruction. name (:class:`str`): Required. Instruction resource name, format: projects/{project_id}/instructions/{instruction_id} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2110,7 +2182,7 @@ async def get_instruction( sent along with the request as metadata. Returns: - ~.instruction.Instruction: + google.cloud.datalabeling_v1beta1.types.Instruction: Instruction of how to perform the labeling task for human operators. Currently only PDF instruction is @@ -2146,6 +2218,7 @@ async def get_instruction( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -2177,18 +2250,20 @@ async def list_instructions( supported. Args: - request (:class:`~.data_labeling_service.ListInstructionsRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.ListInstructionsRequest`): The request object. Request message for ListInstructions. parent (:class:`str`): Required. Instruction resource parent, format: projects/{project_id} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. filter (:class:`str`): Optional. Filter is not supported at this moment. + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2200,7 +2275,7 @@ async def list_instructions( sent along with the request as metadata. Returns: - ~.pagers.ListInstructionsAsyncPager: + google.cloud.datalabeling_v1beta1.services.data_labeling_service.pagers.ListInstructionsAsyncPager: Results of listing instructions under a project. Iterating over this object will yield @@ -2239,6 +2314,7 @@ async def list_instructions( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -2274,12 +2350,13 @@ async def delete_instruction( r"""Deletes an instruction object by resource name. Args: - request (:class:`~.data_labeling_service.DeleteInstructionRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.DeleteInstructionRequest`): The request object. Request message for DeleteInstruction. name (:class:`str`): Required. Instruction resource name, format: projects/{project_id}/instructions/{instruction_id} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2319,6 +2396,7 @@ async def delete_instruction( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -2348,12 +2426,13 @@ async def get_evaluation( [projects.evaluations.search][google.cloud.datalabeling.v1beta1.DataLabelingService.SearchEvaluations]). Args: - request (:class:`~.data_labeling_service.GetEvaluationRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.GetEvaluationRequest`): The request object. Request message for GetEvaluation. name (:class:`str`): Required. Name of the evaluation. Format: "projects/{project_id}/datasets/{dataset_id}/evaluations/{evaluation_id}' + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2365,12 +2444,11 @@ async def get_evaluation( sent along with the request as metadata. Returns: - ~.evaluation.Evaluation: - Describes an evaluation between a machine learning - model's predictions and ground truth labels. Created - when an - [EvaluationJob][google.cloud.datalabeling.v1beta1.EvaluationJob] - runs successfully. + google.cloud.datalabeling_v1beta1.types.Evaluation: + Describes an evaluation between a machine learning model's predictions and + ground truth labels. Created when an + [EvaluationJob][google.cloud.datalabeling.v1beta1.EvaluationJob] + runs successfully. """ # Create or coerce a protobuf request object. @@ -2402,6 +2480,7 @@ async def get_evaluation( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -2434,12 +2513,13 @@ async def search_evaluations( within a project. Args: - request (:class:`~.data_labeling_service.SearchEvaluationsRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.SearchEvaluationsRequest`): The request object. Request message for SearchEvaluation. parent (:class:`str`): Required. Evaluation search parent (project ID). Format: - "projects/{project_id}". + "projects/{project_id}" + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2476,7 +2556,8 @@ async def search_evaluations( {timestamp_1} AND evaluation*\ job.evaluation_job_run_time_end = {timestamp_2} AND annotation\_spec.display_name = - {display_name}". + {display_name}" + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2488,7 +2569,7 @@ async def search_evaluations( sent along with the request as metadata. Returns: - ~.pagers.SearchEvaluationsAsyncPager: + google.cloud.datalabeling_v1beta1.services.data_labeling_service.pagers.SearchEvaluationsAsyncPager: Results of searching evaluations. Iterating over this object will yield results and resolve additional pages @@ -2526,6 +2607,7 @@ async def search_evaluations( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -2564,7 +2646,7 @@ async def search_example_comparisons( Search by providing an evaluation ID. Args: - request (:class:`~.data_labeling_service.SearchExampleComparisonsRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.SearchExampleComparisonsRequest`): The request object. Request message of SearchExampleComparisons. parent (:class:`str`): @@ -2572,7 +2654,8 @@ async def search_example_comparisons( [Evaluation][google.cloud.datalabeling.v1beta1.Evaluation] resource to search for example comparisons from. Format: - "projects/{project_id}/datasets/{dataset_id}/evaluations/{evaluation_id}". + "projects/{project_id}/datasets/{dataset_id}/evaluations/{evaluation_id}" + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2584,7 +2667,7 @@ async def search_example_comparisons( sent along with the request as metadata. Returns: - ~.pagers.SearchExampleComparisonsAsyncPager: + google.cloud.datalabeling_v1beta1.services.data_labeling_service.pagers.SearchExampleComparisonsAsyncPager: Results of searching example comparisons. Iterating over this object will yield @@ -2649,18 +2732,20 @@ async def create_evaluation_job( r"""Creates an evaluation job. Args: - request (:class:`~.data_labeling_service.CreateEvaluationJobRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.CreateEvaluationJobRequest`): The request object. Request message for CreateEvaluationJob. parent (:class:`str`): Required. Evaluation job resource parent. Format: - "projects/{project_id}". + "projects/{project_id}" + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - job (:class:`~.evaluation_job.EvaluationJob`): + job (:class:`google.cloud.datalabeling_v1beta1.types.EvaluationJob`): Required. The evaluation job to create. + This corresponds to the ``job`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2672,13 +2757,13 @@ async def create_evaluation_job( sent along with the request as metadata. Returns: - ~.evaluation_job.EvaluationJob: - Defines an evaluation job that runs periodically to - generate - [Evaluations][google.cloud.datalabeling.v1beta1.Evaluation]. - `Creating an evaluation - job `__ - is the starting point for using continuous evaluation. + google.cloud.datalabeling_v1beta1.types.EvaluationJob: + Defines an evaluation job that runs periodically to generate + [Evaluations][google.cloud.datalabeling.v1beta1.Evaluation]. + [Creating an evaluation + job](/ml-engine/docs/continuous-evaluation/create-job) + is the starting point for using continuous + evaluation. """ # Create or coerce a protobuf request object. @@ -2741,16 +2826,17 @@ async def update_evaluation_job( you must delete the job and create a new one. Args: - request (:class:`~.data_labeling_service.UpdateEvaluationJobRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.UpdateEvaluationJobRequest`): The request object. Request message for UpdateEvaluationJob. - evaluation_job (:class:`~.gcd_evaluation_job.EvaluationJob`): + evaluation_job (:class:`google.cloud.datalabeling_v1beta1.types.EvaluationJob`): Required. Evaluation job that is going to be updated. + This corresponds to the ``evaluation_job`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): Optional. Mask for which fields to update. You can only provide the following fields: @@ -2760,6 +2846,7 @@ async def update_evaluation_job( You can provide more than one of these fields by separating them with commas. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2771,13 +2858,13 @@ async def update_evaluation_job( sent along with the request as metadata. Returns: - ~.gcd_evaluation_job.EvaluationJob: - Defines an evaluation job that runs periodically to - generate - [Evaluations][google.cloud.datalabeling.v1beta1.Evaluation]. - `Creating an evaluation - job `__ - is the starting point for using continuous evaluation. + google.cloud.datalabeling_v1beta1.types.EvaluationJob: + Defines an evaluation job that runs periodically to generate + [Evaluations][google.cloud.datalabeling.v1beta1.Evaluation]. + [Creating an evaluation + job](/ml-engine/docs/continuous-evaluation/create-job) + is the starting point for using continuous + evaluation. """ # Create or coerce a protobuf request object. @@ -2834,13 +2921,14 @@ async def get_evaluation_job( r"""Gets an evaluation job by resource name. Args: - request (:class:`~.data_labeling_service.GetEvaluationJobRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.GetEvaluationJobRequest`): The request object. Request message for GetEvaluationJob. name (:class:`str`): Required. Name of the evaluation job. Format: - "projects/{project_id}/evaluationJobs/{evaluation_job_id}". + "projects/{project_id}/evaluationJobs/{evaluation_job_id}" + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2852,13 +2940,13 @@ async def get_evaluation_job( sent along with the request as metadata. Returns: - ~.evaluation_job.EvaluationJob: - Defines an evaluation job that runs periodically to - generate - [Evaluations][google.cloud.datalabeling.v1beta1.Evaluation]. - `Creating an evaluation - job `__ - is the starting point for using continuous evaluation. + google.cloud.datalabeling_v1beta1.types.EvaluationJob: + Defines an evaluation job that runs periodically to generate + [Evaluations][google.cloud.datalabeling.v1beta1.Evaluation]. + [Creating an evaluation + job](/ml-engine/docs/continuous-evaluation/create-job) + is the starting point for using continuous + evaluation. """ # Create or coerce a protobuf request object. @@ -2890,6 +2978,7 @@ async def get_evaluation_job( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -2920,14 +3009,15 @@ async def pause_evaluation_job( already in a ``PAUSED`` state is a no-op. Args: - request (:class:`~.data_labeling_service.PauseEvaluationJobRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.PauseEvaluationJobRequest`): The request object. Request message for PauseEvaluationJob. name (:class:`str`): Required. Name of the evaluation job that is going to be paused. Format: - "projects/{project_id}/evaluationJobs/{evaluation_job_id}". + "projects/{project_id}/evaluationJobs/{evaluation_job_id}" + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2989,13 +3079,14 @@ async def resume_evaluation_job( evaluation job is a no-op. Args: - request (:class:`~.data_labeling_service.ResumeEvaluationJobRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.ResumeEvaluationJobRequest`): The request object. Request message ResumeEvaluationJob. name (:class:`str`): Required. Name of the evaluation job that is going to be resumed. Format: - "projects/{project_id}/evaluationJobs/{evaluation_job_id}". + "projects/{project_id}/evaluationJobs/{evaluation_job_id}" + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -3055,13 +3146,14 @@ async def delete_evaluation_job( r"""Stops and deletes an evaluation job. Args: - request (:class:`~.data_labeling_service.DeleteEvaluationJobRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.DeleteEvaluationJobRequest`): The request object. Request message DeleteEvaluationJob. name (:class:`str`): Required. Name of the evaluation job that is going to be deleted. Format: - "projects/{project_id}/evaluationJobs/{evaluation_job_id}". + "projects/{project_id}/evaluationJobs/{evaluation_job_id}" + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -3101,6 +3193,7 @@ async def delete_evaluation_job( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, @@ -3131,12 +3224,13 @@ async def list_evaluation_jobs( possible filters. Pagination is supported. Args: - request (:class:`~.data_labeling_service.ListEvaluationJobsRequest`): + request (:class:`google.cloud.datalabeling_v1beta1.types.ListEvaluationJobsRequest`): The request object. Request message for ListEvaluationJobs. parent (:class:`str`): Required. Evaluation job resource parent. Format: - "projects/{project_id}". + "projects/{project_id}" + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -3150,7 +3244,8 @@ async def list_evaluation_jobs( the ``OR`` operator. For example, you can use the following string for your filter: "evaluation\ *job.model_id = {model_name} AND - evaluation*\ job.state = {evaluation_job_state}". + evaluation*\ job.state = {evaluation_job_state}" + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -3162,7 +3257,7 @@ async def list_evaluation_jobs( sent along with the request as metadata. Returns: - ~.pagers.ListEvaluationJobsAsyncPager: + google.cloud.datalabeling_v1beta1.services.data_labeling_service.pagers.ListEvaluationJobsAsyncPager: Results for listing evaluation jobs. Iterating over this object will yield results and resolve additional pages @@ -3200,6 +3295,7 @@ async def list_evaluation_jobs( predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=DEFAULT_CLIENT_INFO, diff --git a/google/cloud/datalabeling_v1beta1/services/data_labeling_service/client.py b/google/cloud/datalabeling_v1beta1/services/data_labeling_service/client.py index c90d144..53148ec 100644 --- a/google/cloud/datalabeling_v1beta1/services/data_labeling_service/client.py +++ b/google/cloud/datalabeling_v1beta1/services/data_labeling_service/client.py @@ -131,6 +131,22 @@ def _get_default_mtls_endpoint(api_endpoint): DEFAULT_ENDPOINT ) + @classmethod + def from_service_account_info(cls, info: dict, *args, **kwargs): + """Creates an instance of this client using the provided credentials info. + + Args: + info (dict): The service account private key info. + args: Additional arguments to pass to the constructor. + kwargs: Additional arguments to pass to the constructor. + + Returns: + DataLabelingServiceClient: The constructed client. + """ + credentials = service_account.Credentials.from_service_account_info(info) + kwargs["credentials"] = credentials + return cls(*args, **kwargs) + @classmethod def from_service_account_file(cls, filename: str, *args, **kwargs): """Creates an instance of this client using the provided credentials @@ -143,7 +159,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): kwargs: Additional arguments to pass to the constructor. Returns: - {@api.name}: The constructed client. + DataLabelingServiceClient: The constructed client. """ credentials = service_account.Credentials.from_service_account_file(filename) kwargs["credentials"] = credentials @@ -365,10 +381,10 @@ def __init__( credentials identify the application to the service; if none are specified, the client will attempt to ascertain the credentials from the environment. - transport (Union[str, ~.DataLabelingServiceTransport]): The + transport (Union[str, DataLabelingServiceTransport]): The transport to use. If set to None, a transport is chosen automatically. - client_options (client_options_lib.ClientOptions): Custom options for the + client_options (google.api_core.client_options.ClientOptions): 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 @@ -404,21 +420,17 @@ def __init__( util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) ) - ssl_credentials = None + client_cert_source_func = None is_mtls = False if use_client_cert: if client_options.client_cert_source: - import grpc # type: ignore - - cert, key = client_options.client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) is_mtls = True + client_cert_source_func = client_options.client_cert_source else: - creds = SslCredentials() - is_mtls = creds.is_mtls - ssl_credentials = creds.ssl_credentials if is_mtls else None + is_mtls = mtls.has_default_client_cert_source() + client_cert_source_func = ( + mtls.default_client_cert_source() if is_mtls else None + ) # Figure out which api endpoint to use. if client_options.api_endpoint is not None: @@ -461,7 +473,7 @@ def __init__( credentials_file=client_options.credentials_file, host=api_endpoint, scopes=client_options.scopes, - ssl_channel_credentials=ssl_credentials, + client_cert_source_for_mtls=client_cert_source_func, quota_project_id=client_options.quota_project_id, client_info=client_info, ) @@ -480,15 +492,16 @@ def create_dataset( resource. Args: - request (:class:`~.data_labeling_service.CreateDatasetRequest`): + request (google.cloud.datalabeling_v1beta1.types.CreateDatasetRequest): The request object. Request message for CreateDataset. - parent (:class:`str`): + parent (str): Required. Dataset resource parent, format: projects/{project_id} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - dataset (:class:`~.gcd_dataset.Dataset`): + dataset (google.cloud.datalabeling_v1beta1.types.Dataset): Required. The dataset to be created. This corresponds to the ``dataset`` field on the ``request`` instance; if ``request`` is provided, this @@ -501,7 +514,7 @@ def create_dataset( sent along with the request as metadata. Returns: - ~.gcd_dataset.Dataset: + google.cloud.datalabeling_v1beta1.types.Dataset: Dataset is the resource to hold your data. You can request multiple labeling tasks for a dataset while each one will @@ -561,11 +574,12 @@ def get_dataset( r"""Gets dataset by resource name. Args: - request (:class:`~.data_labeling_service.GetDatasetRequest`): + request (google.cloud.datalabeling_v1beta1.types.GetDatasetRequest): The request object. Request message for GetDataSet. - name (:class:`str`): + name (str): Required. Dataset resource name, format: projects/{project_id}/datasets/{dataset_id} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -577,7 +591,7 @@ def get_dataset( sent along with the request as metadata. Returns: - ~.dataset.Dataset: + google.cloud.datalabeling_v1beta1.types.Dataset: Dataset is the resource to hold your data. You can request multiple labeling tasks for a dataset while each one will @@ -637,17 +651,19 @@ def list_datasets( supported. Args: - request (:class:`~.data_labeling_service.ListDatasetsRequest`): + request (google.cloud.datalabeling_v1beta1.types.ListDatasetsRequest): The request object. Request message for ListDataset. - parent (:class:`str`): + parent (str): Required. Dataset resource parent, format: projects/{project_id} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - filter (:class:`str`): + filter (str): Optional. Filter on dataset is not supported at this moment. + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -659,7 +675,7 @@ def list_datasets( sent along with the request as metadata. Returns: - ~.pagers.ListDatasetsPager: + google.cloud.datalabeling_v1beta1.services.data_labeling_service.pagers.ListDatasetsPager: Results of listing datasets within a project. Iterating over this object will yield @@ -726,11 +742,12 @@ def delete_dataset( r"""Deletes a dataset by resource name. Args: - request (:class:`~.data_labeling_service.DeleteDatasetRequest`): + request (google.cloud.datalabeling_v1beta1.types.DeleteDatasetRequest): The request object. Request message for DeleteDataset. - name (:class:`str`): + name (str): Required. Dataset resource name, format: projects/{project_id}/datasets/{dataset_id} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -797,17 +814,19 @@ def import_data( started while importing is still ongoing. Vice versa. Args: - request (:class:`~.data_labeling_service.ImportDataRequest`): + request (google.cloud.datalabeling_v1beta1.types.ImportDataRequest): The request object. Request message for ImportData API. - name (:class:`str`): + name (str): Required. Dataset resource name, format: projects/{project_id}/datasets/{dataset_id} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - input_config (:class:`~.dataset.InputConfig`): + input_config (google.cloud.datalabeling_v1beta1.types.InputConfig): Required. Specify the input source of the data. + This corresponds to the ``input_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -819,11 +838,11 @@ def import_data( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:``~.operations.ImportDataOperationResponse``: + :class:`google.cloud.datalabeling_v1beta1.types.ImportDataOperationResponse` Response used for ImportData longrunning operation. """ @@ -891,32 +910,36 @@ def export_data( r"""Exports data and annotations from dataset. Args: - request (:class:`~.data_labeling_service.ExportDataRequest`): + request (google.cloud.datalabeling_v1beta1.types.ExportDataRequest): The request object. Request message for ExportData API. - name (:class:`str`): + name (str): Required. Dataset resource name, format: projects/{project_id}/datasets/{dataset_id} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - annotated_dataset (:class:`str`): + annotated_dataset (str): Required. Annotated dataset resource name. DataItem in Dataset and their annotations in specified annotated dataset will be exported. It's in format of projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/ {annotated_dataset_id} + This corresponds to the ``annotated_dataset`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - filter (:class:`str`): + filter (str): Optional. Filter is not supported at this moment. + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - output_config (:class:`~.dataset.OutputConfig`): + output_config (google.cloud.datalabeling_v1beta1.types.OutputConfig): Required. Specify the output destination. + This corresponds to the ``output_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -928,11 +951,11 @@ def export_data( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. The result type for the operation will be - :class:``~.operations.ExportDataOperationResponse``: + :class:`google.cloud.datalabeling_v1beta1.types.ExportDataOperationResponse` Response used for ExportDataset longrunning operation. """ @@ -1002,11 +1025,12 @@ def get_data_item( API can be called after data are imported into dataset. Args: - request (:class:`~.data_labeling_service.GetDataItemRequest`): + request (google.cloud.datalabeling_v1beta1.types.GetDataItemRequest): The request object. Request message for GetDataItem. - name (:class:`str`): + name (str): Required. The name of the data item to get, format: projects/{project_id}/datasets/{dataset_id}/dataItems/{data_item_id} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1018,7 +1042,7 @@ def get_data_item( sent along with the request as metadata. Returns: - ~.dataset.DataItem: + google.cloud.datalabeling_v1beta1.types.DataItem: DataItem is a piece of data, without annotation. For example, an image. @@ -1077,17 +1101,19 @@ def list_data_items( supported. Args: - request (:class:`~.data_labeling_service.ListDataItemsRequest`): + request (google.cloud.datalabeling_v1beta1.types.ListDataItemsRequest): The request object. Request message for ListDataItems. - parent (:class:`str`): + parent (str): Required. Name of the dataset to list data items, format: projects/{project_id}/datasets/{dataset_id} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - filter (:class:`str`): + filter (str): Optional. Filter is not supported at this moment. + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1099,7 +1125,7 @@ def list_data_items( sent along with the request as metadata. Returns: - ~.pagers.ListDataItemsPager: + google.cloud.datalabeling_v1beta1.services.data_labeling_service.pagers.ListDataItemsPager: Results of listing data items in a dataset. Iterating over this object will yield @@ -1166,13 +1192,14 @@ def get_annotated_dataset( r"""Gets an annotated dataset by resource name. Args: - request (:class:`~.data_labeling_service.GetAnnotatedDatasetRequest`): + request (google.cloud.datalabeling_v1beta1.types.GetAnnotatedDatasetRequest): The request object. Request message for GetAnnotatedDataset. - name (:class:`str`): + name (str): Required. Name of the annotated dataset to get, format: projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/ {annotated_dataset_id} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1184,7 +1211,7 @@ def get_annotated_dataset( sent along with the request as metadata. Returns: - ~.dataset.AnnotatedDataset: + google.cloud.datalabeling_v1beta1.types.AnnotatedDataset: AnnotatedDataset is a set holding annotations for data in a Dataset. Each labeling task will generate an @@ -1245,19 +1272,21 @@ def list_annotated_datasets( supported. Args: - request (:class:`~.data_labeling_service.ListAnnotatedDatasetsRequest`): + request (google.cloud.datalabeling_v1beta1.types.ListAnnotatedDatasetsRequest): The request object. Request message for ListAnnotatedDatasets. - parent (:class:`str`): + parent (str): Required. Name of the dataset to list annotated datasets, format: projects/{project_id}/datasets/{dataset_id} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - filter (:class:`str`): + filter (str): Optional. Filter is not supported at this moment. + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1269,7 +1298,7 @@ def list_annotated_datasets( sent along with the request as metadata. Returns: - ~.pagers.ListAnnotatedDatasetsPager: + google.cloud.datalabeling_v1beta1.services.data_labeling_service.pagers.ListAnnotatedDatasetsPager: Results of listing annotated datasets for a dataset. Iterating over this object will yield @@ -1335,7 +1364,7 @@ def delete_annotated_dataset( r"""Deletes an annotated dataset by resource name. Args: - request (:class:`~.data_labeling_service.DeleteAnnotatedDatasetRequest`): + request (google.cloud.datalabeling_v1beta1.types.DeleteAnnotatedDatasetRequest): The request object. Request message for DeleteAnnotatedDataset. @@ -1384,24 +1413,27 @@ def label_image( labeling task is configured by feature in the request. Args: - request (:class:`~.data_labeling_service.LabelImageRequest`): + request (google.cloud.datalabeling_v1beta1.types.LabelImageRequest): The request object. Request message for starting an image labeling task. - parent (:class:`str`): + parent (str): Required. Name of the dataset to request labeling task, format: projects/{project_id}/datasets/{dataset_id} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - basic_config (:class:`~.human_annotation_config.HumanAnnotationConfig`): + basic_config (google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig): Required. Basic human annotation config. + This corresponds to the ``basic_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - feature (:class:`~.data_labeling_service.LabelImageRequest.Feature`): + feature (google.cloud.datalabeling_v1beta1.types.LabelImageRequest.Feature): Required. The type of image labeling task. + This corresponds to the ``feature`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1413,14 +1445,12 @@ def label_image( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.dataset.AnnotatedDataset``: AnnotatedDataset - is a set holding annotations for data in a Dataset. Each - labeling task will generate an AnnotatedDataset under - the Dataset that the task is requested for. + The result type for the operation will be :class:`google.cloud.datalabeling_v1beta1.types.AnnotatedDataset` AnnotatedDataset is a set holding annotations for data in a Dataset. Each + labeling task will generate an AnnotatedDataset under + the Dataset that the task is requested for. """ # Create or coerce a protobuf request object. @@ -1489,23 +1519,26 @@ def label_video( labeling task is configured by feature in the request. Args: - request (:class:`~.data_labeling_service.LabelVideoRequest`): + request (google.cloud.datalabeling_v1beta1.types.LabelVideoRequest): The request object. Request message for LabelVideo. - parent (:class:`str`): + parent (str): Required. Name of the dataset to request labeling task, format: projects/{project_id}/datasets/{dataset_id} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - basic_config (:class:`~.human_annotation_config.HumanAnnotationConfig`): + basic_config (google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig): Required. Basic human annotation config. + This corresponds to the ``basic_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - feature (:class:`~.data_labeling_service.LabelVideoRequest.Feature`): + feature (google.cloud.datalabeling_v1beta1.types.LabelVideoRequest.Feature): Required. The type of video labeling task. + This corresponds to the ``feature`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1517,14 +1550,12 @@ def label_video( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.dataset.AnnotatedDataset``: AnnotatedDataset - is a set holding annotations for data in a Dataset. Each - labeling task will generate an AnnotatedDataset under - the Dataset that the task is requested for. + The result type for the operation will be :class:`google.cloud.datalabeling_v1beta1.types.AnnotatedDataset` AnnotatedDataset is a set holding annotations for data in a Dataset. Each + labeling task will generate an AnnotatedDataset under + the Dataset that the task is requested for. """ # Create or coerce a protobuf request object. @@ -1593,23 +1624,26 @@ def label_text( labeling task is configured by feature in the request. Args: - request (:class:`~.data_labeling_service.LabelTextRequest`): + request (google.cloud.datalabeling_v1beta1.types.LabelTextRequest): The request object. Request message for LabelText. - parent (:class:`str`): + parent (str): Required. Name of the data set to request labeling task, format: projects/{project_id}/datasets/{dataset_id} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - basic_config (:class:`~.human_annotation_config.HumanAnnotationConfig`): + basic_config (google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig): Required. Basic human annotation config. + This corresponds to the ``basic_config`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - feature (:class:`~.data_labeling_service.LabelTextRequest.Feature`): + feature (google.cloud.datalabeling_v1beta1.types.LabelTextRequest.Feature): Required. The type of text labeling task. + This corresponds to the ``feature`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1621,14 +1655,12 @@ def label_text( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.dataset.AnnotatedDataset``: AnnotatedDataset - is a set holding annotations for data in a Dataset. Each - labeling task will generate an AnnotatedDataset under - the Dataset that the task is requested for. + The result type for the operation will be :class:`google.cloud.datalabeling_v1beta1.types.AnnotatedDataset` AnnotatedDataset is a set holding annotations for data in a Dataset. Each + labeling task will generate an AnnotatedDataset under + the Dataset that the task is requested for. """ # Create or coerce a protobuf request object. @@ -1696,19 +1728,21 @@ def get_example( and annotation. Args: - request (:class:`~.data_labeling_service.GetExampleRequest`): + request (google.cloud.datalabeling_v1beta1.types.GetExampleRequest): The request object. Request message for GetExample - name (:class:`str`): + name (str): Required. Name of example, format: projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/ {annotated_dataset_id}/examples/{example_id} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - filter (:class:`str`): + filter (str): Optional. An expression for filtering Examples. Filter by annotation_spec.display_name is supported. Format - "annotation_spec.display_name = {display_name}". + "annotation_spec.display_name = {display_name}" + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1720,7 +1754,7 @@ def get_example( sent along with the request as metadata. Returns: - ~.dataset.Example: + google.cloud.datalabeling_v1beta1.types.Example: An Example is a piece of data and its annotation. For example, an image with label "house". @@ -1781,18 +1815,19 @@ def list_examples( supported. Args: - request (:class:`~.data_labeling_service.ListExamplesRequest`): + request (google.cloud.datalabeling_v1beta1.types.ListExamplesRequest): The request object. Request message for ListExamples. - parent (:class:`str`): + parent (str): Required. Example resource parent. This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - filter (:class:`str`): + filter (str): Optional. An expression for filtering Examples. For annotated datasets that have annotation spec set, filter by annotation_spec.display_name is supported. Format - "annotation_spec.display_name = {display_name}". + "annotation_spec.display_name = {display_name}" + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1804,7 +1839,7 @@ def list_examples( sent along with the request as metadata. Returns: - ~.pagers.ListExamplesPager: + google.cloud.datalabeling_v1beta1.services.data_labeling_service.pagers.ListExamplesPager: Results of listing Examples in and annotated dataset. Iterating over this object will yield @@ -1873,19 +1908,21 @@ def create_annotation_spec_set( labels. Args: - request (:class:`~.data_labeling_service.CreateAnnotationSpecSetRequest`): + request (google.cloud.datalabeling_v1beta1.types.CreateAnnotationSpecSetRequest): The request object. Request message for CreateAnnotationSpecSet. - parent (:class:`str`): + parent (str): Required. AnnotationSpecSet resource parent, format: projects/{project_id} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - annotation_spec_set (:class:`~.gcd_annotation_spec_set.AnnotationSpecSet`): + annotation_spec_set (google.cloud.datalabeling_v1beta1.types.AnnotationSpecSet): Required. Annotation spec set to create. Annotation specs must be included. Only one annotation spec will be accepted for annotation specs with same display_name. + This corresponds to the ``annotation_spec_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1897,7 +1934,7 @@ def create_annotation_spec_set( sent along with the request as metadata. Returns: - ~.gcd_annotation_spec_set.AnnotationSpecSet: + google.cloud.datalabeling_v1beta1.types.AnnotationSpecSet: An AnnotationSpecSet is a collection of label definitions. For example, in image classification tasks, you define a @@ -1963,12 +2000,13 @@ def get_annotation_spec_set( r"""Gets an annotation spec set by resource name. Args: - request (:class:`~.data_labeling_service.GetAnnotationSpecSetRequest`): + request (google.cloud.datalabeling_v1beta1.types.GetAnnotationSpecSetRequest): The request object. Request message for GetAnnotationSpecSet. - name (:class:`str`): + name (str): Required. AnnotationSpecSet resource name, format: projects/{project_id}/annotationSpecSets/{annotation_spec_set_id} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -1980,7 +2018,7 @@ def get_annotation_spec_set( sent along with the request as metadata. Returns: - ~.annotation_spec_set.AnnotationSpecSet: + google.cloud.datalabeling_v1beta1.types.AnnotationSpecSet: An AnnotationSpecSet is a collection of label definitions. For example, in image classification tasks, you define a @@ -2042,18 +2080,20 @@ def list_annotation_spec_sets( is supported. Args: - request (:class:`~.data_labeling_service.ListAnnotationSpecSetsRequest`): + request (google.cloud.datalabeling_v1beta1.types.ListAnnotationSpecSetsRequest): The request object. Request message for ListAnnotationSpecSets. - parent (:class:`str`): + parent (str): Required. Parent of AnnotationSpecSet resource, format: projects/{project_id} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - filter (:class:`str`): + filter (str): Optional. Filter is not supported at this moment. + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2065,7 +2105,7 @@ def list_annotation_spec_sets( sent along with the request as metadata. Returns: - ~.pagers.ListAnnotationSpecSetsPager: + google.cloud.datalabeling_v1beta1.services.data_labeling_service.pagers.ListAnnotationSpecSetsPager: Results of listing annotation spec set under a project. Iterating over this object will yield @@ -2134,12 +2174,13 @@ def delete_annotation_spec_set( r"""Deletes an annotation spec set by resource name. Args: - request (:class:`~.data_labeling_service.DeleteAnnotationSpecSetRequest`): + request (google.cloud.datalabeling_v1beta1.types.DeleteAnnotationSpecSetRequest): The request object. Request message for DeleteAnnotationSpecSet. - name (:class:`str`): + name (str): Required. AnnotationSpec resource name, format: ``projects/{project_id}/annotationSpecSets/{annotation_spec_set_id}``. + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2206,18 +2247,20 @@ def create_instruction( labeled. Args: - request (:class:`~.data_labeling_service.CreateInstructionRequest`): + request (google.cloud.datalabeling_v1beta1.types.CreateInstructionRequest): The request object. Request message for CreateInstruction. - parent (:class:`str`): + parent (str): Required. Instruction resource parent, format: projects/{project_id} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - instruction (:class:`~.gcd_instruction.Instruction`): + instruction (google.cloud.datalabeling_v1beta1.types.Instruction): Required. Instruction of how to perform the labeling task. + This corresponds to the ``instruction`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2229,13 +2272,11 @@ def create_instruction( sent along with the request as metadata. Returns: - ~.operation.Operation: + google.api_core.operation.Operation: An object representing a long-running operation. - The result type for the operation will be - :class:``~.gcd_instruction.Instruction``: Instruction of - how to perform the labeling task for human operators. - Currently only PDF instruction is supported. + The result type for the operation will be :class:`google.cloud.datalabeling_v1beta1.types.Instruction` Instruction of how to perform the labeling task for human operators. + Currently only PDF instruction is supported. """ # Create or coerce a protobuf request object. @@ -2299,11 +2340,12 @@ def get_instruction( r"""Gets an instruction by resource name. Args: - request (:class:`~.data_labeling_service.GetInstructionRequest`): + request (google.cloud.datalabeling_v1beta1.types.GetInstructionRequest): The request object. Request message for GetInstruction. - name (:class:`str`): + name (str): Required. Instruction resource name, format: projects/{project_id}/instructions/{instruction_id} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2315,7 +2357,7 @@ def get_instruction( sent along with the request as metadata. Returns: - ~.instruction.Instruction: + google.cloud.datalabeling_v1beta1.types.Instruction: Instruction of how to perform the labeling task for human operators. Currently only PDF instruction is @@ -2375,18 +2417,20 @@ def list_instructions( supported. Args: - request (:class:`~.data_labeling_service.ListInstructionsRequest`): + request (google.cloud.datalabeling_v1beta1.types.ListInstructionsRequest): The request object. Request message for ListInstructions. - parent (:class:`str`): + parent (str): Required. Instruction resource parent, format: projects/{project_id} + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - filter (:class:`str`): + filter (str): Optional. Filter is not supported at this moment. + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2398,7 +2442,7 @@ def list_instructions( sent along with the request as metadata. Returns: - ~.pagers.ListInstructionsPager: + google.cloud.datalabeling_v1beta1.services.data_labeling_service.pagers.ListInstructionsPager: Results of listing instructions under a project. Iterating over this object will yield @@ -2465,12 +2509,13 @@ def delete_instruction( r"""Deletes an instruction object by resource name. Args: - request (:class:`~.data_labeling_service.DeleteInstructionRequest`): + request (google.cloud.datalabeling_v1beta1.types.DeleteInstructionRequest): The request object. Request message for DeleteInstruction. - name (:class:`str`): + name (str): Required. Instruction resource name, format: projects/{project_id}/instructions/{instruction_id} + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2532,12 +2577,13 @@ def get_evaluation( [projects.evaluations.search][google.cloud.datalabeling.v1beta1.DataLabelingService.SearchEvaluations]). Args: - request (:class:`~.data_labeling_service.GetEvaluationRequest`): + request (google.cloud.datalabeling_v1beta1.types.GetEvaluationRequest): The request object. Request message for GetEvaluation. - name (:class:`str`): + name (str): Required. Name of the evaluation. Format: "projects/{project_id}/datasets/{dataset_id}/evaluations/{evaluation_id}' + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2549,12 +2595,11 @@ def get_evaluation( sent along with the request as metadata. Returns: - ~.evaluation.Evaluation: - Describes an evaluation between a machine learning - model's predictions and ground truth labels. Created - when an - [EvaluationJob][google.cloud.datalabeling.v1beta1.EvaluationJob] - runs successfully. + google.cloud.datalabeling_v1beta1.types.Evaluation: + Describes an evaluation between a machine learning model's predictions and + ground truth labels. Created when an + [EvaluationJob][google.cloud.datalabeling.v1beta1.EvaluationJob] + runs successfully. """ # Create or coerce a protobuf request object. @@ -2611,16 +2656,17 @@ def search_evaluations( within a project. Args: - request (:class:`~.data_labeling_service.SearchEvaluationsRequest`): + request (google.cloud.datalabeling_v1beta1.types.SearchEvaluationsRequest): The request object. Request message for SearchEvaluation. - parent (:class:`str`): + parent (str): Required. Evaluation search parent (project ID). Format: - "projects/{project_id}". + "projects/{project_id}" + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - filter (:class:`str`): + filter (str): Optional. To search evaluations, you can filter by the following: @@ -2653,7 +2699,8 @@ def search_evaluations( {timestamp_1} AND evaluation*\ job.evaluation_job_run_time_end = {timestamp_2} AND annotation\_spec.display_name = - {display_name}". + {display_name}" + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2665,7 +2712,7 @@ def search_evaluations( sent along with the request as metadata. Returns: - ~.pagers.SearchEvaluationsPager: + google.cloud.datalabeling_v1beta1.services.data_labeling_service.pagers.SearchEvaluationsPager: Results of searching evaluations. Iterating over this object will yield results and resolve additional pages @@ -2734,15 +2781,16 @@ def search_example_comparisons( Search by providing an evaluation ID. Args: - request (:class:`~.data_labeling_service.SearchExampleComparisonsRequest`): + request (google.cloud.datalabeling_v1beta1.types.SearchExampleComparisonsRequest): The request object. Request message of SearchExampleComparisons. - parent (:class:`str`): + parent (str): Required. Name of the [Evaluation][google.cloud.datalabeling.v1beta1.Evaluation] resource to search for example comparisons from. Format: - "projects/{project_id}/datasets/{dataset_id}/evaluations/{evaluation_id}". + "projects/{project_id}/datasets/{dataset_id}/evaluations/{evaluation_id}" + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2754,7 +2802,7 @@ def search_example_comparisons( sent along with the request as metadata. Returns: - ~.pagers.SearchExampleComparisonsPager: + google.cloud.datalabeling_v1beta1.services.data_labeling_service.pagers.SearchExampleComparisonsPager: Results of searching example comparisons. Iterating over this object will yield @@ -2824,18 +2872,20 @@ def create_evaluation_job( r"""Creates an evaluation job. Args: - request (:class:`~.data_labeling_service.CreateEvaluationJobRequest`): + request (google.cloud.datalabeling_v1beta1.types.CreateEvaluationJobRequest): The request object. Request message for CreateEvaluationJob. - parent (:class:`str`): + parent (str): Required. Evaluation job resource parent. Format: - "projects/{project_id}". + "projects/{project_id}" + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - job (:class:`~.evaluation_job.EvaluationJob`): + job (google.cloud.datalabeling_v1beta1.types.EvaluationJob): Required. The evaluation job to create. + This corresponds to the ``job`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2847,13 +2897,13 @@ def create_evaluation_job( sent along with the request as metadata. Returns: - ~.evaluation_job.EvaluationJob: - Defines an evaluation job that runs periodically to - generate - [Evaluations][google.cloud.datalabeling.v1beta1.Evaluation]. - `Creating an evaluation - job `__ - is the starting point for using continuous evaluation. + google.cloud.datalabeling_v1beta1.types.EvaluationJob: + Defines an evaluation job that runs periodically to generate + [Evaluations][google.cloud.datalabeling.v1beta1.Evaluation]. + [Creating an evaluation + job](/ml-engine/docs/continuous-evaluation/create-job) + is the starting point for using continuous + evaluation. """ # Create or coerce a protobuf request object. @@ -2917,16 +2967,17 @@ def update_evaluation_job( you must delete the job and create a new one. Args: - request (:class:`~.data_labeling_service.UpdateEvaluationJobRequest`): + request (google.cloud.datalabeling_v1beta1.types.UpdateEvaluationJobRequest): The request object. Request message for UpdateEvaluationJob. - evaluation_job (:class:`~.gcd_evaluation_job.EvaluationJob`): + evaluation_job (google.cloud.datalabeling_v1beta1.types.EvaluationJob): Required. Evaluation job that is going to be updated. + This corresponds to the ``evaluation_job`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`~.field_mask.FieldMask`): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Optional. Mask for which fields to update. You can only provide the following fields: @@ -2936,6 +2987,7 @@ def update_evaluation_job( You can provide more than one of these fields by separating them with commas. + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -2947,13 +2999,13 @@ def update_evaluation_job( sent along with the request as metadata. Returns: - ~.gcd_evaluation_job.EvaluationJob: - Defines an evaluation job that runs periodically to - generate - [Evaluations][google.cloud.datalabeling.v1beta1.Evaluation]. - `Creating an evaluation - job `__ - is the starting point for using continuous evaluation. + google.cloud.datalabeling_v1beta1.types.EvaluationJob: + Defines an evaluation job that runs periodically to generate + [Evaluations][google.cloud.datalabeling.v1beta1.Evaluation]. + [Creating an evaluation + job](/ml-engine/docs/continuous-evaluation/create-job) + is the starting point for using continuous + evaluation. """ # Create or coerce a protobuf request object. @@ -3011,13 +3063,14 @@ def get_evaluation_job( r"""Gets an evaluation job by resource name. Args: - request (:class:`~.data_labeling_service.GetEvaluationJobRequest`): + request (google.cloud.datalabeling_v1beta1.types.GetEvaluationJobRequest): The request object. Request message for GetEvaluationJob. - name (:class:`str`): + name (str): Required. Name of the evaluation job. Format: - "projects/{project_id}/evaluationJobs/{evaluation_job_id}". + "projects/{project_id}/evaluationJobs/{evaluation_job_id}" + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -3029,13 +3082,13 @@ def get_evaluation_job( sent along with the request as metadata. Returns: - ~.evaluation_job.EvaluationJob: - Defines an evaluation job that runs periodically to - generate - [Evaluations][google.cloud.datalabeling.v1beta1.Evaluation]. - `Creating an evaluation - job `__ - is the starting point for using continuous evaluation. + google.cloud.datalabeling_v1beta1.types.EvaluationJob: + Defines an evaluation job that runs periodically to generate + [Evaluations][google.cloud.datalabeling.v1beta1.Evaluation]. + [Creating an evaluation + job](/ml-engine/docs/continuous-evaluation/create-job) + is the starting point for using continuous + evaluation. """ # Create or coerce a protobuf request object. @@ -3090,14 +3143,15 @@ def pause_evaluation_job( already in a ``PAUSED`` state is a no-op. Args: - request (:class:`~.data_labeling_service.PauseEvaluationJobRequest`): + request (google.cloud.datalabeling_v1beta1.types.PauseEvaluationJobRequest): The request object. Request message for PauseEvaluationJob. - name (:class:`str`): + name (str): Required. Name of the evaluation job that is going to be paused. Format: - "projects/{project_id}/evaluationJobs/{evaluation_job_id}". + "projects/{project_id}/evaluationJobs/{evaluation_job_id}" + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -3160,13 +3214,14 @@ def resume_evaluation_job( evaluation job is a no-op. Args: - request (:class:`~.data_labeling_service.ResumeEvaluationJobRequest`): + request (google.cloud.datalabeling_v1beta1.types.ResumeEvaluationJobRequest): The request object. Request message ResumeEvaluationJob. - name (:class:`str`): + name (str): Required. Name of the evaluation job that is going to be resumed. Format: - "projects/{project_id}/evaluationJobs/{evaluation_job_id}". + "projects/{project_id}/evaluationJobs/{evaluation_job_id}" + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -3227,13 +3282,14 @@ def delete_evaluation_job( r"""Stops and deletes an evaluation job. Args: - request (:class:`~.data_labeling_service.DeleteEvaluationJobRequest`): + request (google.cloud.datalabeling_v1beta1.types.DeleteEvaluationJobRequest): The request object. Request message DeleteEvaluationJob. - name (:class:`str`): + name (str): Required. Name of the evaluation job that is going to be deleted. Format: - "projects/{project_id}/evaluationJobs/{evaluation_job_id}". + "projects/{project_id}/evaluationJobs/{evaluation_job_id}" + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -3296,16 +3352,17 @@ def list_evaluation_jobs( possible filters. Pagination is supported. Args: - request (:class:`~.data_labeling_service.ListEvaluationJobsRequest`): + request (google.cloud.datalabeling_v1beta1.types.ListEvaluationJobsRequest): The request object. Request message for ListEvaluationJobs. - parent (:class:`str`): + parent (str): Required. Evaluation job resource parent. Format: - "projects/{project_id}". + "projects/{project_id}" + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - filter (:class:`str`): + filter (str): Optional. You can filter the jobs to list by model_id (also known as model_name, as described in [EvaluationJob.modelVersion][google.cloud.datalabeling.v1beta1.EvaluationJob.model_version]) @@ -3315,7 +3372,8 @@ def list_evaluation_jobs( the ``OR`` operator. For example, you can use the following string for your filter: "evaluation\ *job.model_id = {model_name} AND - evaluation*\ job.state = {evaluation_job_state}". + evaluation*\ job.state = {evaluation_job_state}" + This corresponds to the ``filter`` field on the ``request`` instance; if ``request`` is provided, this should not be set. @@ -3327,7 +3385,7 @@ def list_evaluation_jobs( sent along with the request as metadata. Returns: - ~.pagers.ListEvaluationJobsPager: + google.cloud.datalabeling_v1beta1.services.data_labeling_service.pagers.ListEvaluationJobsPager: Results for listing evaluation jobs. Iterating over this object will yield results and resolve additional pages diff --git a/google/cloud/datalabeling_v1beta1/services/data_labeling_service/pagers.py b/google/cloud/datalabeling_v1beta1/services/data_labeling_service/pagers.py index 1b12902..a72dee5 100644 --- a/google/cloud/datalabeling_v1beta1/services/data_labeling_service/pagers.py +++ b/google/cloud/datalabeling_v1beta1/services/data_labeling_service/pagers.py @@ -15,7 +15,16 @@ # limitations under the License. # -from typing import Any, AsyncIterable, Awaitable, Callable, Iterable, Sequence, Tuple +from typing import ( + Any, + AsyncIterable, + Awaitable, + Callable, + Iterable, + Sequence, + Tuple, + Optional, +) from google.cloud.datalabeling_v1beta1.types import annotation_spec_set from google.cloud.datalabeling_v1beta1.types import data_labeling_service @@ -29,7 +38,7 @@ class ListDatasetsPager: """A pager for iterating through ``list_datasets`` requests. This class thinly wraps an initial - :class:`~.data_labeling_service.ListDatasetsResponse` object, and + :class:`google.cloud.datalabeling_v1beta1.types.ListDatasetsResponse` object, and provides an ``__iter__`` method to iterate through its ``datasets`` field. @@ -38,7 +47,7 @@ class ListDatasetsPager: through the ``datasets`` field on the corresponding responses. - All the usual :class:`~.data_labeling_service.ListDatasetsResponse` + All the usual :class:`google.cloud.datalabeling_v1beta1.types.ListDatasetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -56,9 +65,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.data_labeling_service.ListDatasetsRequest`): + request (google.cloud.datalabeling_v1beta1.types.ListDatasetsRequest): The initial request object. - response (:class:`~.data_labeling_service.ListDatasetsResponse`): + response (google.cloud.datalabeling_v1beta1.types.ListDatasetsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -91,7 +100,7 @@ class ListDatasetsAsyncPager: """A pager for iterating through ``list_datasets`` requests. This class thinly wraps an initial - :class:`~.data_labeling_service.ListDatasetsResponse` object, and + :class:`google.cloud.datalabeling_v1beta1.types.ListDatasetsResponse` object, and provides an ``__aiter__`` method to iterate through its ``datasets`` field. @@ -100,7 +109,7 @@ class ListDatasetsAsyncPager: through the ``datasets`` field on the corresponding responses. - All the usual :class:`~.data_labeling_service.ListDatasetsResponse` + All the usual :class:`google.cloud.datalabeling_v1beta1.types.ListDatasetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -118,9 +127,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.data_labeling_service.ListDatasetsRequest`): + request (google.cloud.datalabeling_v1beta1.types.ListDatasetsRequest): The initial request object. - response (:class:`~.data_labeling_service.ListDatasetsResponse`): + response (google.cloud.datalabeling_v1beta1.types.ListDatasetsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -157,7 +166,7 @@ class ListDataItemsPager: """A pager for iterating through ``list_data_items`` requests. This class thinly wraps an initial - :class:`~.data_labeling_service.ListDataItemsResponse` object, and + :class:`google.cloud.datalabeling_v1beta1.types.ListDataItemsResponse` object, and provides an ``__iter__`` method to iterate through its ``data_items`` field. @@ -166,7 +175,7 @@ class ListDataItemsPager: through the ``data_items`` field on the corresponding responses. - All the usual :class:`~.data_labeling_service.ListDataItemsResponse` + All the usual :class:`google.cloud.datalabeling_v1beta1.types.ListDataItemsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -184,9 +193,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.data_labeling_service.ListDataItemsRequest`): + request (google.cloud.datalabeling_v1beta1.types.ListDataItemsRequest): The initial request object. - response (:class:`~.data_labeling_service.ListDataItemsResponse`): + response (google.cloud.datalabeling_v1beta1.types.ListDataItemsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -219,7 +228,7 @@ class ListDataItemsAsyncPager: """A pager for iterating through ``list_data_items`` requests. This class thinly wraps an initial - :class:`~.data_labeling_service.ListDataItemsResponse` object, and + :class:`google.cloud.datalabeling_v1beta1.types.ListDataItemsResponse` object, and provides an ``__aiter__`` method to iterate through its ``data_items`` field. @@ -228,7 +237,7 @@ class ListDataItemsAsyncPager: through the ``data_items`` field on the corresponding responses. - All the usual :class:`~.data_labeling_service.ListDataItemsResponse` + All the usual :class:`google.cloud.datalabeling_v1beta1.types.ListDataItemsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -246,9 +255,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.data_labeling_service.ListDataItemsRequest`): + request (google.cloud.datalabeling_v1beta1.types.ListDataItemsRequest): The initial request object. - response (:class:`~.data_labeling_service.ListDataItemsResponse`): + response (google.cloud.datalabeling_v1beta1.types.ListDataItemsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -285,7 +294,7 @@ class ListAnnotatedDatasetsPager: """A pager for iterating through ``list_annotated_datasets`` requests. This class thinly wraps an initial - :class:`~.data_labeling_service.ListAnnotatedDatasetsResponse` object, and + :class:`google.cloud.datalabeling_v1beta1.types.ListAnnotatedDatasetsResponse` object, and provides an ``__iter__`` method to iterate through its ``annotated_datasets`` field. @@ -294,7 +303,7 @@ class ListAnnotatedDatasetsPager: through the ``annotated_datasets`` field on the corresponding responses. - All the usual :class:`~.data_labeling_service.ListAnnotatedDatasetsResponse` + All the usual :class:`google.cloud.datalabeling_v1beta1.types.ListAnnotatedDatasetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -312,9 +321,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.data_labeling_service.ListAnnotatedDatasetsRequest`): + request (google.cloud.datalabeling_v1beta1.types.ListAnnotatedDatasetsRequest): The initial request object. - response (:class:`~.data_labeling_service.ListAnnotatedDatasetsResponse`): + response (google.cloud.datalabeling_v1beta1.types.ListAnnotatedDatasetsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -347,7 +356,7 @@ class ListAnnotatedDatasetsAsyncPager: """A pager for iterating through ``list_annotated_datasets`` requests. This class thinly wraps an initial - :class:`~.data_labeling_service.ListAnnotatedDatasetsResponse` object, and + :class:`google.cloud.datalabeling_v1beta1.types.ListAnnotatedDatasetsResponse` object, and provides an ``__aiter__`` method to iterate through its ``annotated_datasets`` field. @@ -356,7 +365,7 @@ class ListAnnotatedDatasetsAsyncPager: through the ``annotated_datasets`` field on the corresponding responses. - All the usual :class:`~.data_labeling_service.ListAnnotatedDatasetsResponse` + All the usual :class:`google.cloud.datalabeling_v1beta1.types.ListAnnotatedDatasetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -376,9 +385,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.data_labeling_service.ListAnnotatedDatasetsRequest`): + request (google.cloud.datalabeling_v1beta1.types.ListAnnotatedDatasetsRequest): The initial request object. - response (:class:`~.data_labeling_service.ListAnnotatedDatasetsResponse`): + response (google.cloud.datalabeling_v1beta1.types.ListAnnotatedDatasetsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -417,7 +426,7 @@ class ListExamplesPager: """A pager for iterating through ``list_examples`` requests. This class thinly wraps an initial - :class:`~.data_labeling_service.ListExamplesResponse` object, and + :class:`google.cloud.datalabeling_v1beta1.types.ListExamplesResponse` object, and provides an ``__iter__`` method to iterate through its ``examples`` field. @@ -426,7 +435,7 @@ class ListExamplesPager: through the ``examples`` field on the corresponding responses. - All the usual :class:`~.data_labeling_service.ListExamplesResponse` + All the usual :class:`google.cloud.datalabeling_v1beta1.types.ListExamplesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -444,9 +453,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.data_labeling_service.ListExamplesRequest`): + request (google.cloud.datalabeling_v1beta1.types.ListExamplesRequest): The initial request object. - response (:class:`~.data_labeling_service.ListExamplesResponse`): + response (google.cloud.datalabeling_v1beta1.types.ListExamplesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -479,7 +488,7 @@ class ListExamplesAsyncPager: """A pager for iterating through ``list_examples`` requests. This class thinly wraps an initial - :class:`~.data_labeling_service.ListExamplesResponse` object, and + :class:`google.cloud.datalabeling_v1beta1.types.ListExamplesResponse` object, and provides an ``__aiter__`` method to iterate through its ``examples`` field. @@ -488,7 +497,7 @@ class ListExamplesAsyncPager: through the ``examples`` field on the corresponding responses. - All the usual :class:`~.data_labeling_service.ListExamplesResponse` + All the usual :class:`google.cloud.datalabeling_v1beta1.types.ListExamplesResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -506,9 +515,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.data_labeling_service.ListExamplesRequest`): + request (google.cloud.datalabeling_v1beta1.types.ListExamplesRequest): The initial request object. - response (:class:`~.data_labeling_service.ListExamplesResponse`): + response (google.cloud.datalabeling_v1beta1.types.ListExamplesResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -545,7 +554,7 @@ class ListAnnotationSpecSetsPager: """A pager for iterating through ``list_annotation_spec_sets`` requests. This class thinly wraps an initial - :class:`~.data_labeling_service.ListAnnotationSpecSetsResponse` object, and + :class:`google.cloud.datalabeling_v1beta1.types.ListAnnotationSpecSetsResponse` object, and provides an ``__iter__`` method to iterate through its ``annotation_spec_sets`` field. @@ -554,7 +563,7 @@ class ListAnnotationSpecSetsPager: through the ``annotation_spec_sets`` field on the corresponding responses. - All the usual :class:`~.data_labeling_service.ListAnnotationSpecSetsResponse` + All the usual :class:`google.cloud.datalabeling_v1beta1.types.ListAnnotationSpecSetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -572,9 +581,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.data_labeling_service.ListAnnotationSpecSetsRequest`): + request (google.cloud.datalabeling_v1beta1.types.ListAnnotationSpecSetsRequest): The initial request object. - response (:class:`~.data_labeling_service.ListAnnotationSpecSetsResponse`): + response (google.cloud.datalabeling_v1beta1.types.ListAnnotationSpecSetsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -607,7 +616,7 @@ class ListAnnotationSpecSetsAsyncPager: """A pager for iterating through ``list_annotation_spec_sets`` requests. This class thinly wraps an initial - :class:`~.data_labeling_service.ListAnnotationSpecSetsResponse` object, and + :class:`google.cloud.datalabeling_v1beta1.types.ListAnnotationSpecSetsResponse` object, and provides an ``__aiter__`` method to iterate through its ``annotation_spec_sets`` field. @@ -616,7 +625,7 @@ class ListAnnotationSpecSetsAsyncPager: through the ``annotation_spec_sets`` field on the corresponding responses. - All the usual :class:`~.data_labeling_service.ListAnnotationSpecSetsResponse` + All the usual :class:`google.cloud.datalabeling_v1beta1.types.ListAnnotationSpecSetsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -636,9 +645,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.data_labeling_service.ListAnnotationSpecSetsRequest`): + request (google.cloud.datalabeling_v1beta1.types.ListAnnotationSpecSetsRequest): The initial request object. - response (:class:`~.data_labeling_service.ListAnnotationSpecSetsResponse`): + response (google.cloud.datalabeling_v1beta1.types.ListAnnotationSpecSetsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -677,7 +686,7 @@ class ListInstructionsPager: """A pager for iterating through ``list_instructions`` requests. This class thinly wraps an initial - :class:`~.data_labeling_service.ListInstructionsResponse` object, and + :class:`google.cloud.datalabeling_v1beta1.types.ListInstructionsResponse` object, and provides an ``__iter__`` method to iterate through its ``instructions`` field. @@ -686,7 +695,7 @@ class ListInstructionsPager: through the ``instructions`` field on the corresponding responses. - All the usual :class:`~.data_labeling_service.ListInstructionsResponse` + All the usual :class:`google.cloud.datalabeling_v1beta1.types.ListInstructionsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -704,9 +713,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.data_labeling_service.ListInstructionsRequest`): + request (google.cloud.datalabeling_v1beta1.types.ListInstructionsRequest): The initial request object. - response (:class:`~.data_labeling_service.ListInstructionsResponse`): + response (google.cloud.datalabeling_v1beta1.types.ListInstructionsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -739,7 +748,7 @@ class ListInstructionsAsyncPager: """A pager for iterating through ``list_instructions`` requests. This class thinly wraps an initial - :class:`~.data_labeling_service.ListInstructionsResponse` object, and + :class:`google.cloud.datalabeling_v1beta1.types.ListInstructionsResponse` object, and provides an ``__aiter__`` method to iterate through its ``instructions`` field. @@ -748,7 +757,7 @@ class ListInstructionsAsyncPager: through the ``instructions`` field on the corresponding responses. - All the usual :class:`~.data_labeling_service.ListInstructionsResponse` + All the usual :class:`google.cloud.datalabeling_v1beta1.types.ListInstructionsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -768,9 +777,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.data_labeling_service.ListInstructionsRequest`): + request (google.cloud.datalabeling_v1beta1.types.ListInstructionsRequest): The initial request object. - response (:class:`~.data_labeling_service.ListInstructionsResponse`): + response (google.cloud.datalabeling_v1beta1.types.ListInstructionsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -809,7 +818,7 @@ class SearchEvaluationsPager: """A pager for iterating through ``search_evaluations`` requests. This class thinly wraps an initial - :class:`~.data_labeling_service.SearchEvaluationsResponse` object, and + :class:`google.cloud.datalabeling_v1beta1.types.SearchEvaluationsResponse` object, and provides an ``__iter__`` method to iterate through its ``evaluations`` field. @@ -818,7 +827,7 @@ class SearchEvaluationsPager: through the ``evaluations`` field on the corresponding responses. - All the usual :class:`~.data_labeling_service.SearchEvaluationsResponse` + All the usual :class:`google.cloud.datalabeling_v1beta1.types.SearchEvaluationsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -836,9 +845,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.data_labeling_service.SearchEvaluationsRequest`): + request (google.cloud.datalabeling_v1beta1.types.SearchEvaluationsRequest): The initial request object. - response (:class:`~.data_labeling_service.SearchEvaluationsResponse`): + response (google.cloud.datalabeling_v1beta1.types.SearchEvaluationsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -871,7 +880,7 @@ class SearchEvaluationsAsyncPager: """A pager for iterating through ``search_evaluations`` requests. This class thinly wraps an initial - :class:`~.data_labeling_service.SearchEvaluationsResponse` object, and + :class:`google.cloud.datalabeling_v1beta1.types.SearchEvaluationsResponse` object, and provides an ``__aiter__`` method to iterate through its ``evaluations`` field. @@ -880,7 +889,7 @@ class SearchEvaluationsAsyncPager: through the ``evaluations`` field on the corresponding responses. - All the usual :class:`~.data_labeling_service.SearchEvaluationsResponse` + All the usual :class:`google.cloud.datalabeling_v1beta1.types.SearchEvaluationsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -900,9 +909,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.data_labeling_service.SearchEvaluationsRequest`): + request (google.cloud.datalabeling_v1beta1.types.SearchEvaluationsRequest): The initial request object. - response (:class:`~.data_labeling_service.SearchEvaluationsResponse`): + response (google.cloud.datalabeling_v1beta1.types.SearchEvaluationsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -941,7 +950,7 @@ class SearchExampleComparisonsPager: """A pager for iterating through ``search_example_comparisons`` requests. This class thinly wraps an initial - :class:`~.data_labeling_service.SearchExampleComparisonsResponse` object, and + :class:`google.cloud.datalabeling_v1beta1.types.SearchExampleComparisonsResponse` object, and provides an ``__iter__`` method to iterate through its ``example_comparisons`` field. @@ -950,7 +959,7 @@ class SearchExampleComparisonsPager: through the ``example_comparisons`` field on the corresponding responses. - All the usual :class:`~.data_labeling_service.SearchExampleComparisonsResponse` + All the usual :class:`google.cloud.datalabeling_v1beta1.types.SearchExampleComparisonsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -968,9 +977,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.data_labeling_service.SearchExampleComparisonsRequest`): + request (google.cloud.datalabeling_v1beta1.types.SearchExampleComparisonsRequest): The initial request object. - response (:class:`~.data_labeling_service.SearchExampleComparisonsResponse`): + response (google.cloud.datalabeling_v1beta1.types.SearchExampleComparisonsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -1007,7 +1016,7 @@ class SearchExampleComparisonsAsyncPager: """A pager for iterating through ``search_example_comparisons`` requests. This class thinly wraps an initial - :class:`~.data_labeling_service.SearchExampleComparisonsResponse` object, and + :class:`google.cloud.datalabeling_v1beta1.types.SearchExampleComparisonsResponse` object, and provides an ``__aiter__`` method to iterate through its ``example_comparisons`` field. @@ -1016,7 +1025,7 @@ class SearchExampleComparisonsAsyncPager: through the ``example_comparisons`` field on the corresponding responses. - All the usual :class:`~.data_labeling_service.SearchExampleComparisonsResponse` + All the usual :class:`google.cloud.datalabeling_v1beta1.types.SearchExampleComparisonsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -1036,9 +1045,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.data_labeling_service.SearchExampleComparisonsRequest`): + request (google.cloud.datalabeling_v1beta1.types.SearchExampleComparisonsRequest): The initial request object. - response (:class:`~.data_labeling_service.SearchExampleComparisonsResponse`): + response (google.cloud.datalabeling_v1beta1.types.SearchExampleComparisonsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -1081,7 +1090,7 @@ class ListEvaluationJobsPager: """A pager for iterating through ``list_evaluation_jobs`` requests. This class thinly wraps an initial - :class:`~.data_labeling_service.ListEvaluationJobsResponse` object, and + :class:`google.cloud.datalabeling_v1beta1.types.ListEvaluationJobsResponse` object, and provides an ``__iter__`` method to iterate through its ``evaluation_jobs`` field. @@ -1090,7 +1099,7 @@ class ListEvaluationJobsPager: through the ``evaluation_jobs`` field on the corresponding responses. - All the usual :class:`~.data_labeling_service.ListEvaluationJobsResponse` + All the usual :class:`google.cloud.datalabeling_v1beta1.types.ListEvaluationJobsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -1108,9 +1117,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.data_labeling_service.ListEvaluationJobsRequest`): + request (google.cloud.datalabeling_v1beta1.types.ListEvaluationJobsRequest): The initial request object. - response (:class:`~.data_labeling_service.ListEvaluationJobsResponse`): + response (google.cloud.datalabeling_v1beta1.types.ListEvaluationJobsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. @@ -1143,7 +1152,7 @@ class ListEvaluationJobsAsyncPager: """A pager for iterating through ``list_evaluation_jobs`` requests. This class thinly wraps an initial - :class:`~.data_labeling_service.ListEvaluationJobsResponse` object, and + :class:`google.cloud.datalabeling_v1beta1.types.ListEvaluationJobsResponse` object, and provides an ``__aiter__`` method to iterate through its ``evaluation_jobs`` field. @@ -1152,7 +1161,7 @@ class ListEvaluationJobsAsyncPager: through the ``evaluation_jobs`` field on the corresponding responses. - All the usual :class:`~.data_labeling_service.ListEvaluationJobsResponse` + All the usual :class:`google.cloud.datalabeling_v1beta1.types.ListEvaluationJobsResponse` attributes are available on the pager. If multiple requests are made, only the most recent response is retained, and thus used for attribute lookup. """ @@ -1172,9 +1181,9 @@ def __init__( Args: method (Callable): The method that was originally called, and which instantiated this pager. - request (:class:`~.data_labeling_service.ListEvaluationJobsRequest`): + request (google.cloud.datalabeling_v1beta1.types.ListEvaluationJobsRequest): The initial request object. - response (:class:`~.data_labeling_service.ListEvaluationJobsResponse`): + response (google.cloud.datalabeling_v1beta1.types.ListEvaluationJobsResponse): The initial response object. metadata (Sequence[Tuple[str, str]]): Strings which should be sent along with the request as metadata. diff --git a/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/base.py b/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/base.py index 8b6aaee..2f459f3 100644 --- a/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/base.py +++ b/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/base.py @@ -82,10 +82,10 @@ def __init__( scope (Optional[Sequence[str]]): A list of scopes. quota_project_id (Optional[str]): An optional project to use for billing and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing your own client library. """ # Save the hostname. Default to port 443 (HTTPS) if none is specified. @@ -93,6 +93,9 @@ def __init__( host += ":443" self._host = host + # Save the scopes. + self._scopes = scopes or self.AUTH_SCOPES + # If no credentials are provided, then determine the appropriate # defaults. if credentials and credentials_file: @@ -102,20 +105,17 @@ def __init__( if credentials_file is not None: credentials, _ = auth.load_credentials_from_file( - credentials_file, scopes=scopes, quota_project_id=quota_project_id + credentials_file, scopes=self._scopes, quota_project_id=quota_project_id ) elif credentials is None: credentials, _ = auth.default( - scopes=scopes, quota_project_id=quota_project_id + scopes=self._scopes, quota_project_id=quota_project_id ) # Save the credentials. self._credentials = credentials - # Lifted into its own function so it can be stubbed out during tests. - self._prep_wrapped_messages(client_info) - def _prep_wrapped_messages(self, client_info): # Precompute the wrapped methods. self._wrapped_methods = { @@ -131,6 +131,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -144,6 +145,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -157,6 +159,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -173,6 +176,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -186,6 +190,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -199,6 +204,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -212,6 +218,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -225,6 +232,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -252,6 +260,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -265,6 +274,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -283,6 +293,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -296,6 +307,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -309,6 +321,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -325,6 +338,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -338,6 +352,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -351,6 +366,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -364,6 +380,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -377,6 +394,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -405,6 +423,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -428,6 +447,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, @@ -441,6 +461,7 @@ def _prep_wrapped_messages(self, client_info): predicate=retries.if_exception_type( exceptions.DeadlineExceeded, exceptions.ServiceUnavailable, ), + deadline=30.0, ), default_timeout=30.0, client_info=client_info, diff --git a/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc.py b/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc.py index 50a5adc..d4399db 100644 --- a/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc.py +++ b/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc.py @@ -70,6 +70,7 @@ def __init__( 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: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -100,6 +101,10 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. client_info (google.api_core.gapic_v1.client_info.ClientInfo): @@ -114,72 +119,61 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} + self._operations_client = None + + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) + else: + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) else: - ssl_credentials = SslCredentials().ssl_credentials + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, - ssl_credentials=ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, + scopes=self._scopes, + ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -187,18 +181,8 @@ def __init__( ], ) - self._stubs = {} # type: Dict[str, Callable] - self._operations_client = None - - # Run the base constructor. - super().__init__( - host=host, - credentials=credentials, - credentials_file=credentials_file, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - client_info=client_info, - ) + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @classmethod def create_channel( @@ -212,7 +196,7 @@ def create_channel( ) -> grpc.Channel: """Create and return a gRPC channel object. Args: - address (Optional[str]): The host for the channel to use. + host (Optional[str]): The host for the channel to use. credentials (Optional[~.Credentials]): The authorization credentials to attach to requests. These credentials identify this application to the service. If diff --git a/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc_asyncio.py b/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc_asyncio.py index 094633e..7d94fc5 100644 --- a/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc_asyncio.py +++ b/google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc_asyncio.py @@ -74,7 +74,7 @@ def create_channel( ) -> aio.Channel: """Create and return a gRPC AsyncIO channel object. Args: - address (Optional[str]): The host for the channel to use. + host (Optional[str]): The host for the channel to use. credentials (Optional[~.Credentials]): The authorization credentials to attach to requests. These credentials identify this application to the service. If @@ -114,6 +114,7 @@ def __init__( 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, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -145,12 +146,16 @@ def __init__( ``api_mtls_endpoint`` is None. ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials for grpc channel. It is ignored if ``channel`` is provided. + client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]): + A callback to provide client certificate bytes and private key bytes, + both in PEM format. It is used to configure mutual TLS channel. It is + ignored if ``channel`` or ``ssl_channel_credentials`` is provided. quota_project_id (Optional[str]): An optional project to use for billing and quota. - client_info (google.api_core.gapic_v1.client_info.ClientInfo): - The client info used to send a user-agent string along with - API requests. If ``None``, then default info will be used. - Generally, you only need to set this if you're developing + client_info (google.api_core.gapic_v1.client_info.ClientInfo): + The client info used to send a user-agent string along with + API requests. If ``None``, then default info will be used. + Generally, you only need to set this if you're developing your own client library. Raises: @@ -159,72 +164,61 @@ def __init__( google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials`` and ``credentials_file`` are passed. """ + self._grpc_channel = None self._ssl_channel_credentials = ssl_channel_credentials + self._stubs: Dict[str, Callable] = {} + self._operations_client = None + + if api_mtls_endpoint: + warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning) + if client_cert_source: + warnings.warn("client_cert_source is deprecated", DeprecationWarning) if channel: - # Sanity check: Ensure that channel and credentials are not both - # provided. + # Ignore credentials if a channel was passed. credentials = False - # If a channel was explicitly provided, set it. self._grpc_channel = channel self._ssl_channel_credentials = None - elif api_mtls_endpoint: - warnings.warn( - "api_mtls_endpoint and client_cert_source are deprecated", - DeprecationWarning, - ) - host = ( - api_mtls_endpoint - if ":" in api_mtls_endpoint - else api_mtls_endpoint + ":443" - ) + else: + if api_mtls_endpoint: + host = api_mtls_endpoint + + # Create SSL credentials with client_cert_source or application + # default SSL credentials. + if client_cert_source: + cert, key = client_cert_source() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) + else: + self._ssl_channel_credentials = SslCredentials().ssl_credentials - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) - - # Create SSL credentials with client_cert_source or application - # default SSL credentials. - if client_cert_source: - cert, key = client_cert_source() - ssl_credentials = grpc.ssl_channel_credentials( - certificate_chain=cert, private_key=key - ) else: - ssl_credentials = SslCredentials().ssl_credentials + if client_cert_source_for_mtls and not ssl_channel_credentials: + cert, key = client_cert_source_for_mtls() + self._ssl_channel_credentials = grpc.ssl_channel_credentials( + certificate_chain=cert, private_key=key + ) - # create a new channel. The provided one is ignored. - self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, - credentials_file=credentials_file, - ssl_credentials=ssl_credentials, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - options=[ - ("grpc.max_send_message_length", -1), - ("grpc.max_receive_message_length", -1), - ], - ) - self._ssl_channel_credentials = ssl_credentials - else: - host = host if ":" in host else host + ":443" - - if credentials is None: - credentials, _ = auth.default( - scopes=self.AUTH_SCOPES, quota_project_id=quota_project_id - ) + # The base transport sets the host, credentials and scopes + super().__init__( + host=host, + credentials=credentials, + credentials_file=credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + client_info=client_info, + ) - # create a new channel. The provided one is ignored. + if not self._grpc_channel: self._grpc_channel = type(self).create_channel( - host, - credentials=credentials, + self._host, + credentials=self._credentials, credentials_file=credentials_file, - ssl_credentials=ssl_channel_credentials, - scopes=scopes or self.AUTH_SCOPES, + scopes=self._scopes, + ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, options=[ ("grpc.max_send_message_length", -1), @@ -232,18 +226,8 @@ def __init__( ], ) - # Run the base constructor. - super().__init__( - host=host, - credentials=credentials, - credentials_file=credentials_file, - scopes=scopes or self.AUTH_SCOPES, - quota_project_id=quota_project_id, - client_info=client_info, - ) - - self._stubs = {} - self._operations_client = None + # Wrap messages. This must be done after self._grpc_channel exists + self._prep_wrapped_messages(client_info) @property def grpc_channel(self) -> aio.Channel: diff --git a/google/cloud/datalabeling_v1beta1/types/__init__.py b/google/cloud/datalabeling_v1beta1/types/__init__.py index 9c2e63e..71f8216 100644 --- a/google/cloud/datalabeling_v1beta1/types/__init__.py +++ b/google/cloud/datalabeling_v1beta1/types/__init__.py @@ -15,296 +15,296 @@ # limitations under the License. # -from .annotation_spec_set import ( - AnnotationSpecSet, - AnnotationSpec, -) from .annotation import ( Annotation, + AnnotationMetadata, AnnotationValue, - ImageClassificationAnnotation, - Vertex, - NormalizedVertex, BoundingPoly, - NormalizedBoundingPoly, ImageBoundingPolyAnnotation, - Polyline, - NormalizedPolyline, + ImageClassificationAnnotation, ImagePolylineAnnotation, ImageSegmentationAnnotation, + NormalizedBoundingPoly, + NormalizedPolyline, + NormalizedVertex, + ObjectTrackingFrame, + OperatorMetadata, + Polyline, + SequentialSegment, TextClassificationAnnotation, TextEntityExtractionAnnotation, - SequentialSegment, TimeSegment, + Vertex, VideoClassificationAnnotation, - ObjectTrackingFrame, - VideoObjectTrackingAnnotation, VideoEventAnnotation, - AnnotationMetadata, - OperatorMetadata, - AnnotationSource, + VideoObjectTrackingAnnotation, AnnotationSentiment, + AnnotationSource, AnnotationType, ) +from .annotation_spec_set import ( + AnnotationSpec, + AnnotationSpecSet, +) +from .data_labeling_service import ( + CreateAnnotationSpecSetRequest, + CreateDatasetRequest, + CreateEvaluationJobRequest, + CreateInstructionRequest, + DeleteAnnotatedDatasetRequest, + DeleteAnnotationSpecSetRequest, + DeleteDatasetRequest, + DeleteEvaluationJobRequest, + DeleteInstructionRequest, + ExportDataRequest, + GetAnnotatedDatasetRequest, + GetAnnotationSpecSetRequest, + GetDataItemRequest, + GetDatasetRequest, + GetEvaluationJobRequest, + GetEvaluationRequest, + GetExampleRequest, + GetInstructionRequest, + ImportDataRequest, + LabelImageRequest, + LabelTextRequest, + LabelVideoRequest, + ListAnnotatedDatasetsRequest, + ListAnnotatedDatasetsResponse, + ListAnnotationSpecSetsRequest, + ListAnnotationSpecSetsResponse, + ListDataItemsRequest, + ListDataItemsResponse, + ListDatasetsRequest, + ListDatasetsResponse, + ListEvaluationJobsRequest, + ListEvaluationJobsResponse, + ListExamplesRequest, + ListExamplesResponse, + ListInstructionsRequest, + ListInstructionsResponse, + PauseEvaluationJobRequest, + ResumeEvaluationJobRequest, + SearchEvaluationsRequest, + SearchEvaluationsResponse, + SearchExampleComparisonsRequest, + SearchExampleComparisonsResponse, + UpdateEvaluationJobRequest, +) from .data_payloads import ( ImagePayload, TextPayload, - VideoThumbnail, VideoPayload, -) -from .human_annotation_config import ( - HumanAnnotationConfig, - ImageClassificationConfig, - BoundingPolyConfig, - PolylineConfig, - SegmentationConfig, - VideoClassificationConfig, - ObjectDetectionConfig, - ObjectTrackingConfig, - EventConfig, - TextClassificationConfig, - SentimentConfig, - TextEntityExtractionConfig, - StringAggregationType, + VideoThumbnail, ) from .dataset import ( - Dataset, - InputConfig, - TextMetadata, - ClassificationMetadata, - GcsSource, + AnnotatedDataset, + AnnotatedDatasetMetadata, BigQuerySource, - OutputConfig, + ClassificationMetadata, + DataItem, + Dataset, + Example, GcsDestination, GcsFolderDestination, - DataItem, - AnnotatedDataset, + GcsSource, + InputConfig, LabelStats, - AnnotatedDatasetMetadata, - Example, + OutputConfig, + TextMetadata, DataType, ) from .evaluation import ( + BoundingBoxEvaluationOptions, + ClassificationMetrics, + ConfusionMatrix, Evaluation, EvaluationConfig, - BoundingBoxEvaluationOptions, EvaluationMetrics, - ClassificationMetrics, ObjectDetectionMetrics, PrCurve, - ConfusionMatrix, ) from .evaluation_job import ( + Attempt, EvaluationJob, - EvaluationJobConfig, EvaluationJobAlertConfig, - Attempt, + EvaluationJobConfig, +) +from .human_annotation_config import ( + BoundingPolyConfig, + EventConfig, + HumanAnnotationConfig, + ImageClassificationConfig, + ObjectDetectionConfig, + ObjectTrackingConfig, + PolylineConfig, + SegmentationConfig, + SentimentConfig, + TextClassificationConfig, + TextEntityExtractionConfig, + VideoClassificationConfig, + StringAggregationType, ) from .instruction import ( - Instruction, CsvInstruction, + Instruction, PdfInstruction, ) -from .data_labeling_service import ( - CreateDatasetRequest, - GetDatasetRequest, - ListDatasetsRequest, - ListDatasetsResponse, - DeleteDatasetRequest, - ImportDataRequest, - ExportDataRequest, - GetDataItemRequest, - ListDataItemsRequest, - ListDataItemsResponse, - GetAnnotatedDatasetRequest, - ListAnnotatedDatasetsRequest, - ListAnnotatedDatasetsResponse, - DeleteAnnotatedDatasetRequest, - LabelImageRequest, - LabelVideoRequest, - LabelTextRequest, - GetExampleRequest, - ListExamplesRequest, - ListExamplesResponse, - CreateAnnotationSpecSetRequest, - GetAnnotationSpecSetRequest, - ListAnnotationSpecSetsRequest, - ListAnnotationSpecSetsResponse, - DeleteAnnotationSpecSetRequest, - CreateInstructionRequest, - GetInstructionRequest, - DeleteInstructionRequest, - ListInstructionsRequest, - ListInstructionsResponse, - GetEvaluationRequest, - SearchEvaluationsRequest, - SearchEvaluationsResponse, - SearchExampleComparisonsRequest, - SearchExampleComparisonsResponse, - CreateEvaluationJobRequest, - UpdateEvaluationJobRequest, - GetEvaluationJobRequest, - PauseEvaluationJobRequest, - ResumeEvaluationJobRequest, - DeleteEvaluationJobRequest, - ListEvaluationJobsRequest, - ListEvaluationJobsResponse, -) from .operations import ( - ImportDataOperationResponse, + CreateInstructionMetadata, + ExportDataOperationMetadata, ExportDataOperationResponse, ImportDataOperationMetadata, - ExportDataOperationMetadata, - LabelOperationMetadata, - LabelImageClassificationOperationMetadata, + ImportDataOperationResponse, LabelImageBoundingBoxOperationMetadata, - LabelImageOrientedBoundingBoxOperationMetadata, LabelImageBoundingPolyOperationMetadata, + LabelImageClassificationOperationMetadata, + LabelImageOrientedBoundingBoxOperationMetadata, LabelImagePolylineOperationMetadata, LabelImageSegmentationOperationMetadata, + LabelOperationMetadata, + LabelTextClassificationOperationMetadata, + LabelTextEntityExtractionOperationMetadata, LabelVideoClassificationOperationMetadata, + LabelVideoEventOperationMetadata, LabelVideoObjectDetectionOperationMetadata, LabelVideoObjectTrackingOperationMetadata, - LabelVideoEventOperationMetadata, - LabelTextClassificationOperationMetadata, - LabelTextEntityExtractionOperationMetadata, - CreateInstructionMetadata, ) __all__ = ( - "AnnotationSpecSet", - "AnnotationSpec", "Annotation", + "AnnotationMetadata", "AnnotationValue", - "ImageClassificationAnnotation", - "Vertex", - "NormalizedVertex", "BoundingPoly", - "NormalizedBoundingPoly", "ImageBoundingPolyAnnotation", - "Polyline", - "NormalizedPolyline", + "ImageClassificationAnnotation", "ImagePolylineAnnotation", "ImageSegmentationAnnotation", + "NormalizedBoundingPoly", + "NormalizedPolyline", + "NormalizedVertex", + "ObjectTrackingFrame", + "OperatorMetadata", + "Polyline", + "SequentialSegment", "TextClassificationAnnotation", "TextEntityExtractionAnnotation", - "SequentialSegment", "TimeSegment", + "Vertex", "VideoClassificationAnnotation", - "ObjectTrackingFrame", - "VideoObjectTrackingAnnotation", "VideoEventAnnotation", - "AnnotationMetadata", - "OperatorMetadata", - "AnnotationSource", + "VideoObjectTrackingAnnotation", "AnnotationSentiment", + "AnnotationSource", "AnnotationType", + "AnnotationSpec", + "AnnotationSpecSet", + "CreateAnnotationSpecSetRequest", + "CreateDatasetRequest", + "CreateEvaluationJobRequest", + "CreateInstructionRequest", + "DeleteAnnotatedDatasetRequest", + "DeleteAnnotationSpecSetRequest", + "DeleteDatasetRequest", + "DeleteEvaluationJobRequest", + "DeleteInstructionRequest", + "ExportDataRequest", + "GetAnnotatedDatasetRequest", + "GetAnnotationSpecSetRequest", + "GetDataItemRequest", + "GetDatasetRequest", + "GetEvaluationJobRequest", + "GetEvaluationRequest", + "GetExampleRequest", + "GetInstructionRequest", + "ImportDataRequest", + "LabelImageRequest", + "LabelTextRequest", + "LabelVideoRequest", + "ListAnnotatedDatasetsRequest", + "ListAnnotatedDatasetsResponse", + "ListAnnotationSpecSetsRequest", + "ListAnnotationSpecSetsResponse", + "ListDataItemsRequest", + "ListDataItemsResponse", + "ListDatasetsRequest", + "ListDatasetsResponse", + "ListEvaluationJobsRequest", + "ListEvaluationJobsResponse", + "ListExamplesRequest", + "ListExamplesResponse", + "ListInstructionsRequest", + "ListInstructionsResponse", + "PauseEvaluationJobRequest", + "ResumeEvaluationJobRequest", + "SearchEvaluationsRequest", + "SearchEvaluationsResponse", + "SearchExampleComparisonsRequest", + "SearchExampleComparisonsResponse", + "UpdateEvaluationJobRequest", "ImagePayload", "TextPayload", - "VideoThumbnail", "VideoPayload", - "HumanAnnotationConfig", - "ImageClassificationConfig", - "BoundingPolyConfig", - "PolylineConfig", - "SegmentationConfig", - "VideoClassificationConfig", - "ObjectDetectionConfig", - "ObjectTrackingConfig", - "EventConfig", - "TextClassificationConfig", - "SentimentConfig", - "TextEntityExtractionConfig", - "StringAggregationType", - "Dataset", - "InputConfig", - "TextMetadata", - "ClassificationMetadata", - "GcsSource", + "VideoThumbnail", + "AnnotatedDataset", + "AnnotatedDatasetMetadata", "BigQuerySource", - "OutputConfig", + "ClassificationMetadata", + "DataItem", + "Dataset", + "Example", "GcsDestination", "GcsFolderDestination", - "DataItem", - "AnnotatedDataset", + "GcsSource", + "InputConfig", "LabelStats", - "AnnotatedDatasetMetadata", - "Example", + "OutputConfig", + "TextMetadata", "DataType", + "BoundingBoxEvaluationOptions", + "ClassificationMetrics", + "ConfusionMatrix", "Evaluation", "EvaluationConfig", - "BoundingBoxEvaluationOptions", "EvaluationMetrics", - "ClassificationMetrics", "ObjectDetectionMetrics", "PrCurve", - "ConfusionMatrix", + "Attempt", "EvaluationJob", - "EvaluationJobConfig", "EvaluationJobAlertConfig", - "Attempt", - "Instruction", + "EvaluationJobConfig", + "BoundingPolyConfig", + "EventConfig", + "HumanAnnotationConfig", + "ImageClassificationConfig", + "ObjectDetectionConfig", + "ObjectTrackingConfig", + "PolylineConfig", + "SegmentationConfig", + "SentimentConfig", + "TextClassificationConfig", + "TextEntityExtractionConfig", + "VideoClassificationConfig", + "StringAggregationType", "CsvInstruction", + "Instruction", "PdfInstruction", - "CreateDatasetRequest", - "GetDatasetRequest", - "ListDatasetsRequest", - "ListDatasetsResponse", - "DeleteDatasetRequest", - "ImportDataRequest", - "ExportDataRequest", - "GetDataItemRequest", - "ListDataItemsRequest", - "ListDataItemsResponse", - "GetAnnotatedDatasetRequest", - "ListAnnotatedDatasetsRequest", - "ListAnnotatedDatasetsResponse", - "DeleteAnnotatedDatasetRequest", - "LabelImageRequest", - "LabelVideoRequest", - "LabelTextRequest", - "GetExampleRequest", - "ListExamplesRequest", - "ListExamplesResponse", - "CreateAnnotationSpecSetRequest", - "GetAnnotationSpecSetRequest", - "ListAnnotationSpecSetsRequest", - "ListAnnotationSpecSetsResponse", - "DeleteAnnotationSpecSetRequest", - "CreateInstructionRequest", - "GetInstructionRequest", - "DeleteInstructionRequest", - "ListInstructionsRequest", - "ListInstructionsResponse", - "GetEvaluationRequest", - "SearchEvaluationsRequest", - "SearchEvaluationsResponse", - "SearchExampleComparisonsRequest", - "SearchExampleComparisonsResponse", - "CreateEvaluationJobRequest", - "UpdateEvaluationJobRequest", - "GetEvaluationJobRequest", - "PauseEvaluationJobRequest", - "ResumeEvaluationJobRequest", - "DeleteEvaluationJobRequest", - "ListEvaluationJobsRequest", - "ListEvaluationJobsResponse", - "ImportDataOperationResponse", + "CreateInstructionMetadata", + "ExportDataOperationMetadata", "ExportDataOperationResponse", "ImportDataOperationMetadata", - "ExportDataOperationMetadata", - "LabelOperationMetadata", - "LabelImageClassificationOperationMetadata", + "ImportDataOperationResponse", "LabelImageBoundingBoxOperationMetadata", - "LabelImageOrientedBoundingBoxOperationMetadata", "LabelImageBoundingPolyOperationMetadata", + "LabelImageClassificationOperationMetadata", + "LabelImageOrientedBoundingBoxOperationMetadata", "LabelImagePolylineOperationMetadata", "LabelImageSegmentationOperationMetadata", + "LabelOperationMetadata", + "LabelTextClassificationOperationMetadata", + "LabelTextEntityExtractionOperationMetadata", "LabelVideoClassificationOperationMetadata", + "LabelVideoEventOperationMetadata", "LabelVideoObjectDetectionOperationMetadata", "LabelVideoObjectTrackingOperationMetadata", - "LabelVideoEventOperationMetadata", - "LabelTextClassificationOperationMetadata", - "LabelTextEntityExtractionOperationMetadata", - "CreateInstructionMetadata", ) diff --git a/google/cloud/datalabeling_v1beta1/types/annotation.py b/google/cloud/datalabeling_v1beta1/types/annotation.py index c237644..b7e34a7 100644 --- a/google/cloud/datalabeling_v1beta1/types/annotation.py +++ b/google/cloud/datalabeling_v1beta1/types/annotation.py @@ -98,16 +98,16 @@ class Annotation(proto.Message): Output only. Unique name of this annotation, format is: projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/{annotated_dataset}/examples/{example_id}/annotations/{annotation_id} - annotation_source (~.annotation.AnnotationSource): + annotation_source (google.cloud.datalabeling_v1beta1.types.AnnotationSource): Output only. The source of the annotation. - annotation_value (~.annotation.AnnotationValue): + annotation_value (google.cloud.datalabeling_v1beta1.types.AnnotationValue): Output only. This is the actual annotation value, e.g classification, bounding box values are stored here. - annotation_metadata (~.annotation.AnnotationMetadata): + annotation_metadata (google.cloud.datalabeling_v1beta1.types.AnnotationMetadata): Output only. Annotation metadata, including information like votes for labels. - annotation_sentiment (~.annotation.AnnotationSentiment): + annotation_sentiment (google.cloud.datalabeling_v1beta1.types.AnnotationSentiment): Output only. Sentiment for this annotation. """ @@ -130,33 +130,33 @@ class AnnotationValue(proto.Message): r"""Annotation value for an example. Attributes: - image_classification_annotation (~.annotation.ImageClassificationAnnotation): + image_classification_annotation (google.cloud.datalabeling_v1beta1.types.ImageClassificationAnnotation): Annotation value for image classification case. - image_bounding_poly_annotation (~.annotation.ImageBoundingPolyAnnotation): + image_bounding_poly_annotation (google.cloud.datalabeling_v1beta1.types.ImageBoundingPolyAnnotation): Annotation value for image bounding box, oriented bounding box and polygon cases. - image_polyline_annotation (~.annotation.ImagePolylineAnnotation): + image_polyline_annotation (google.cloud.datalabeling_v1beta1.types.ImagePolylineAnnotation): Annotation value for image polyline cases. Polyline here is different from BoundingPoly. It is formed by line segments connected to each other but not closed form(Bounding Poly). The line segments can cross each other. - image_segmentation_annotation (~.annotation.ImageSegmentationAnnotation): + image_segmentation_annotation (google.cloud.datalabeling_v1beta1.types.ImageSegmentationAnnotation): Annotation value for image segmentation. - text_classification_annotation (~.annotation.TextClassificationAnnotation): + text_classification_annotation (google.cloud.datalabeling_v1beta1.types.TextClassificationAnnotation): Annotation value for text classification case. - text_entity_extraction_annotation (~.annotation.TextEntityExtractionAnnotation): + text_entity_extraction_annotation (google.cloud.datalabeling_v1beta1.types.TextEntityExtractionAnnotation): Annotation value for text entity extraction case. - video_classification_annotation (~.annotation.VideoClassificationAnnotation): + video_classification_annotation (google.cloud.datalabeling_v1beta1.types.VideoClassificationAnnotation): Annotation value for video classification case. - video_object_tracking_annotation (~.annotation.VideoObjectTrackingAnnotation): + video_object_tracking_annotation (google.cloud.datalabeling_v1beta1.types.VideoObjectTrackingAnnotation): Annotation value for video object detection and tracking case. - video_event_annotation (~.annotation.VideoEventAnnotation): + video_event_annotation (google.cloud.datalabeling_v1beta1.types.VideoEventAnnotation): Annotation value for video event case. """ @@ -222,7 +222,7 @@ class ImageClassificationAnnotation(proto.Message): r"""Image classification annotation definition. Attributes: - annotation_spec (~.annotation_spec_set.AnnotationSpec): + annotation_spec (google.cloud.datalabeling_v1beta1.types.AnnotationSpec): Label of image. """ @@ -269,7 +269,7 @@ class BoundingPoly(proto.Message): r"""A bounding polygon in the image. Attributes: - vertices (Sequence[~.annotation.Vertex]): + vertices (Sequence[google.cloud.datalabeling_v1beta1.types.Vertex]): The bounding polygon vertices. """ @@ -280,7 +280,7 @@ class NormalizedBoundingPoly(proto.Message): r"""Normalized bounding polygon. Attributes: - normalized_vertices (Sequence[~.annotation.NormalizedVertex]): + normalized_vertices (Sequence[google.cloud.datalabeling_v1beta1.types.NormalizedVertex]): The bounding polygon normalized vertices. """ @@ -294,11 +294,11 @@ class ImageBoundingPolyAnnotation(proto.Message): including bounding box in the image. Attributes: - bounding_poly (~.annotation.BoundingPoly): + bounding_poly (google.cloud.datalabeling_v1beta1.types.BoundingPoly): - normalized_bounding_poly (~.annotation.NormalizedBoundingPoly): + normalized_bounding_poly (google.cloud.datalabeling_v1beta1.types.NormalizedBoundingPoly): - annotation_spec (~.annotation_spec_set.AnnotationSpec): + annotation_spec (google.cloud.datalabeling_v1beta1.types.AnnotationSpec): Label of object in this bounding polygon. """ @@ -319,7 +319,7 @@ class Polyline(proto.Message): r"""A line with multiple line segments. Attributes: - vertices (Sequence[~.annotation.Vertex]): + vertices (Sequence[google.cloud.datalabeling_v1beta1.types.Vertex]): The polyline vertices. """ @@ -330,7 +330,7 @@ class NormalizedPolyline(proto.Message): r"""Normalized polyline. Attributes: - normalized_vertices (Sequence[~.annotation.NormalizedVertex]): + normalized_vertices (Sequence[google.cloud.datalabeling_v1beta1.types.NormalizedVertex]): The normalized polyline vertices. """ @@ -343,11 +343,11 @@ class ImagePolylineAnnotation(proto.Message): r"""A polyline for the image annotation. Attributes: - polyline (~.annotation.Polyline): + polyline (google.cloud.datalabeling_v1beta1.types.Polyline): - normalized_polyline (~.annotation.NormalizedPolyline): + normalized_polyline (google.cloud.datalabeling_v1beta1.types.NormalizedPolyline): - annotation_spec (~.annotation_spec_set.AnnotationSpec): + annotation_spec (google.cloud.datalabeling_v1beta1.types.AnnotationSpec): Label of this polyline. """ @@ -366,7 +366,7 @@ class ImageSegmentationAnnotation(proto.Message): r"""Image segmentation annotation. Attributes: - annotation_colors (Sequence[~.annotation.ImageSegmentationAnnotation.AnnotationColorsEntry]): + annotation_colors (Sequence[google.cloud.datalabeling_v1beta1.types.ImageSegmentationAnnotation.AnnotationColorsEntry]): 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 @@ -393,7 +393,7 @@ class TextClassificationAnnotation(proto.Message): r"""Text classification annotation. Attributes: - annotation_spec (~.annotation_spec_set.AnnotationSpec): + annotation_spec (google.cloud.datalabeling_v1beta1.types.AnnotationSpec): Label of the text. """ @@ -406,9 +406,9 @@ class TextEntityExtractionAnnotation(proto.Message): r"""Text entity extraction annotation. Attributes: - annotation_spec (~.annotation_spec_set.AnnotationSpec): + annotation_spec (google.cloud.datalabeling_v1beta1.types.AnnotationSpec): Label of the text entities. - sequential_segment (~.annotation.SequentialSegment): + sequential_segment (google.cloud.datalabeling_v1beta1.types.SequentialSegment): Position of the entity. """ @@ -441,11 +441,11 @@ class TimeSegment(proto.Message): (e.g. video). Attributes: - start_time_offset (~.duration.Duration): + start_time_offset (google.protobuf.duration_pb2.Duration): Start of the time segment (inclusive), represented as the duration since the example start. - end_time_offset (~.duration.Duration): + end_time_offset (google.protobuf.duration_pb2.Duration): End of the time segment (exclusive), represented as the duration since the example start. @@ -460,10 +460,10 @@ class VideoClassificationAnnotation(proto.Message): r"""Video classification annotation. Attributes: - time_segment (~.annotation.TimeSegment): + time_segment (google.cloud.datalabeling_v1beta1.types.TimeSegment): The time segment of the video to which the annotation applies. - annotation_spec (~.annotation_spec_set.AnnotationSpec): + annotation_spec (google.cloud.datalabeling_v1beta1.types.AnnotationSpec): Label of the segment specified by time_segment. """ @@ -479,11 +479,11 @@ class ObjectTrackingFrame(proto.Message): tracking. Attributes: - bounding_poly (~.annotation.BoundingPoly): + bounding_poly (google.cloud.datalabeling_v1beta1.types.BoundingPoly): - normalized_bounding_poly (~.annotation.NormalizedBoundingPoly): + normalized_bounding_poly (google.cloud.datalabeling_v1beta1.types.NormalizedBoundingPoly): - time_offset (~.duration.Duration): + time_offset (google.protobuf.duration_pb2.Duration): The time offset of this frame relative to the beginning of the video. """ @@ -503,13 +503,13 @@ class VideoObjectTrackingAnnotation(proto.Message): r"""Video object tracking annotation. Attributes: - annotation_spec (~.annotation_spec_set.AnnotationSpec): + annotation_spec (google.cloud.datalabeling_v1beta1.types.AnnotationSpec): Label of the object tracked in this annotation. - time_segment (~.annotation.TimeSegment): + time_segment (google.cloud.datalabeling_v1beta1.types.TimeSegment): The time segment of the video to which object tracking applies. - object_tracking_frames (Sequence[~.annotation.ObjectTrackingFrame]): + object_tracking_frames (Sequence[google.cloud.datalabeling_v1beta1.types.ObjectTrackingFrame]): The list of frames where this object track appears. """ @@ -529,9 +529,9 @@ class VideoEventAnnotation(proto.Message): r"""Video event annotation. Attributes: - annotation_spec (~.annotation_spec_set.AnnotationSpec): + annotation_spec (google.cloud.datalabeling_v1beta1.types.AnnotationSpec): Label of the event in this annotation. - time_segment (~.annotation.TimeSegment): + time_segment (google.cloud.datalabeling_v1beta1.types.TimeSegment): The time segment of the video to which the annotation applies. """ @@ -547,7 +547,7 @@ class AnnotationMetadata(proto.Message): r"""Additional information associated with the annotation. Attributes: - operator_metadata (~.annotation.OperatorMetadata): + operator_metadata (google.cloud.datalabeling_v1beta1.types.OperatorMetadata): Metadata related to human labeling. """ diff --git a/google/cloud/datalabeling_v1beta1/types/annotation_spec_set.py b/google/cloud/datalabeling_v1beta1/types/annotation_spec_set.py index 4444155..a98cccd 100644 --- a/google/cloud/datalabeling_v1beta1/types/annotation_spec_set.py +++ b/google/cloud/datalabeling_v1beta1/types/annotation_spec_set.py @@ -44,7 +44,7 @@ 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[~.annotation_spec_set.AnnotationSpec]): + annotation_specs (Sequence[google.cloud.datalabeling_v1beta1.types.AnnotationSpec]): Required. The array of AnnotationSpecs that you define when you create the AnnotationSpecSet. These are the possible labels diff --git a/google/cloud/datalabeling_v1beta1/types/data_labeling_service.py b/google/cloud/datalabeling_v1beta1/types/data_labeling_service.py index 21c02d7..c8f1818 100644 --- a/google/cloud/datalabeling_v1beta1/types/data_labeling_service.py +++ b/google/cloud/datalabeling_v1beta1/types/data_labeling_service.py @@ -86,7 +86,7 @@ class CreateDatasetRequest(proto.Message): parent (str): Required. Dataset resource parent, format: projects/{project_id} - dataset (~.gcd_dataset.Dataset): + dataset (google.cloud.datalabeling_v1beta1.types.Dataset): Required. The dataset to be created. """ @@ -142,7 +142,7 @@ class ListDatasetsResponse(proto.Message): r"""Results of listing datasets within a project. Attributes: - datasets (Sequence[~.gcd_dataset.Dataset]): + datasets (Sequence[google.cloud.datalabeling_v1beta1.types.Dataset]): The list of datasets to return. next_page_token (str): A token to retrieve next page of results. @@ -178,7 +178,7 @@ class ImportDataRequest(proto.Message): name (str): Required. Dataset resource name, format: projects/{project_id}/datasets/{dataset_id} - input_config (~.gcd_dataset.InputConfig): + input_config (google.cloud.datalabeling_v1beta1.types.InputConfig): Required. Specify the input source of the data. user_email_address (str): @@ -212,7 +212,7 @@ class ExportDataRequest(proto.Message): filter (str): Optional. Filter is not supported at this moment. - output_config (~.gcd_dataset.OutputConfig): + output_config (google.cloud.datalabeling_v1beta1.types.OutputConfig): Required. Specify the output destination. user_email_address (str): Email of the user who started the export task @@ -280,7 +280,7 @@ class ListDataItemsResponse(proto.Message): r"""Results of listing data items in a dataset. Attributes: - data_items (Sequence[~.gcd_dataset.DataItem]): + data_items (Sequence[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. @@ -345,7 +345,7 @@ class ListAnnotatedDatasetsResponse(proto.Message): r"""Results of listing annotated datasets for a dataset. Attributes: - annotated_datasets (Sequence[~.gcd_dataset.AnnotatedDataset]): + annotated_datasets (Sequence[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. @@ -379,28 +379,28 @@ class LabelImageRequest(proto.Message): r"""Request message for starting an image labeling task. Attributes: - image_classification_config (~.human_annotation_config.ImageClassificationConfig): + image_classification_config (google.cloud.datalabeling_v1beta1.types.ImageClassificationConfig): Configuration for image classification task. One of image_classification_config, bounding_poly_config, polyline_config and segmentation_config are required. - bounding_poly_config (~.human_annotation_config.BoundingPolyConfig): + bounding_poly_config (google.cloud.datalabeling_v1beta1.types.BoundingPolyConfig): Configuration for bounding box and bounding poly task. One of image_classification_config, bounding_poly_config, polyline_config and segmentation_config are required. - polyline_config (~.human_annotation_config.PolylineConfig): + polyline_config (google.cloud.datalabeling_v1beta1.types.PolylineConfig): Configuration for polyline task. One of image_classification_config, bounding_poly_config, polyline_config and segmentation_config are required. - segmentation_config (~.human_annotation_config.SegmentationConfig): + segmentation_config (google.cloud.datalabeling_v1beta1.types.SegmentationConfig): Configuration for segmentation task. One of image_classification_config, bounding_poly_config, polyline_config and segmentation_config are required. parent (str): Required. Name of the dataset to request labeling task, format: projects/{project_id}/datasets/{dataset_id} - basic_config (~.human_annotation_config.HumanAnnotationConfig): + basic_config (google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig): Required. Basic human annotation config. - feature (~.data_labeling_service.LabelImageRequest.Feature): + feature (google.cloud.datalabeling_v1beta1.types.LabelImageRequest.Feature): Required. The type of image labeling task. """ @@ -455,28 +455,28 @@ class LabelVideoRequest(proto.Message): r"""Request message for LabelVideo. Attributes: - video_classification_config (~.human_annotation_config.VideoClassificationConfig): + video_classification_config (google.cloud.datalabeling_v1beta1.types.VideoClassificationConfig): Configuration for video classification task. One of video_classification_config, object_detection_config, object_tracking_config and event_config is required. - object_detection_config (~.human_annotation_config.ObjectDetectionConfig): + object_detection_config (google.cloud.datalabeling_v1beta1.types.ObjectDetectionConfig): Configuration for video object detection task. One of video_classification_config, object_detection_config, object_tracking_config and event_config is required. - object_tracking_config (~.human_annotation_config.ObjectTrackingConfig): + object_tracking_config (google.cloud.datalabeling_v1beta1.types.ObjectTrackingConfig): Configuration for video object tracking task. One of video_classification_config, object_detection_config, object_tracking_config and event_config is required. - event_config (~.human_annotation_config.EventConfig): + event_config (google.cloud.datalabeling_v1beta1.types.EventConfig): Configuration for video event task. One of video_classification_config, object_detection_config, object_tracking_config and event_config is required. parent (str): Required. Name of the dataset to request labeling task, format: projects/{project_id}/datasets/{dataset_id} - basic_config (~.human_annotation_config.HumanAnnotationConfig): + basic_config (google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig): Required. Basic human annotation config. - feature (~.data_labeling_service.LabelVideoRequest.Feature): + feature (google.cloud.datalabeling_v1beta1.types.LabelVideoRequest.Feature): Required. The type of video labeling task. """ @@ -529,20 +529,20 @@ class LabelTextRequest(proto.Message): r"""Request message for LabelText. Attributes: - text_classification_config (~.human_annotation_config.TextClassificationConfig): + text_classification_config (google.cloud.datalabeling_v1beta1.types.TextClassificationConfig): Configuration for text classification task. One of text_classification_config and text_entity_extraction_config is required. - text_entity_extraction_config (~.human_annotation_config.TextEntityExtractionConfig): + text_entity_extraction_config (google.cloud.datalabeling_v1beta1.types.TextEntityExtractionConfig): Configuration for entity extraction task. One of text_classification_config and text_entity_extraction_config is required. parent (str): Required. Name of the data set to request labeling task, format: projects/{project_id}/datasets/{dataset_id} - basic_config (~.human_annotation_config.HumanAnnotationConfig): + basic_config (google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig): Required. Basic human annotation config. - feature (~.data_labeling_service.LabelTextRequest.Feature): + feature (google.cloud.datalabeling_v1beta1.types.LabelTextRequest.Feature): Required. The type of text labeling task. """ @@ -630,7 +630,7 @@ class ListExamplesResponse(proto.Message): r"""Results of listing Examples in and annotated dataset. Attributes: - examples (Sequence[~.gcd_dataset.Example]): + examples (Sequence[google.cloud.datalabeling_v1beta1.types.Example]): The list of examples to return. next_page_token (str): A token to retrieve next page of results. @@ -654,7 +654,7 @@ class CreateAnnotationSpecSetRequest(proto.Message): parent (str): Required. AnnotationSpecSet resource parent, format: projects/{project_id} - annotation_spec_set (~.gcd_annotation_spec_set.AnnotationSpecSet): + annotation_spec_set (google.cloud.datalabeling_v1beta1.types.AnnotationSpecSet): Required. Annotation spec set to create. Annotation specs must be included. Only one annotation spec will be accepted for annotation specs with same display_name. @@ -714,7 +714,7 @@ class ListAnnotationSpecSetsResponse(proto.Message): r"""Results of listing annotation spec set under a project. Attributes: - annotation_spec_sets (Sequence[~.gcd_annotation_spec_set.AnnotationSpecSet]): + annotation_spec_sets (Sequence[google.cloud.datalabeling_v1beta1.types.AnnotationSpecSet]): The list of annotation spec sets. next_page_token (str): A token to retrieve next page of results. @@ -750,7 +750,7 @@ class CreateInstructionRequest(proto.Message): parent (str): Required. Instruction resource parent, format: projects/{project_id} - instruction (~.gcd_instruction.Instruction): + instruction (google.cloud.datalabeling_v1beta1.types.Instruction): Required. Instruction of how to perform the labeling task. """ @@ -821,7 +821,7 @@ class ListInstructionsResponse(proto.Message): r"""Results of listing instructions under a project. Attributes: - instructions (Sequence[~.gcd_instruction.Instruction]): + instructions (Sequence[google.cloud.datalabeling_v1beta1.types.Instruction]): The list of Instructions to return. next_page_token (str): A token to retrieve next page of results. @@ -917,7 +917,7 @@ class SearchEvaluationsResponse(proto.Message): r"""Results of searching evaluations. Attributes: - evaluations (Sequence[~.evaluation.Evaluation]): + evaluations (Sequence[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. @@ -969,7 +969,7 @@ class SearchExampleComparisonsResponse(proto.Message): r"""Results of searching example comparisons. Attributes: - example_comparisons (Sequence[~.data_labeling_service.SearchExampleComparisonsResponse.ExampleComparison]): + example_comparisons (Sequence[google.cloud.datalabeling_v1beta1.types.SearchExampleComparisonsResponse.ExampleComparison]): A list of example comparisons matching the search criteria. next_page_token (str): @@ -981,9 +981,9 @@ class ExampleComparison(proto.Message): predictions for a specific input. Attributes: - ground_truth_example (~.gcd_dataset.Example): + ground_truth_example (google.cloud.datalabeling_v1beta1.types.Example): The ground truth output for the input. - model_created_examples (Sequence[~.gcd_dataset.Example]): + model_created_examples (Sequence[google.cloud.datalabeling_v1beta1.types.Example]): Predictions by the model for the input. """ @@ -1013,7 +1013,7 @@ class CreateEvaluationJobRequest(proto.Message): parent (str): Required. Evaluation job resource parent. Format: "projects/{project_id}". - job (~.gcd_evaluation_job.EvaluationJob): + job (google.cloud.datalabeling_v1beta1.types.EvaluationJob): Required. The evaluation job to create. """ @@ -1028,10 +1028,10 @@ class UpdateEvaluationJobRequest(proto.Message): r"""Request message for UpdateEvaluationJob. Attributes: - evaluation_job (~.gcd_evaluation_job.EvaluationJob): + evaluation_job (google.cloud.datalabeling_v1beta1.types.EvaluationJob): Required. Evaluation job that is going to be updated. - update_mask (~.field_mask.FieldMask): + update_mask (google.protobuf.field_mask_pb2.FieldMask): Optional. Mask for which fields to update. You can only provide the following fields: @@ -1148,7 +1148,7 @@ class ListEvaluationJobsResponse(proto.Message): r"""Results for listing evaluation jobs. Attributes: - evaluation_jobs (Sequence[~.gcd_evaluation_job.EvaluationJob]): + evaluation_jobs (Sequence[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. diff --git a/google/cloud/datalabeling_v1beta1/types/data_payloads.py b/google/cloud/datalabeling_v1beta1/types/data_payloads.py index bb58d25..9cdaa55 100644 --- a/google/cloud/datalabeling_v1beta1/types/data_payloads.py +++ b/google/cloud/datalabeling_v1beta1/types/data_payloads.py @@ -68,7 +68,7 @@ class VideoThumbnail(proto.Message): Attributes: thumbnail (bytes): A byte string of the video frame. - time_offset (~.duration.Duration): + time_offset (google.protobuf.duration_pb2.Duration): Time offset relative to the beginning of the video, corresponding to the video frame where the thumbnail has been extracted from. @@ -87,7 +87,7 @@ class VideoPayload(proto.Message): Video format. video_uri (str): Video uri from the user bucket. - video_thumbnails (Sequence[~.data_payloads.VideoThumbnail]): + video_thumbnails (Sequence[google.cloud.datalabeling_v1beta1.types.VideoThumbnail]): The list of video thumbnails. frame_rate (float): FPS of the video. diff --git a/google/cloud/datalabeling_v1beta1/types/dataset.py b/google/cloud/datalabeling_v1beta1/types/dataset.py index 8771716..57bacad 100644 --- a/google/cloud/datalabeling_v1beta1/types/dataset.py +++ b/google/cloud/datalabeling_v1beta1/types/dataset.py @@ -73,9 +73,9 @@ class Dataset(proto.Message): Optional. User-provided description of the annotation specification set. The description can be up to 10000 characters long. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Time the dataset is created. - input_configs (Sequence[~.dataset.InputConfig]): + input_configs (Sequence[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 @@ -109,24 +109,24 @@ class InputConfig(proto.Message): location, etc. Attributes: - text_metadata (~.dataset.TextMetadata): + text_metadata (google.cloud.datalabeling_v1beta1.types.TextMetadata): Required for text import, as language code must be specified. - gcs_source (~.dataset.GcsSource): + gcs_source (google.cloud.datalabeling_v1beta1.types.GcsSource): Source located in Cloud Storage. - bigquery_source (~.dataset.BigQuerySource): + bigquery_source (google.cloud.datalabeling_v1beta1.types.BigQuerySource): Source located in BigQuery. You must specify this field if you are using this InputConfig in an [EvaluationJob][google.cloud.datalabeling.v1beta1.EvaluationJob]. - data_type (~.dataset.DataType): + data_type (google.cloud.datalabeling_v1beta1.types.DataType): Required. Data type must be specifed when user tries to import data. - annotation_type (~.annotation.AnnotationType): + annotation_type (google.cloud.datalabeling_v1beta1.types.AnnotationType): Optional. The type of annotation to be performed on this data. You must specify this field if you are using this InputConfig in an [EvaluationJob][google.cloud.datalabeling.v1beta1.EvaluationJob]. - classification_metadata (~.dataset.ClassificationMetadata): + classification_metadata (google.cloud.datalabeling_v1beta1.types.ClassificationMetadata): Optional. Metadata about annotations for the input. You must specify this field if you are using this InputConfig in an [EvaluationJob][google.cloud.datalabeling.v1beta1.EvaluationJob] @@ -228,11 +228,11 @@ class OutputConfig(proto.Message): r"""The configuration of output data. Attributes: - gcs_destination (~.dataset.GcsDestination): + gcs_destination (google.cloud.datalabeling_v1beta1.types.GcsDestination): Output to a file in Cloud Storage. Should be used for labeling output other than image segmentation. - gcs_folder_destination (~.dataset.GcsFolderDestination): + gcs_folder_destination (google.cloud.datalabeling_v1beta1.types.GcsFolderDestination): Output to a folder in Cloud Storage. Should be used for image segmentation labeling output. """ @@ -281,13 +281,13 @@ class DataItem(proto.Message): an image. Attributes: - image_payload (~.data_payloads.ImagePayload): + image_payload (google.cloud.datalabeling_v1beta1.types.ImagePayload): The image payload, a container of the image bytes/uri. - text_payload (~.data_payloads.TextPayload): + text_payload (google.cloud.datalabeling_v1beta1.types.TextPayload): The text payload, a container of text content. - video_payload (~.data_payloads.VideoPayload): + video_payload (google.cloud.datalabeling_v1beta1.types.VideoPayload): The video payload, a container of the video uri. name (str): @@ -330,9 +330,9 @@ class AnnotatedDataset(proto.Message): AnnotatedDataset. It is specified in HumanAnnotationConfig when user starts a labeling task. Maximum of 10000 characters. - annotation_source (~.annotation.AnnotationSource): + annotation_source (google.cloud.datalabeling_v1beta1.types.AnnotationSource): Output only. Source of the annotation. - annotation_type (~.annotation.AnnotationType): + annotation_type (google.cloud.datalabeling_v1beta1.types.AnnotationType): Output only. Type of the annotation. It is specified when starting labeling task. example_count (int): @@ -341,12 +341,12 @@ class AnnotatedDataset(proto.Message): completed_example_count (int): Output only. Number of examples that have annotation in the annotated dataset. - label_stats (~.dataset.LabelStats): + label_stats (google.cloud.datalabeling_v1beta1.types.LabelStats): Output only. Per label statistics. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Time the AnnotatedDataset was created. - metadata (~.dataset.AnnotatedDatasetMetadata): + metadata (google.cloud.datalabeling_v1beta1.types.AnnotatedDatasetMetadata): Output only. Additional information about AnnotatedDataset. blocking_resources (Sequence[str]): @@ -386,7 +386,7 @@ class LabelStats(proto.Message): r"""Statistics about annotation specs. Attributes: - example_count (Sequence[~.dataset.LabelStats.ExampleCountEntry]): + example_count (Sequence[google.cloud.datalabeling_v1beta1.types.LabelStats.ExampleCountEntry]): 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 @@ -403,30 +403,30 @@ class AnnotatedDatasetMetadata(proto.Message): r"""Metadata on AnnotatedDataset. Attributes: - image_classification_config (~.gcd_human_annotation_config.ImageClassificationConfig): + image_classification_config (google.cloud.datalabeling_v1beta1.types.ImageClassificationConfig): Configuration for image classification task. - bounding_poly_config (~.gcd_human_annotation_config.BoundingPolyConfig): + bounding_poly_config (google.cloud.datalabeling_v1beta1.types.BoundingPolyConfig): Configuration for image bounding box and bounding poly task. - polyline_config (~.gcd_human_annotation_config.PolylineConfig): + polyline_config (google.cloud.datalabeling_v1beta1.types.PolylineConfig): Configuration for image polyline task. - segmentation_config (~.gcd_human_annotation_config.SegmentationConfig): + segmentation_config (google.cloud.datalabeling_v1beta1.types.SegmentationConfig): Configuration for image segmentation task. - video_classification_config (~.gcd_human_annotation_config.VideoClassificationConfig): + video_classification_config (google.cloud.datalabeling_v1beta1.types.VideoClassificationConfig): Configuration for video classification task. - object_detection_config (~.gcd_human_annotation_config.ObjectDetectionConfig): + object_detection_config (google.cloud.datalabeling_v1beta1.types.ObjectDetectionConfig): Configuration for video object detection task. - object_tracking_config (~.gcd_human_annotation_config.ObjectTrackingConfig): + object_tracking_config (google.cloud.datalabeling_v1beta1.types.ObjectTrackingConfig): Configuration for video object tracking task. - event_config (~.gcd_human_annotation_config.EventConfig): + event_config (google.cloud.datalabeling_v1beta1.types.EventConfig): Configuration for video event labeling task. - text_classification_config (~.gcd_human_annotation_config.TextClassificationConfig): + text_classification_config (google.cloud.datalabeling_v1beta1.types.TextClassificationConfig): Configuration for text classification task. - text_entity_extraction_config (~.gcd_human_annotation_config.TextEntityExtractionConfig): + text_entity_extraction_config (google.cloud.datalabeling_v1beta1.types.TextEntityExtractionConfig): Configuration for text entity extraction task. - human_annotation_config (~.gcd_human_annotation_config.HumanAnnotationConfig): + human_annotation_config (google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig): HumanAnnotationConfig used when requesting the human labeling task for this AnnotatedDataset. @@ -514,20 +514,20 @@ class Example(proto.Message): example, an image with label "house". Attributes: - image_payload (~.data_payloads.ImagePayload): + image_payload (google.cloud.datalabeling_v1beta1.types.ImagePayload): The image payload, a container of the image bytes/uri. - text_payload (~.data_payloads.TextPayload): + text_payload (google.cloud.datalabeling_v1beta1.types.TextPayload): The text payload, a container of the text content. - video_payload (~.data_payloads.VideoPayload): + video_payload (google.cloud.datalabeling_v1beta1.types.VideoPayload): The video payload, a container of the video uri. name (str): Output only. Name of the example, in format of: projects/{project_id}/datasets/{dataset_id}/annotatedDatasets/ {annotated_dataset_id}/examples/{example_id} - annotations (Sequence[~.annotation.Annotation]): + annotations (Sequence[google.cloud.datalabeling_v1beta1.types.Annotation]): Output only. Annotations for the piece of data in Example. One piece of data can have multiple annotations. diff --git a/google/cloud/datalabeling_v1beta1/types/evaluation.py b/google/cloud/datalabeling_v1beta1/types/evaluation.py index b8f902c..907ecf1 100644 --- a/google/cloud/datalabeling_v1beta1/types/evaluation.py +++ b/google/cloud/datalabeling_v1beta1/types/evaluation.py @@ -50,19 +50,19 @@ class Evaluation(proto.Message): the following format: "projects/{project_id}/datasets/{dataset_id}/evaluations/{evaluation_id}' - config (~.evaluation.EvaluationConfig): + config (google.cloud.datalabeling_v1beta1.types.EvaluationConfig): Output only. Options used in the evaluation job that created this evaluation. - evaluation_job_run_time (~.timestamp.Timestamp): + evaluation_job_run_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Timestamp for when the evaluation job that created this evaluation ran. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Timestamp for when this evaluation was created. - evaluation_metrics (~.evaluation.EvaluationMetrics): + evaluation_metrics (google.cloud.datalabeling_v1beta1.types.EvaluationMetrics): Output only. Metrics comparing predictions to ground truth labels. - annotation_type (~.annotation.AnnotationType): + annotation_type (google.cloud.datalabeling_v1beta1.types.AnnotationType): Output only. Type of task that the model version being evaluated performs, as defined in the @@ -100,7 +100,7 @@ class EvaluationConfig(proto.Message): [Evaluation][google.cloud.datalabeling.v1beta1.Evaluation]. Attributes: - bounding_box_evaluation_options (~.evaluation.BoundingBoxEvaluationOptions): + bounding_box_evaluation_options (google.cloud.datalabeling_v1beta1.types.BoundingBoxEvaluationOptions): Only specify this field if the related model performs image object detection (``IMAGE_BOUNDING_BOX_ANNOTATION``). Describes how to evaluate bounding boxes. @@ -133,9 +133,9 @@ class EvaluationMetrics(proto.Message): r""" Attributes: - classification_metrics (~.evaluation.ClassificationMetrics): + classification_metrics (google.cloud.datalabeling_v1beta1.types.ClassificationMetrics): - object_detection_metrics (~.evaluation.ObjectDetectionMetrics): + object_detection_metrics (google.cloud.datalabeling_v1beta1.types.ObjectDetectionMetrics): """ @@ -152,11 +152,11 @@ class ClassificationMetrics(proto.Message): r"""Metrics calculated for a classification model. Attributes: - pr_curve (~.evaluation.PrCurve): + pr_curve (google.cloud.datalabeling_v1beta1.types.PrCurve): Precision-recall curve based on ground truth labels, predicted labels, and scores for the predicted labels. - confusion_matrix (~.evaluation.ConfusionMatrix): + confusion_matrix (google.cloud.datalabeling_v1beta1.types.ConfusionMatrix): Confusion matrix of predicted labels vs. ground truth labels. """ @@ -171,7 +171,7 @@ class ObjectDetectionMetrics(proto.Message): box) model. Attributes: - pr_curve (~.evaluation.PrCurve): + pr_curve (google.cloud.datalabeling_v1beta1.types.PrCurve): Precision-recall curve. """ @@ -182,7 +182,7 @@ class PrCurve(proto.Message): r""" Attributes: - annotation_spec (~.annotation_spec_set.AnnotationSpec): + annotation_spec (google.cloud.datalabeling_v1beta1.types.AnnotationSpec): The annotation spec of the label for which the precision-recall curve calculated. If this field is empty, that means the precision-recall @@ -191,7 +191,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[~.evaluation.PrCurve.ConfidenceMetricsEntry]): + confidence_metrics_entries (Sequence[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``. @@ -285,7 +285,7 @@ class ConfusionMatrix(proto.Message): labels. Not applicable when the entry is for a single label. Attributes: - row (Sequence[~.evaluation.ConfusionMatrix.Row]): + row (Sequence[google.cloud.datalabeling_v1beta1.types.ConfusionMatrix.Row]): """ @@ -293,7 +293,7 @@ class ConfusionMatrixEntry(proto.Message): r""" Attributes: - annotation_spec (~.annotation_spec_set.AnnotationSpec): + annotation_spec (google.cloud.datalabeling_v1beta1.types.AnnotationSpec): The annotation spec of a predicted label. item_count (int): Number of items predicted to have this label. (The ground @@ -312,10 +312,10 @@ class Row(proto.Message): same ground truth label. Attributes: - annotation_spec (~.annotation_spec_set.AnnotationSpec): + annotation_spec (google.cloud.datalabeling_v1beta1.types.AnnotationSpec): The annotation spec of the ground truth label for this row. - entries (Sequence[~.evaluation.ConfusionMatrix.ConfusionMatrixEntry]): + entries (Sequence[google.cloud.datalabeling_v1beta1.types.ConfusionMatrix.ConfusionMatrixEntry]): A list of the confusion matrix entries. One entry for each possible predicted label. """ diff --git a/google/cloud/datalabeling_v1beta1/types/evaluation_job.py b/google/cloud/datalabeling_v1beta1/types/evaluation_job.py index e7dbe16..87eaf8f 100644 --- a/google/cloud/datalabeling_v1beta1/types/evaluation_job.py +++ b/google/cloud/datalabeling_v1beta1/types/evaluation_job.py @@ -54,7 +54,7 @@ class EvaluationJob(proto.Message): description (str): Required. Description of the job. The description can be up to 25,000 characters long. - state (~.evaluation_job.EvaluationJob.State): + state (google.cloud.datalabeling_v1beta1.types.EvaluationJob.State): Output only. Describes the current state of the job. schedule (str): @@ -81,7 +81,7 @@ class EvaluationJob(proto.Message): "projects/{project_id}/models/{model_name}/versions/{version_name}" There can only be one evaluation job per model version. - evaluation_job_config (~.evaluation_job.EvaluationJobConfig): + evaluation_job_config (google.cloud.datalabeling_v1beta1.types.EvaluationJobConfig): Required. Configuration details for the evaluation job. annotation_spec_set (str): @@ -99,11 +99,11 @@ 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[~.evaluation_job.Attempt]): + attempts (Sequence[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. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Timestamp of when this evaluation job was created. """ @@ -145,7 +145,7 @@ class EvaluationJobConfig(proto.Message): EvaluationJob. Attributes: - image_classification_config (~.gcd_human_annotation_config.ImageClassificationConfig): + image_classification_config (google.cloud.datalabeling_v1beta1.types.ImageClassificationConfig): Specify this field if your model version performs image classification or general classification. @@ -154,13 +154,13 @@ class EvaluationJobConfig(proto.Message): ``allowMultiLabel`` in this configuration must match ``classificationMetadata.isMultiLabel`` in [input_config][google.cloud.datalabeling.v1beta1.EvaluationJobConfig.input_config]. - bounding_poly_config (~.gcd_human_annotation_config.BoundingPolyConfig): + bounding_poly_config (google.cloud.datalabeling_v1beta1.types.BoundingPolyConfig): Specify this field if your model version performs image object detection (bounding box detection). ``annotationSpecSet`` in this configuration must match [EvaluationJob.annotationSpecSet][google.cloud.datalabeling.v1beta1.EvaluationJob.annotation_spec_set]. - text_classification_config (~.gcd_human_annotation_config.TextClassificationConfig): + text_classification_config (google.cloud.datalabeling_v1beta1.types.TextClassificationConfig): Specify this field if your model version performs text classification. @@ -169,7 +169,7 @@ class EvaluationJobConfig(proto.Message): ``allowMultiLabel`` in this configuration must match ``classificationMetadata.isMultiLabel`` in [input_config][google.cloud.datalabeling.v1beta1.EvaluationJobConfig.input_config]. - input_config (~.dataset.InputConfig): + input_config (google.cloud.datalabeling_v1beta1.types.InputConfig): Rquired. Details for the sampled prediction input. Within this configuration, there are requirements for several fields: @@ -185,7 +185,7 @@ class EvaluationJobConfig(proto.Message): - If your machine learning model performs classification, you must specify ``classificationMetadata.isMultiLabel``. - You must specify ``bigquerySource`` (not ``gcsSource``). - evaluation_config (~.evaluation.EvaluationConfig): + evaluation_config (google.cloud.datalabeling_v1beta1.types.EvaluationConfig): Required. Details for calculating evaluation metrics and creating [Evaulations][google.cloud.datalabeling.v1beta1.Evaluation]. @@ -193,7 +193,7 @@ class EvaluationJobConfig(proto.Message): must specify the ``boundingBoxEvaluationOptions`` field within this configuration. Otherwise, provide an empty object for this configuration. - human_annotation_config (~.gcd_human_annotation_config.HumanAnnotationConfig): + human_annotation_config (google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig): Optional. Details for human annotation of your data. If you set [labelMissingGroundTruth][google.cloud.datalabeling.v1beta1.EvaluationJob.label_missing_ground_truth] @@ -206,7 +206,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 (Sequence[~.evaluation_job.EvaluationJobConfig.BigqueryImportKeysEntry]): + bigquery_import_keys (Sequence[google.cloud.datalabeling_v1beta1.types.EvaluationJobConfig.BigqueryImportKeysEntry]): 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 @@ -245,7 +245,7 @@ class EvaluationJobConfig(proto.Message): interval][google.cloud.datalabeling.v1beta1.EvaluationJob.schedule]. For example, 0.1 means 10% of predictions served by your model version get saved to BigQuery. - evaluation_job_alert_config (~.evaluation_job.EvaluationJobAlertConfig): + evaluation_job_alert_config (google.cloud.datalabeling_v1beta1.types.EvaluationJobAlertConfig): Optional. Configuration details for evaluation job alerts. Specify this field if you want to receive email alerts if the evaluation @@ -323,9 +323,9 @@ class Attempt(proto.Message): r"""Records a failed evaluation job run. Attributes: - attempt_time (~.timestamp.Timestamp): + attempt_time (google.protobuf.timestamp_pb2.Timestamp): - partial_failures (Sequence[~.status.Status]): + partial_failures (Sequence[google.rpc.status_pb2.Status]): Details of errors that occurred. """ diff --git a/google/cloud/datalabeling_v1beta1/types/human_annotation_config.py b/google/cloud/datalabeling_v1beta1/types/human_annotation_config.py index 4df8c01..fa146ba 100644 --- a/google/cloud/datalabeling_v1beta1/types/human_annotation_config.py +++ b/google/cloud/datalabeling_v1beta1/types/human_annotation_config.py @@ -79,7 +79,7 @@ class HumanAnnotationConfig(proto.Message): be returned. Default is set to 1. For image related labeling, valid values are 1, 3, 5. - question_duration (~.duration.Duration): + question_duration (google.protobuf.duration_pb2.Duration): Optional. Maximum duration for contributors to answer a question. Maximum is 3600 seconds. Default is 3600 seconds. @@ -125,7 +125,7 @@ class ImageClassificationConfig(proto.Message): allow_multi_label (bool): Optional. If allow_multi_label is true, contributors are able to choose multiple labels for one image. - answer_aggregation_type (~.human_annotation_config.StringAggregationType): + answer_aggregation_type (google.cloud.datalabeling_v1beta1.types.StringAggregationType): Optional. The type of how to aggregate answers. """ @@ -196,7 +196,7 @@ class VideoClassificationConfig(proto.Message): shot, and assign labels on each video clip. Attributes: - annotation_spec_set_configs (Sequence[~.human_annotation_config.VideoClassificationConfig.AnnotationSpecSetConfig]): + annotation_spec_set_configs (Sequence[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 @@ -287,7 +287,7 @@ class TextClassificationConfig(proto.Message): able to choose multiple labels for one text segment. annotation_spec_set (str): Required. Annotation spec set resource name. - sentiment_config (~.human_annotation_config.SentimentConfig): + sentiment_config (google.cloud.datalabeling_v1beta1.types.SentimentConfig): Optional. Configs for sentiment selection. """ diff --git a/google/cloud/datalabeling_v1beta1/types/instruction.py b/google/cloud/datalabeling_v1beta1/types/instruction.py index 4223dea..09fdd6e 100644 --- a/google/cloud/datalabeling_v1beta1/types/instruction.py +++ b/google/cloud/datalabeling_v1beta1/types/instruction.py @@ -43,13 +43,13 @@ class Instruction(proto.Message): Optional. User-provided description of the instruction. The description can be up to 10000 characters long. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Creation time of instruction. - update_time (~.timestamp.Timestamp): + update_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Last update time of instruction. - data_type (~.dataset.DataType): + data_type (google.cloud.datalabeling_v1beta1.types.DataType): Required. The data type of this instruction. - csv_instruction (~.instruction.CsvInstruction): + csv_instruction (google.cloud.datalabeling_v1beta1.types.CsvInstruction): Deprecated: this instruction format is not supported any more. Instruction from a CSV file, such as for classification task. The CSV file should have exact two @@ -59,7 +59,7 @@ class Instruction(proto.Message): reference, text. - The second column is comma separated labels associated with data. - pdf_instruction (~.instruction.PdfInstruction): + 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]): diff --git a/google/cloud/datalabeling_v1beta1/types/operations.py b/google/cloud/datalabeling_v1beta1/types/operations.py index 4706d91..d4e0603 100644 --- a/google/cloud/datalabeling_v1beta1/types/operations.py +++ b/google/cloud/datalabeling_v1beta1/types/operations.py @@ -82,10 +82,10 @@ class ExportDataOperationResponse(proto.Message): export_count (int): Output only. Number of examples exported successfully. - label_stats (~.gcd_dataset.LabelStats): + label_stats (google.cloud.datalabeling_v1beta1.types.LabelStats): Output only. Statistic infos of labels in the exported dataset. - output_config (~.gcd_dataset.OutputConfig): + output_config (google.cloud.datalabeling_v1beta1.types.OutputConfig): Output only. output_config in the ExportData request. """ @@ -109,12 +109,12 @@ class ImportDataOperationMetadata(proto.Message): dataset (str): Output only. The name of imported dataset. "projects/*/datasets/*". - partial_failures (Sequence[~.status.Status]): + partial_failures (Sequence[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 error details. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Timestamp when import dataset request was created. """ @@ -135,12 +135,12 @@ class ExportDataOperationMetadata(proto.Message): dataset (str): Output only. The name of dataset to be exported. "projects/*/datasets/*". - partial_failures (Sequence[~.status.Status]): + partial_failures (Sequence[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 error details. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Timestamp when export dataset request was created. """ @@ -159,48 +159,48 @@ class LabelOperationMetadata(proto.Message): LabelVideo. Next tag: 20 Attributes: - image_classification_details (~.operations.LabelImageClassificationOperationMetadata): + image_classification_details (google.cloud.datalabeling_v1beta1.types.LabelImageClassificationOperationMetadata): Details of label image classification operation. - image_bounding_box_details (~.operations.LabelImageBoundingBoxOperationMetadata): + image_bounding_box_details (google.cloud.datalabeling_v1beta1.types.LabelImageBoundingBoxOperationMetadata): Details of label image bounding box operation. - image_bounding_poly_details (~.operations.LabelImageBoundingPolyOperationMetadata): + image_bounding_poly_details (google.cloud.datalabeling_v1beta1.types.LabelImageBoundingPolyOperationMetadata): Details of label image bounding poly operation. - image_oriented_bounding_box_details (~.operations.LabelImageOrientedBoundingBoxOperationMetadata): + image_oriented_bounding_box_details (google.cloud.datalabeling_v1beta1.types.LabelImageOrientedBoundingBoxOperationMetadata): Details of label image oriented bounding box operation. - image_polyline_details (~.operations.LabelImagePolylineOperationMetadata): + image_polyline_details (google.cloud.datalabeling_v1beta1.types.LabelImagePolylineOperationMetadata): Details of label image polyline operation. - image_segmentation_details (~.operations.LabelImageSegmentationOperationMetadata): + image_segmentation_details (google.cloud.datalabeling_v1beta1.types.LabelImageSegmentationOperationMetadata): Details of label image segmentation operation. - video_classification_details (~.operations.LabelVideoClassificationOperationMetadata): + video_classification_details (google.cloud.datalabeling_v1beta1.types.LabelVideoClassificationOperationMetadata): Details of label video classification operation. - video_object_detection_details (~.operations.LabelVideoObjectDetectionOperationMetadata): + video_object_detection_details (google.cloud.datalabeling_v1beta1.types.LabelVideoObjectDetectionOperationMetadata): Details of label video object detection operation. - video_object_tracking_details (~.operations.LabelVideoObjectTrackingOperationMetadata): + video_object_tracking_details (google.cloud.datalabeling_v1beta1.types.LabelVideoObjectTrackingOperationMetadata): Details of label video object tracking operation. - video_event_details (~.operations.LabelVideoEventOperationMetadata): + video_event_details (google.cloud.datalabeling_v1beta1.types.LabelVideoEventOperationMetadata): Details of label video event operation. - text_classification_details (~.operations.LabelTextClassificationOperationMetadata): + text_classification_details (google.cloud.datalabeling_v1beta1.types.LabelTextClassificationOperationMetadata): Details of label text classification operation. - text_entity_extraction_details (~.operations.LabelTextEntityExtractionOperationMetadata): + text_entity_extraction_details (google.cloud.datalabeling_v1beta1.types.LabelTextEntityExtractionOperationMetadata): Details of label text entity extraction operation. progress_percent (int): Output only. Progress of label operation. Range: [0, 100]. - partial_failures (Sequence[~.status.Status]): + partial_failures (Sequence[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 error details. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Timestamp when labeling request was created. """ @@ -302,7 +302,7 @@ class LabelImageClassificationOperationMetadata(proto.Message): r"""Metadata of a LabelImageClassification operation. Attributes: - basic_config (~.human_annotation_config.HumanAnnotationConfig): + basic_config (google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig): Basic human annotation config used in labeling request. """ @@ -316,7 +316,7 @@ class LabelImageBoundingBoxOperationMetadata(proto.Message): r"""Details of a LabelImageBoundingBox operation metadata. Attributes: - basic_config (~.human_annotation_config.HumanAnnotationConfig): + basic_config (google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig): Basic human annotation config used in labeling request. """ @@ -331,7 +331,7 @@ class LabelImageOrientedBoundingBoxOperationMetadata(proto.Message): metadata. Attributes: - basic_config (~.human_annotation_config.HumanAnnotationConfig): + basic_config (google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig): Basic human annotation config. """ @@ -344,7 +344,7 @@ class LabelImageBoundingPolyOperationMetadata(proto.Message): r"""Details of LabelImageBoundingPoly operation metadata. Attributes: - basic_config (~.human_annotation_config.HumanAnnotationConfig): + basic_config (google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig): Basic human annotation config used in labeling request. """ @@ -358,7 +358,7 @@ class LabelImagePolylineOperationMetadata(proto.Message): r"""Details of LabelImagePolyline operation metadata. Attributes: - basic_config (~.human_annotation_config.HumanAnnotationConfig): + basic_config (google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig): Basic human annotation config used in labeling request. """ @@ -372,7 +372,7 @@ class LabelImageSegmentationOperationMetadata(proto.Message): r"""Details of a LabelImageSegmentation operation metadata. Attributes: - basic_config (~.human_annotation_config.HumanAnnotationConfig): + basic_config (google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig): Basic human annotation config. """ @@ -385,7 +385,7 @@ class LabelVideoClassificationOperationMetadata(proto.Message): r"""Details of a LabelVideoClassification operation metadata. Attributes: - basic_config (~.human_annotation_config.HumanAnnotationConfig): + basic_config (google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig): Basic human annotation config used in labeling request. """ @@ -399,7 +399,7 @@ class LabelVideoObjectDetectionOperationMetadata(proto.Message): r"""Details of a LabelVideoObjectDetection operation metadata. Attributes: - basic_config (~.human_annotation_config.HumanAnnotationConfig): + basic_config (google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig): Basic human annotation config used in labeling request. """ @@ -413,7 +413,7 @@ class LabelVideoObjectTrackingOperationMetadata(proto.Message): r"""Details of a LabelVideoObjectTracking operation metadata. Attributes: - basic_config (~.human_annotation_config.HumanAnnotationConfig): + basic_config (google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig): Basic human annotation config used in labeling request. """ @@ -427,7 +427,7 @@ class LabelVideoEventOperationMetadata(proto.Message): r"""Details of a LabelVideoEvent operation metadata. Attributes: - basic_config (~.human_annotation_config.HumanAnnotationConfig): + basic_config (google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig): Basic human annotation config used in labeling request. """ @@ -441,7 +441,7 @@ class LabelTextClassificationOperationMetadata(proto.Message): r"""Details of a LabelTextClassification operation metadata. Attributes: - basic_config (~.human_annotation_config.HumanAnnotationConfig): + basic_config (google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig): Basic human annotation config used in labeling request. """ @@ -455,7 +455,7 @@ class LabelTextEntityExtractionOperationMetadata(proto.Message): r"""Details of a LabelTextEntityExtraction operation metadata. Attributes: - basic_config (~.human_annotation_config.HumanAnnotationConfig): + basic_config (google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig): Basic human annotation config used in labeling request. """ @@ -472,12 +472,12 @@ class CreateInstructionMetadata(proto.Message): instruction (str): The name of the created Instruction. projects/{project_id}/instructions/{instruction_id} - partial_failures (Sequence[~.status.Status]): + partial_failures (Sequence[google.rpc.status_pb2.Status]): Partial failures encountered. E.g. single files that couldn't be read. Status details field will contain standard GCP error details. - create_time (~.timestamp.Timestamp): + create_time (google.protobuf.timestamp_pb2.Timestamp): Timestamp when create instruction request was created. """ diff --git a/noxfile.py b/noxfile.py index f15a47f..6e8aafb 100644 --- a/noxfile.py +++ b/noxfile.py @@ -18,6 +18,7 @@ from __future__ import absolute_import import os +import pathlib import shutil import nox @@ -30,6 +31,8 @@ SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9"] +CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() + # 'docfx' is excluded since it only needs to run in 'docs-presubmit' nox.options.sessions = [ "unit", @@ -41,6 +44,9 @@ "docs", ] +# Error if a python version is missing +nox.options.error_on_missing_interpreters = True + @nox.session(python=DEFAULT_PYTHON_VERSION) def lint(session): @@ -81,13 +87,15 @@ def lint_setup_py(session): def default(session): # Install all test dependencies, then install this package in-place. - session.install("asyncmock", "pytest-asyncio") - session.install( - "mock", "pytest", "pytest-cov", + constraints_path = str( + CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) + session.install("asyncmock", "pytest-asyncio", "-c", constraints_path) - session.install("-e", ".") + session.install("mock", "pytest", "pytest-cov", "-c", constraints_path) + + session.install("-e", ".", "-c", constraints_path) # Run py.test against the unit tests. session.run( @@ -114,6 +122,9 @@ def unit(session): @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" + constraints_path = str( + CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" + ) system_test_path = os.path.join("tests", "system.py") system_test_folder_path = os.path.join("tests", "system") @@ -123,6 +134,9 @@ def system(session): # Sanity check: Only run tests if the environment variable is set. if not os.environ.get("GOOGLE_APPLICATION_CREDENTIALS", ""): session.skip("Credentials must be set via environment variable") + # Install pyopenssl for mTLS testing. + if os.environ.get("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true": + session.install("pyopenssl") system_test_exists = os.path.exists(system_test_path) system_test_folder_exists = os.path.exists(system_test_folder_path) @@ -135,10 +149,8 @@ def system(session): # Install all test dependencies, then install this package into the # virtualenv's dist-packages. - session.install( - "mock", "pytest", "google-cloud-testutils", - ) - session.install("-e", ".") + session.install("mock", "pytest", "google-cloud-testutils", "-c", constraints_path) + session.install("-e", ".", "-c", constraints_path) # Run py.test against the system tests. if system_test_exists: @@ -167,7 +179,7 @@ def cover(session): test runs (not system test runs), and then erases coverage data. """ session.install("coverage", "pytest-cov") - session.run("coverage", "report", "--show-missing", "--fail-under=100") + session.run("coverage", "report", "--show-missing", "--fail-under=98") session.run("coverage", "erase") @@ -199,9 +211,7 @@ def docfx(session): """Build the docfx yaml files for this library.""" session.install("-e", ".") - # sphinx-docfx-yaml supports up to sphinx version 1.5.5. - # https://github.com/docascode/sphinx-docfx-yaml/issues/97 - session.install("sphinx==1.5.5", "alabaster", "recommonmark", "sphinx-docfx-yaml") + session.install("sphinx", "alabaster", "recommonmark", "gcp-sphinx-docfx-yaml") shutil.rmtree(os.path.join("docs", "_build"), ignore_errors=True) session.run( diff --git a/renovate.json b/renovate.json index 4fa9493..f08bc22 100644 --- a/renovate.json +++ b/renovate.json @@ -1,5 +1,6 @@ { "extends": [ "config:base", ":preserveSemverRanges" - ] + ], + "ignorePaths": [".pre-commit-config.yaml"] } diff --git a/setup.py b/setup.py index d958da6..cf7ad04 100644 --- a/setup.py +++ b/setup.py @@ -24,11 +24,12 @@ version = "1.0.0" release_status = "Development Status :: 4 - Beta" dependencies = [ - "google-api-core[grpc] >= 1.22.0, < 2.0.0dev", - "libcst >= 0.2.5", + "google-api-core[grpc] >= 1.22.2, < 2.0.0dev", "proto-plus >= 1.4.0", ] +extras = {"libcst": "libcst >= 0.2.5"} + package_root = os.path.abspath(os.path.dirname(__file__)) readme_filename = os.path.join(package_root, "README.rst") @@ -72,6 +73,7 @@ scripts=["scripts/fixup_datalabeling_v1beta1_keywords.py"], namespace_packages=namespaces, install_requires=dependencies, + extras_requires=extras, include_package_data=True, zip_safe=False, ) diff --git a/synth.metadata b/synth.metadata index b306783..3724049 100644 --- a/synth.metadata +++ b/synth.metadata @@ -3,30 +3,30 @@ { "git": { "name": ".", - "remote": "https://github.com/googleapis/python-datalabeling.git", - "sha": "670365b7f41698a0b67e5d00512ecd9cfc829a0f" + "remote": "git@github.com:googleapis/python-datalabeling.git", + "sha": "6acc3cc056799882b9d52f3a12ad4a3524522344" } }, { "git": { "name": "googleapis", "remote": "https://github.com/googleapis/googleapis.git", - "sha": "dd372aa22ded7a8ba6f0e03a80e06358a3fa0907", - "internalRef": "347055288" + "sha": "8ff7d794576311d3d68d4df2ac6da93bbfcd7476", + "internalRef": "366472163" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "d17674372e27fb8f23013935e794aa37502071aa" + "sha": "ff39353f34a36e7643b86e97724e4027ab466dc6" } }, { "git": { "name": "synthtool", "remote": "https://github.com/googleapis/synthtool.git", - "sha": "d17674372e27fb8f23013935e794aa37502071aa" + "sha": "ff39353f34a36e7643b86e97724e4027ab466dc6" } } ], @@ -40,115 +40,5 @@ "generator": "bazel" } } - ], - "generatedFiles": [ - ".flake8", - ".github/CONTRIBUTING.md", - ".github/ISSUE_TEMPLATE/bug_report.md", - ".github/ISSUE_TEMPLATE/feature_request.md", - ".github/ISSUE_TEMPLATE/support_request.md", - ".github/PULL_REQUEST_TEMPLATE.md", - ".github/header-checker-lint.yml", - ".github/release-please.yml", - ".github/snippet-bot.yml", - ".gitignore", - ".kokoro/build.sh", - ".kokoro/continuous/common.cfg", - ".kokoro/continuous/continuous.cfg", - ".kokoro/docker/docs/Dockerfile", - ".kokoro/docker/docs/fetch_gpg_keys.sh", - ".kokoro/docs/common.cfg", - ".kokoro/docs/docs-presubmit.cfg", - ".kokoro/docs/docs.cfg", - ".kokoro/populate-secrets.sh", - ".kokoro/presubmit/common.cfg", - ".kokoro/presubmit/presubmit.cfg", - ".kokoro/publish-docs.sh", - ".kokoro/release.sh", - ".kokoro/release/common.cfg", - ".kokoro/release/release.cfg", - ".kokoro/samples/lint/common.cfg", - ".kokoro/samples/lint/continuous.cfg", - ".kokoro/samples/lint/periodic.cfg", - ".kokoro/samples/lint/presubmit.cfg", - ".kokoro/samples/python3.6/common.cfg", - ".kokoro/samples/python3.6/continuous.cfg", - ".kokoro/samples/python3.6/periodic.cfg", - ".kokoro/samples/python3.6/presubmit.cfg", - ".kokoro/samples/python3.7/common.cfg", - ".kokoro/samples/python3.7/continuous.cfg", - ".kokoro/samples/python3.7/periodic.cfg", - ".kokoro/samples/python3.7/presubmit.cfg", - ".kokoro/samples/python3.8/common.cfg", - ".kokoro/samples/python3.8/continuous.cfg", - ".kokoro/samples/python3.8/periodic.cfg", - ".kokoro/samples/python3.8/presubmit.cfg", - ".kokoro/test-samples.sh", - ".kokoro/trampoline.sh", - ".kokoro/trampoline_v2.sh", - ".pre-commit-config.yaml", - ".trampolinerc", - "CODE_OF_CONDUCT.md", - "CONTRIBUTING.rst", - "LICENSE", - "MANIFEST.in", - "docs/_static/custom.css", - "docs/_templates/layout.html", - "docs/conf.py", - "docs/datalabeling_v1beta1/services.rst", - "docs/datalabeling_v1beta1/types.rst", - "docs/multiprocessing.rst", - "google/cloud/datalabeling/__init__.py", - "google/cloud/datalabeling/py.typed", - "google/cloud/datalabeling_v1beta1/__init__.py", - "google/cloud/datalabeling_v1beta1/proto/annotation.proto", - "google/cloud/datalabeling_v1beta1/proto/annotation_spec_set.proto", - "google/cloud/datalabeling_v1beta1/proto/data_labeling_service.proto", - "google/cloud/datalabeling_v1beta1/proto/data_payloads.proto", - "google/cloud/datalabeling_v1beta1/proto/dataset.proto", - "google/cloud/datalabeling_v1beta1/proto/evaluation.proto", - "google/cloud/datalabeling_v1beta1/proto/evaluation_job.proto", - "google/cloud/datalabeling_v1beta1/proto/human_annotation_config.proto", - "google/cloud/datalabeling_v1beta1/proto/instruction.proto", - "google/cloud/datalabeling_v1beta1/proto/operations.proto", - "google/cloud/datalabeling_v1beta1/py.typed", - "google/cloud/datalabeling_v1beta1/services/__init__.py", - "google/cloud/datalabeling_v1beta1/services/data_labeling_service/__init__.py", - "google/cloud/datalabeling_v1beta1/services/data_labeling_service/async_client.py", - "google/cloud/datalabeling_v1beta1/services/data_labeling_service/client.py", - "google/cloud/datalabeling_v1beta1/services/data_labeling_service/pagers.py", - "google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/__init__.py", - "google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/base.py", - "google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc.py", - "google/cloud/datalabeling_v1beta1/services/data_labeling_service/transports/grpc_asyncio.py", - "google/cloud/datalabeling_v1beta1/types/__init__.py", - "google/cloud/datalabeling_v1beta1/types/annotation.py", - "google/cloud/datalabeling_v1beta1/types/annotation_spec_set.py", - "google/cloud/datalabeling_v1beta1/types/data_labeling_service.py", - "google/cloud/datalabeling_v1beta1/types/data_payloads.py", - "google/cloud/datalabeling_v1beta1/types/dataset.py", - "google/cloud/datalabeling_v1beta1/types/evaluation.py", - "google/cloud/datalabeling_v1beta1/types/evaluation_job.py", - "google/cloud/datalabeling_v1beta1/types/human_annotation_config.py", - "google/cloud/datalabeling_v1beta1/types/instruction.py", - "google/cloud/datalabeling_v1beta1/types/operations.py", - "mypy.ini", - "noxfile.py", - "renovate.json", - "samples/AUTHORING_GUIDE.md", - "samples/CONTRIBUTING.md", - "samples/snippets/noxfile.py", - "scripts/decrypt-secrets.sh", - "scripts/fixup_datalabeling_v1beta1_keywords.py", - "scripts/readme-gen/readme_gen.py", - "scripts/readme-gen/templates/README.tmpl.rst", - "scripts/readme-gen/templates/auth.tmpl.rst", - "scripts/readme-gen/templates/auth_api_key.tmpl.rst", - "scripts/readme-gen/templates/install_deps.tmpl.rst", - "scripts/readme-gen/templates/install_portaudio.tmpl.rst", - "setup.cfg", - "testing/.gitignore", - "tests/unit/gapic/datalabeling_v1beta1/__init__.py", - "tests/unit/gapic/datalabeling_v1beta1/test_data_labeling_service.py" ] } \ No newline at end of file diff --git a/synth.py b/synth.py index 346e602..cb06856 100644 --- a/synth.py +++ b/synth.py @@ -41,6 +41,7 @@ templated_files = common.py_library( samples=True, # set to True only if there are samples microgenerator=True, + cov_level=98, ) s.move(templated_files, excludes=[".coveragerc"]) # microgenerator has a good .coveragerc file diff --git a/testing/constraints-3.10.txt b/testing/constraints-3.10.txt new file mode 100644 index 0000000..e69de29 diff --git a/testing/constraints-3.11.txt b/testing/constraints-3.11.txt new file mode 100644 index 0000000..e69de29 diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt new file mode 100644 index 0000000..16e003f --- /dev/null +++ b/testing/constraints-3.6.txt @@ -0,0 +1,10 @@ +# This constraints file is used to check that lower bounds +# are correct in setup.py +# 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.22.2 +libcst==0.2.5 +proto-plus==1.4.0 diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt new file mode 100644 index 0000000..e69de29 diff --git a/testing/constraints-3.8.txt b/testing/constraints-3.8.txt new file mode 100644 index 0000000..e69de29 diff --git a/testing/constraints-3.9.txt b/testing/constraints-3.9.txt new file mode 100644 index 0000000..e69de29 diff --git a/tests/unit/gapic/datalabeling_v1beta1/__init__.py b/tests/unit/gapic/datalabeling_v1beta1/__init__.py index 8b13789..42ffdf2 100644 --- a/tests/unit/gapic/datalabeling_v1beta1/__init__.py +++ b/tests/unit/gapic/datalabeling_v1beta1/__init__.py @@ -1 +1,16 @@ +# -*- coding: utf-8 -*- +# Copyright 2020 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# diff --git a/tests/unit/gapic/datalabeling_v1beta1/test_data_labeling_service.py b/tests/unit/gapic/datalabeling_v1beta1/test_data_labeling_service.py index e2c60c3..7b31707 100644 --- a/tests/unit/gapic/datalabeling_v1beta1/test_data_labeling_service.py +++ b/tests/unit/gapic/datalabeling_v1beta1/test_data_labeling_service.py @@ -114,7 +114,24 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [DataLabelingServiceClient, DataLabelingServiceAsyncClient] + "client_class", [DataLabelingServiceClient, DataLabelingServiceAsyncClient,] +) +def test_data_labeling_service_client_from_service_account_info(client_class): + creds = credentials.AnonymousCredentials() + with mock.patch.object( + service_account.Credentials, "from_service_account_info" + ) as factory: + factory.return_value = creds + info = {"valid": True} + client = client_class.from_service_account_info(info) + assert client.transport._credentials == creds + assert isinstance(client, client_class) + + assert client.transport._host == "datalabeling.googleapis.com:443" + + +@pytest.mark.parametrize( + "client_class", [DataLabelingServiceClient, DataLabelingServiceAsyncClient,] ) def test_data_labeling_service_client_from_service_account_file(client_class): creds = credentials.AnonymousCredentials() @@ -124,16 +141,21 @@ def test_data_labeling_service_client_from_service_account_file(client_class): factory.return_value = creds client = client_class.from_service_account_file("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) client = client_class.from_service_account_json("dummy/file/path.json") assert client.transport._credentials == creds + assert isinstance(client, client_class) assert client.transport._host == "datalabeling.googleapis.com:443" def test_data_labeling_service_client_get_transport_class(): transport = DataLabelingServiceClient.get_transport_class() - assert transport == transports.DataLabelingServiceGrpcTransport + available_transports = [ + transports.DataLabelingServiceGrpcTransport, + ] + assert transport in available_transports transport = DataLabelingServiceClient.get_transport_class("grpc") assert transport == transports.DataLabelingServiceGrpcTransport @@ -188,7 +210,7 @@ def test_data_labeling_service_client_client_options( credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -204,7 +226,7 @@ def test_data_labeling_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -220,7 +242,7 @@ def test_data_labeling_service_client_client_options( credentials_file=None, host=client.DEFAULT_MTLS_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -248,7 +270,7 @@ def test_data_labeling_service_client_client_options( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id="octopus", client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -309,29 +331,25 @@ def test_data_labeling_service_client_mtls_env_auto( client_cert_source=client_cert_source_callback ) with mock.patch.object(transport_class, "__init__") as patched: - ssl_channel_creds = mock.Mock() - with mock.patch( - "grpc.ssl_channel_credentials", return_value=ssl_channel_creds - ): - patched.return_value = None - client = client_class(client_options=options) + patched.return_value = None + client = client_class(client_options=options) - if use_client_cert_env == "false": - expected_ssl_channel_creds = None - expected_host = client.DEFAULT_ENDPOINT - else: - expected_ssl_channel_creds = ssl_channel_creds - expected_host = client.DEFAULT_MTLS_ENDPOINT + if use_client_cert_env == "false": + expected_client_cert_source = None + expected_host = client.DEFAULT_ENDPOINT + else: + expected_client_cert_source = client_cert_source_callback + expected_host = client.DEFAULT_MTLS_ENDPOINT - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=expected_host, + scopes=None, + client_cert_source_for_mtls=expected_client_cert_source, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) # Check the case ADC client cert is provided. Whether client cert is used depends on # GOOGLE_API_USE_CLIENT_CERTIFICATE value. @@ -340,66 +358,53 @@ def test_data_labeling_service_client_mtls_env_auto( ): with mock.patch.object(transport_class, "__init__") as patched: with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, ): with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.ssl_credentials", - new_callable=mock.PropertyMock, - ) as ssl_credentials_mock: - if use_client_cert_env == "false": - is_mtls_mock.return_value = False - ssl_credentials_mock.return_value = None - expected_host = client.DEFAULT_ENDPOINT - expected_ssl_channel_creds = None - else: - is_mtls_mock.return_value = True - ssl_credentials_mock.return_value = mock.Mock() - expected_host = client.DEFAULT_MTLS_ENDPOINT - expected_ssl_channel_creds = ( - ssl_credentials_mock.return_value - ) - - patched.return_value = None - client = client_class() - patched.assert_called_once_with( - credentials=None, - credentials_file=None, - host=expected_host, - scopes=None, - ssl_channel_credentials=expected_ssl_channel_creds, - quota_project_id=None, - client_info=transports.base.DEFAULT_CLIENT_INFO, - ) + "google.auth.transport.mtls.default_client_cert_source", + return_value=client_cert_source_callback, + ): + if use_client_cert_env == "false": + expected_host = client.DEFAULT_ENDPOINT + expected_client_cert_source = None + else: + expected_host = client.DEFAULT_MTLS_ENDPOINT + expected_client_cert_source = client_cert_source_callback - # Check the case client_cert_source and ADC client cert are not provided. - with mock.patch.dict( - os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} - ): - with mock.patch.object(transport_class, "__init__") as patched: - with mock.patch( - "google.auth.transport.grpc.SslCredentials.__init__", return_value=None - ): - with mock.patch( - "google.auth.transport.grpc.SslCredentials.is_mtls", - new_callable=mock.PropertyMock, - ) as is_mtls_mock: - is_mtls_mock.return_value = False patched.return_value = None client = client_class() patched.assert_called_once_with( credentials=None, credentials_file=None, - host=client.DEFAULT_ENDPOINT, + host=expected_host, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=expected_client_cert_source, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) + # Check the case client_cert_source and ADC client cert are not provided. + with mock.patch.dict( + os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": use_client_cert_env} + ): + with mock.patch.object(transport_class, "__init__") as patched: + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + patched.return_value = None + client = client_class() + patched.assert_called_once_with( + credentials=None, + credentials_file=None, + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + ) + @pytest.mark.parametrize( "client_class,transport_class,transport_name", @@ -429,7 +434,7 @@ def test_data_labeling_service_client_client_options_scopes( credentials_file=None, host=client.DEFAULT_ENDPOINT, scopes=["1", "2"], - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -463,7 +468,7 @@ def test_data_labeling_service_client_client_options_credentials_file( credentials_file="credentials.json", host=client.DEFAULT_ENDPOINT, scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -482,7 +487,7 @@ def test_data_labeling_service_client_client_options_from_dict(): credentials_file=None, host="squid.clam.whelk", scopes=None, - ssl_channel_credentials=None, + client_cert_source_for_mtls=None, quota_project_id=None, client_info=transports.base.DEFAULT_CLIENT_INFO, ) @@ -537,6 +542,22 @@ def test_create_dataset_from_dict(): test_create_dataset(request_type=dict) +def test_create_dataset_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.create_dataset), "__call__") as call: + client.create_dataset() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.CreateDatasetRequest() + + @pytest.mark.asyncio async def test_create_dataset_async( transport: str = "grpc_asyncio", @@ -771,6 +792,22 @@ def test_get_dataset_from_dict(): test_get_dataset(request_type=dict) +def test_get_dataset_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_dataset), "__call__") as call: + client.get_dataset() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.GetDatasetRequest() + + @pytest.mark.asyncio async def test_get_dataset_async( transport: str = "grpc_asyncio", @@ -981,6 +1018,22 @@ def test_list_datasets_from_dict(): test_list_datasets(request_type=dict) +def test_list_datasets_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_datasets), "__call__") as call: + client.list_datasets() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.ListDatasetsRequest() + + @pytest.mark.asyncio async def test_list_datasets_async( transport: str = "grpc_asyncio", @@ -1324,6 +1377,22 @@ def test_delete_dataset_from_dict(): test_delete_dataset(request_type=dict) +def test_delete_dataset_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.delete_dataset), "__call__") as call: + client.delete_dataset() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.DeleteDatasetRequest() + + @pytest.mark.asyncio async def test_delete_dataset_async( transport: str = "grpc_asyncio", @@ -1511,6 +1580,22 @@ def test_import_data_from_dict(): test_import_data(request_type=dict) +def test_import_data_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.import_data), "__call__") as call: + client.import_data() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.ImportDataRequest() + + @pytest.mark.asyncio async def test_import_data_async( transport: str = "grpc_asyncio", @@ -1730,6 +1815,22 @@ def test_export_data_from_dict(): test_export_data(request_type=dict) +def test_export_data_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.export_data), "__call__") as call: + client.export_data() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.ExportDataRequest() + + @pytest.mark.asyncio async def test_export_data_async( transport: str = "grpc_asyncio", @@ -1971,6 +2072,22 @@ def test_get_data_item_from_dict(): test_get_data_item(request_type=dict) +def test_get_data_item_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_data_item), "__call__") as call: + client.get_data_item() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.GetDataItemRequest() + + @pytest.mark.asyncio async def test_get_data_item_async( transport: str = "grpc_asyncio", @@ -2167,6 +2284,22 @@ def test_list_data_items_from_dict(): test_list_data_items(request_type=dict) +def test_list_data_items_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_data_items), "__call__") as call: + client.list_data_items() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.ListDataItemsRequest() + + @pytest.mark.asyncio async def test_list_data_items_async( transport: str = "grpc_asyncio", @@ -2558,6 +2691,24 @@ def test_get_annotated_dataset_from_dict(): test_get_annotated_dataset(request_type=dict) +def test_get_annotated_dataset_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_annotated_dataset), "__call__" + ) as call: + client.get_annotated_dataset() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.GetAnnotatedDatasetRequest() + + @pytest.mark.asyncio async def test_get_annotated_dataset_async( transport: str = "grpc_asyncio", @@ -2797,6 +2948,24 @@ def test_list_annotated_datasets_from_dict(): test_list_annotated_datasets(request_type=dict) +def test_list_annotated_datasets_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_annotated_datasets), "__call__" + ) as call: + client.list_annotated_datasets() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.ListAnnotatedDatasetsRequest() + + @pytest.mark.asyncio async def test_list_annotated_datasets_async( transport: str = "grpc_asyncio", @@ -3189,6 +3358,24 @@ def test_delete_annotated_dataset_from_dict(): test_delete_annotated_dataset(request_type=dict) +def test_delete_annotated_dataset_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_annotated_dataset), "__call__" + ) as call: + client.delete_annotated_dataset() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.DeleteAnnotatedDatasetRequest() + + @pytest.mark.asyncio async def test_delete_annotated_dataset_async( transport: str = "grpc_asyncio", @@ -3313,6 +3500,22 @@ def test_label_image_from_dict(): test_label_image(request_type=dict) +def test_label_image_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.label_image), "__call__") as call: + client.label_image() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.LabelImageRequest() + + @pytest.mark.asyncio async def test_label_image_async( transport: str = "grpc_asyncio", @@ -3546,6 +3749,22 @@ def test_label_video_from_dict(): test_label_video(request_type=dict) +def test_label_video_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.label_video), "__call__") as call: + client.label_video() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.LabelVideoRequest() + + @pytest.mark.asyncio async def test_label_video_async( transport: str = "grpc_asyncio", @@ -3779,6 +3998,22 @@ def test_label_text_from_dict(): test_label_text(request_type=dict) +def test_label_text_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.label_text), "__call__") as call: + client.label_text() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.LabelTextRequest() + + @pytest.mark.asyncio async def test_label_text_async( transport: str = "grpc_asyncio", request_type=data_labeling_service.LabelTextRequest @@ -4017,6 +4252,22 @@ def test_get_example_from_dict(): test_get_example(request_type=dict) +def test_get_example_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_example), "__call__") as call: + client.get_example() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.GetExampleRequest() + + @pytest.mark.asyncio async def test_get_example_async( transport: str = "grpc_asyncio", @@ -4223,6 +4474,22 @@ def test_list_examples_from_dict(): test_list_examples(request_type=dict) +def test_list_examples_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_examples), "__call__") as call: + client.list_examples() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.ListExamplesRequest() + + @pytest.mark.asyncio async def test_list_examples_async( transport: str = "grpc_asyncio", @@ -4583,6 +4850,24 @@ def test_create_annotation_spec_set_from_dict(): test_create_annotation_spec_set(request_type=dict) +def test_create_annotation_spec_set_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_annotation_spec_set), "__call__" + ) as call: + client.create_annotation_spec_set() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.CreateAnnotationSpecSetRequest() + + @pytest.mark.asyncio async def test_create_annotation_spec_set_async( transport: str = "grpc_asyncio", @@ -4842,6 +5127,24 @@ def test_get_annotation_spec_set_from_dict(): test_get_annotation_spec_set(request_type=dict) +def test_get_annotation_spec_set_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_annotation_spec_set), "__call__" + ) as call: + client.get_annotation_spec_set() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.GetAnnotationSpecSetRequest() + + @pytest.mark.asyncio async def test_get_annotation_spec_set_async( transport: str = "grpc_asyncio", @@ -5066,6 +5369,24 @@ def test_list_annotation_spec_sets_from_dict(): test_list_annotation_spec_sets(request_type=dict) +def test_list_annotation_spec_sets_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_annotation_spec_sets), "__call__" + ) as call: + client.list_annotation_spec_sets() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.ListAnnotationSpecSetsRequest() + + @pytest.mark.asyncio async def test_list_annotation_spec_sets_async( transport: str = "grpc_asyncio", @@ -5466,6 +5787,24 @@ def test_delete_annotation_spec_set_from_dict(): test_delete_annotation_spec_set(request_type=dict) +def test_delete_annotation_spec_set_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_annotation_spec_set), "__call__" + ) as call: + client.delete_annotation_spec_set() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.DeleteAnnotationSpecSetRequest() + + @pytest.mark.asyncio async def test_delete_annotation_spec_set_async( transport: str = "grpc_asyncio", @@ -5665,6 +6004,24 @@ def test_create_instruction_from_dict(): test_create_instruction(request_type=dict) +def test_create_instruction_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_instruction), "__call__" + ) as call: + client.create_instruction() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.CreateInstructionRequest() + + @pytest.mark.asyncio async def test_create_instruction_async( transport: str = "grpc_asyncio", @@ -5899,6 +6256,22 @@ def test_get_instruction_from_dict(): test_get_instruction(request_type=dict) +def test_get_instruction_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_instruction), "__call__") as call: + client.get_instruction() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.GetInstructionRequest() + + @pytest.mark.asyncio async def test_get_instruction_async( transport: str = "grpc_asyncio", @@ -6115,6 +6488,24 @@ def test_list_instructions_from_dict(): test_list_instructions(request_type=dict) +def test_list_instructions_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_instructions), "__call__" + ) as call: + client.list_instructions() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.ListInstructionsRequest() + + @pytest.mark.asyncio async def test_list_instructions_async( transport: str = "grpc_asyncio", @@ -6494,6 +6885,24 @@ def test_delete_instruction_from_dict(): test_delete_instruction(request_type=dict) +def test_delete_instruction_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_instruction), "__call__" + ) as call: + client.delete_instruction() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.DeleteInstructionRequest() + + @pytest.mark.asyncio async def test_delete_instruction_async( transport: str = "grpc_asyncio", @@ -6705,6 +7114,22 @@ def test_get_evaluation_from_dict(): test_get_evaluation(request_type=dict) +def test_get_evaluation_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_evaluation), "__call__") as call: + client.get_evaluation() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.GetEvaluationRequest() + + @pytest.mark.asyncio async def test_get_evaluation_async( transport: str = "grpc_asyncio", @@ -6918,6 +7343,24 @@ def test_search_evaluations_from_dict(): test_search_evaluations(request_type=dict) +def test_search_evaluations_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.search_evaluations), "__call__" + ) as call: + client.search_evaluations() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.SearchEvaluationsRequest() + + @pytest.mark.asyncio async def test_search_evaluations_async( transport: str = "grpc_asyncio", @@ -7303,6 +7746,24 @@ def test_search_example_comparisons_from_dict(): test_search_example_comparisons(request_type=dict) +def test_search_example_comparisons_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.search_example_comparisons), "__call__" + ) as call: + client.search_example_comparisons() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.SearchExampleComparisonsRequest() + + @pytest.mark.asyncio async def test_search_example_comparisons_async( transport: str = "grpc_asyncio", @@ -7732,6 +8193,24 @@ def test_create_evaluation_job_from_dict(): test_create_evaluation_job(request_type=dict) +def test_create_evaluation_job_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_evaluation_job), "__call__" + ) as call: + client.create_evaluation_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.CreateEvaluationJobRequest() + + @pytest.mark.asyncio async def test_create_evaluation_job_async( transport: str = "grpc_asyncio", @@ -7995,6 +8474,24 @@ def test_update_evaluation_job_from_dict(): test_update_evaluation_job(request_type=dict) +def test_update_evaluation_job_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_evaluation_job), "__call__" + ) as call: + client.update_evaluation_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.UpdateEvaluationJobRequest() + + @pytest.mark.asyncio async def test_update_evaluation_job_async( transport: str = "grpc_asyncio", @@ -8269,6 +8766,24 @@ def test_get_evaluation_job_from_dict(): test_get_evaluation_job(request_type=dict) +def test_get_evaluation_job_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_evaluation_job), "__call__" + ) as call: + client.get_evaluation_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.GetEvaluationJobRequest() + + @pytest.mark.asyncio async def test_get_evaluation_job_async( transport: str = "grpc_asyncio", @@ -8497,6 +9012,24 @@ def test_pause_evaluation_job_from_dict(): test_pause_evaluation_job(request_type=dict) +def test_pause_evaluation_job_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.pause_evaluation_job), "__call__" + ) as call: + client.pause_evaluation_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.PauseEvaluationJobRequest() + + @pytest.mark.asyncio async def test_pause_evaluation_job_async( transport: str = "grpc_asyncio", @@ -8697,6 +9230,24 @@ def test_resume_evaluation_job_from_dict(): test_resume_evaluation_job(request_type=dict) +def test_resume_evaluation_job_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.resume_evaluation_job), "__call__" + ) as call: + client.resume_evaluation_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.ResumeEvaluationJobRequest() + + @pytest.mark.asyncio async def test_resume_evaluation_job_async( transport: str = "grpc_asyncio", @@ -8897,6 +9448,24 @@ def test_delete_evaluation_job_from_dict(): test_delete_evaluation_job(request_type=dict) +def test_delete_evaluation_job_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_evaluation_job), "__call__" + ) as call: + client.delete_evaluation_job() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.DeleteEvaluationJobRequest() + + @pytest.mark.asyncio async def test_delete_evaluation_job_async( transport: str = "grpc_asyncio", @@ -9102,6 +9671,24 @@ def test_list_evaluation_jobs_from_dict(): test_list_evaluation_jobs(request_type=dict) +def test_list_evaluation_jobs_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = DataLabelingServiceClient( + credentials=credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_evaluation_jobs), "__call__" + ) as call: + client.list_evaluation_jobs() + call.assert_called() + _, args, _ = call.mock_calls[0] + + assert args[0] == data_labeling_service.ListEvaluationJobsRequest() + + @pytest.mark.asyncio async def test_list_evaluation_jobs_async( transport: str = "grpc_asyncio", @@ -9660,6 +10247,53 @@ def test_data_labeling_service_transport_auth_adc(): ) +@pytest.mark.parametrize( + "transport_class", + [ + transports.DataLabelingServiceGrpcTransport, + transports.DataLabelingServiceGrpcAsyncIOTransport, + ], +) +def test_data_labeling_service_grpc_transport_client_cert_source_for_mtls( + transport_class, +): + cred = credentials.AnonymousCredentials() + + # Check ssl_channel_credentials is used if provided. + with mock.patch.object(transport_class, "create_channel") as mock_create_channel: + mock_ssl_channel_creds = mock.Mock() + transport_class( + host="squid.clam.whelk", + credentials=cred, + ssl_channel_credentials=mock_ssl_channel_creds, + ) + mock_create_channel.assert_called_once_with( + "squid.clam.whelk:443", + credentials=cred, + credentials_file=None, + scopes=("https://www.googleapis.com/auth/cloud-platform",), + ssl_credentials=mock_ssl_channel_creds, + quota_project_id=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + # Check if ssl_channel_credentials is not provided, then client_cert_source_for_mtls + # is used. + with mock.patch.object(transport_class, "create_channel", return_value=mock.Mock()): + with mock.patch("grpc.ssl_channel_credentials") as mock_ssl_cred: + transport_class( + credentials=cred, + client_cert_source_for_mtls=client_cert_source_callback, + ) + expected_cert, expected_key = client_cert_source_callback() + mock_ssl_cred.assert_called_once_with( + certificate_chain=expected_cert, private_key=expected_key + ) + + def test_data_labeling_service_host_no_port(): client = DataLabelingServiceClient( credentials=credentials.AnonymousCredentials(), @@ -9681,7 +10315,7 @@ def test_data_labeling_service_host_with_port(): def test_data_labeling_service_grpc_transport_channel(): - channel = grpc.insecure_channel("http://localhost/") + channel = grpc.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.DataLabelingServiceGrpcTransport( @@ -9693,7 +10327,7 @@ def test_data_labeling_service_grpc_transport_channel(): def test_data_labeling_service_grpc_asyncio_transport_channel(): - channel = aio.insecure_channel("http://localhost/") + channel = aio.secure_channel("http://localhost/", grpc.local_channel_credentials()) # Check that channel is used if provided. transport = transports.DataLabelingServiceGrpcAsyncIOTransport( @@ -9704,6 +10338,8 @@ def test_data_labeling_service_grpc_asyncio_transport_channel(): assert transport._ssl_channel_credentials == None +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -9718,7 +10354,7 @@ def test_data_labeling_service_transport_channel_mtls_with_client_cert_source( "grpc.ssl_channel_credentials", autospec=True ) as grpc_ssl_channel_cred: with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_ssl_cred = mock.Mock() grpc_ssl_channel_cred.return_value = mock_ssl_cred @@ -9756,6 +10392,8 @@ def test_data_labeling_service_transport_channel_mtls_with_client_cert_source( assert transport._ssl_channel_credentials == mock_ssl_cred +# Remove this test when deprecated arguments (api_mtls_endpoint, client_cert_source) are +# removed from grpc/grpc_asyncio transport constructor. @pytest.mark.parametrize( "transport_class", [ @@ -9771,7 +10409,7 @@ def test_data_labeling_service_transport_channel_mtls_with_adc(transport_class): ssl_credentials=mock.PropertyMock(return_value=mock_ssl_cred), ): with mock.patch.object( - transport_class, "create_channel", autospec=True + transport_class, "create_channel" ) as grpc_create_channel: mock_grpc_channel = mock.Mock() grpc_create_channel.return_value = mock_grpc_channel