From 67656a6349ed6e7ad14e4dcd714668db6ef3ea34 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 3 Nov 2021 12:30:58 +0100 Subject: [PATCH 01/19] chore(deps): update dependency google-cloud-datalabeling to v1.4.0 (#168) --- samples/snippets/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/requirements.txt b/samples/snippets/requirements.txt index 9e827c8..cb89df9 100644 --- a/samples/snippets/requirements.txt +++ b/samples/snippets/requirements.txt @@ -1 +1 @@ -google-cloud-datalabeling==1.3.0 +google-cloud-datalabeling==1.4.0 From 1b2965e541ba945b33082b892be6a147b789ee79 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 9 Nov 2021 18:05:48 -0500 Subject: [PATCH 02/19] chore: use gapic-generator-python 0.56.2 (#171) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update Java and Python dependencies PiperOrigin-RevId: 408420890 Source-Link: https://github.com/googleapis/googleapis/commit/2921f9fb3bfbd16f6b2da0104373e2b47a80a65e Source-Link: https://github.com/googleapis/googleapis-gen/commit/6598ca8cbbf5226733a099c4506518a5af6ff74c Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNjU5OGNhOGNiYmY1MjI2NzMzYTA5OWM0NTA2NTE4YTVhZjZmZjc0YyJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../data_labeling_service/async_client.py | 13 +- .../services/data_labeling_service/client.py | 25 +- .../data_labeling_service/transports/base.py | 10 +- .../data_labeling_service/transports/grpc.py | 6 +- .../transports/grpc_asyncio.py | 6 +- .../datalabeling_v1beta1/types/annotation.py | 9 + .../types/data_labeling_service.py | 10 + .../datalabeling_v1beta1/types/dataset.py | 21 + .../datalabeling_v1beta1/types/evaluation.py | 1 + .../types/evaluation_job.py | 3 + .../datalabeling_v1beta1/types/operations.py | 12 + .../test_data_labeling_service.py | 482 +++++++++++++----- 12 files changed, 434 insertions(+), 164 deletions(-) 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 26efd1d..31b6d07 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 @@ -19,14 +19,17 @@ from typing import Dict, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core.client_options import ClientOptions # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +from google.api_core.client_options import ClientOptions +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore 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 40d63a4..1a41c33 100644 --- a/google/cloud/datalabeling_v1beta1/services/data_labeling_service/client.py +++ b/google/cloud/datalabeling_v1beta1/services/data_labeling_service/client.py @@ -14,23 +14,25 @@ # limitations under the License. # from collections import OrderedDict -from distutils import util import os import re from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources -from google.api_core import client_options as client_options_lib # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore +from google.api_core import client_options as client_options_lib +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport import mtls # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore from google.auth.exceptions import MutualTLSChannelError # type: ignore from google.oauth2 import service_account # type: ignore -OptionalRetry = Union[retries.Retry, object] +try: + OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault] +except AttributeError: # pragma: NO COVER + OptionalRetry = Union[retries.Retry, object] # type: ignore from google.api_core import operation # type: ignore from google.api_core import operation_async # type: ignore @@ -418,8 +420,15 @@ def __init__( client_options = client_options_lib.ClientOptions() # Create SSL credentials for mutual TLS if needed. - use_client_cert = bool( - util.strtobool(os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false")) + if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( + "true", + "false", + ): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + use_client_cert = ( + os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" ) client_cert_source_func = None 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 62558a8..e456098 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 @@ -18,11 +18,11 @@ import pkg_resources import google.auth # type: ignore -import google.api_core # type: ignore -from google.api_core import exceptions as core_exceptions # type: ignore -from google.api_core import gapic_v1 # type: ignore -from google.api_core import retry as retries # type: ignore -from google.api_core import operations_v1 # type: ignore +import google.api_core +from google.api_core import exceptions as core_exceptions +from google.api_core import gapic_v1 +from google.api_core import retry as retries +from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore 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 5e769b0..c2ebd4e 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 @@ -16,9 +16,9 @@ import warnings from typing import Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import grpc_helpers # type: ignore -from google.api_core import operations_v1 # type: ignore -from google.api_core import gapic_v1 # type: ignore +from google.api_core import grpc_helpers +from google.api_core import operations_v1 +from google.api_core import gapic_v1 import google.auth # type: ignore from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore 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 b9b423d..f37d83a 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 @@ -16,9 +16,9 @@ import warnings from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union -from google.api_core import gapic_v1 # type: ignore -from google.api_core import grpc_helpers_async # type: ignore -from google.api_core import operations_v1 # type: ignore +from google.api_core import gapic_v1 +from google.api_core import grpc_helpers_async +from google.api_core import operations_v1 from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore diff --git a/google/cloud/datalabeling_v1beta1/types/annotation.py b/google/cloud/datalabeling_v1beta1/types/annotation.py index 9ebed20..72dc3fd 100644 --- a/google/cloud/datalabeling_v1beta1/types/annotation.py +++ b/google/cloud/datalabeling_v1beta1/types/annotation.py @@ -133,10 +133,12 @@ class AnnotationValue(proto.Message): image_classification_annotation (google.cloud.datalabeling_v1beta1.types.ImageClassificationAnnotation): Annotation value for image classification case. + This field is a member of `oneof`_ ``value_type``. image_bounding_poly_annotation (google.cloud.datalabeling_v1beta1.types.ImageBoundingPolyAnnotation): Annotation value for image bounding box, oriented bounding box and polygon cases. + This field is a member of `oneof`_ ``value_type``. image_polyline_annotation (google.cloud.datalabeling_v1beta1.types.ImagePolylineAnnotation): Annotation value for image polyline cases. @@ -144,28 +146,35 @@ class AnnotationValue(proto.Message): is formed by line segments connected to each other but not closed form(Bounding Poly). The line segments can cross each other. + This field is a member of `oneof`_ ``value_type``. image_segmentation_annotation (google.cloud.datalabeling_v1beta1.types.ImageSegmentationAnnotation): Annotation value for image segmentation. + This field is a member of `oneof`_ ``value_type``. text_classification_annotation (google.cloud.datalabeling_v1beta1.types.TextClassificationAnnotation): Annotation value for text classification case. + This field is a member of `oneof`_ ``value_type``. text_entity_extraction_annotation (google.cloud.datalabeling_v1beta1.types.TextEntityExtractionAnnotation): Annotation value for text entity extraction case. + This field is a member of `oneof`_ ``value_type``. video_classification_annotation (google.cloud.datalabeling_v1beta1.types.VideoClassificationAnnotation): Annotation value for video classification case. + This field is a member of `oneof`_ ``value_type``. video_object_tracking_annotation (google.cloud.datalabeling_v1beta1.types.VideoObjectTrackingAnnotation): Annotation value for video object detection and tracking case. + This field is a member of `oneof`_ ``value_type``. video_event_annotation (google.cloud.datalabeling_v1beta1.types.VideoEventAnnotation): Annotation value for video event case. + This field is a member of `oneof`_ ``value_type``. """ diff --git a/google/cloud/datalabeling_v1beta1/types/data_labeling_service.py b/google/cloud/datalabeling_v1beta1/types/data_labeling_service.py index 47c5396..5ca2c25 100644 --- a/google/cloud/datalabeling_v1beta1/types/data_labeling_service.py +++ b/google/cloud/datalabeling_v1beta1/types/data_labeling_service.py @@ -368,21 +368,25 @@ class LabelImageRequest(proto.Message): Configuration for image classification task. One of image_classification_config, bounding_poly_config, polyline_config and segmentation_config are required. + This field is a member of `oneof`_ ``request_config``. 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. + This field is a member of `oneof`_ ``request_config``. 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. + This field is a member of `oneof`_ ``request_config``. 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. + This field is a member of `oneof`_ ``request_config``. parent (str): Required. Name of the dataset to request labeling task, @@ -449,21 +453,25 @@ class LabelVideoRequest(proto.Message): Configuration for video classification task. One of video_classification_config, object_detection_config, object_tracking_config and event_config is required. + This field is a member of `oneof`_ ``request_config``. 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. + This field is a member of `oneof`_ ``request_config``. 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. + This field is a member of `oneof`_ ``request_config``. 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. + This field is a member of `oneof`_ ``request_config``. parent (str): Required. Name of the dataset to request labeling task, @@ -528,11 +536,13 @@ class LabelTextRequest(proto.Message): Configuration for text classification task. One of text_classification_config and text_entity_extraction_config is required. + This field is a member of `oneof`_ ``request_config``. 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. + This field is a member of `oneof`_ ``request_config``. parent (str): Required. Name of the data set to request labeling task, diff --git a/google/cloud/datalabeling_v1beta1/types/dataset.py b/google/cloud/datalabeling_v1beta1/types/dataset.py index 22b62ac..a362c12 100644 --- a/google/cloud/datalabeling_v1beta1/types/dataset.py +++ b/google/cloud/datalabeling_v1beta1/types/dataset.py @@ -110,14 +110,17 @@ class InputConfig(proto.Message): text_metadata (google.cloud.datalabeling_v1beta1.types.TextMetadata): Required for text import, as language code must be specified. + This field is a member of `oneof`_ ``data_type_metadata``. gcs_source (google.cloud.datalabeling_v1beta1.types.GcsSource): Source located in Cloud Storage. + This field is a member of `oneof`_ ``source``. 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]. + This field is a member of `oneof`_ ``source``. data_type (google.cloud.datalabeling_v1beta1.types.DataType): Required. Data type must be specifed when @@ -234,10 +237,12 @@ class OutputConfig(proto.Message): Output to a file in Cloud Storage. Should be used for labeling output other than image segmentation. + This field is a member of `oneof`_ ``destination``. gcs_folder_destination (google.cloud.datalabeling_v1beta1.types.GcsFolderDestination): Output to a folder in Cloud Storage. Should be used for image segmentation labeling output. + This field is a member of `oneof`_ ``destination``. """ @@ -293,14 +298,17 @@ class DataItem(proto.Message): image_payload (google.cloud.datalabeling_v1beta1.types.ImagePayload): The image payload, a container of the image bytes/uri. + This field is a member of `oneof`_ ``payload``. text_payload (google.cloud.datalabeling_v1beta1.types.TextPayload): The text payload, a container of text content. + This field is a member of `oneof`_ ``payload``. video_payload (google.cloud.datalabeling_v1beta1.types.VideoPayload): The video payload, a container of the video uri. + This field is a member of `oneof`_ ``payload``. name (str): Output only. Name of the data item, in format of: @@ -411,36 +419,46 @@ class AnnotatedDatasetMetadata(proto.Message): Attributes: image_classification_config (google.cloud.datalabeling_v1beta1.types.ImageClassificationConfig): Configuration for image classification task. + This field is a member of `oneof`_ ``annotation_request_config``. bounding_poly_config (google.cloud.datalabeling_v1beta1.types.BoundingPolyConfig): Configuration for image bounding box and bounding poly task. + This field is a member of `oneof`_ ``annotation_request_config``. polyline_config (google.cloud.datalabeling_v1beta1.types.PolylineConfig): Configuration for image polyline task. + This field is a member of `oneof`_ ``annotation_request_config``. segmentation_config (google.cloud.datalabeling_v1beta1.types.SegmentationConfig): Configuration for image segmentation task. + This field is a member of `oneof`_ ``annotation_request_config``. video_classification_config (google.cloud.datalabeling_v1beta1.types.VideoClassificationConfig): Configuration for video classification task. + This field is a member of `oneof`_ ``annotation_request_config``. object_detection_config (google.cloud.datalabeling_v1beta1.types.ObjectDetectionConfig): Configuration for video object detection task. + This field is a member of `oneof`_ ``annotation_request_config``. object_tracking_config (google.cloud.datalabeling_v1beta1.types.ObjectTrackingConfig): Configuration for video object tracking task. + This field is a member of `oneof`_ ``annotation_request_config``. event_config (google.cloud.datalabeling_v1beta1.types.EventConfig): Configuration for video event labeling task. + This field is a member of `oneof`_ ``annotation_request_config``. text_classification_config (google.cloud.datalabeling_v1beta1.types.TextClassificationConfig): Configuration for text classification task. + This field is a member of `oneof`_ ``annotation_request_config``. text_entity_extraction_config (google.cloud.datalabeling_v1beta1.types.TextEntityExtractionConfig): Configuration for text entity extraction task. + This field is a member of `oneof`_ ``annotation_request_config``. human_annotation_config (google.cloud.datalabeling_v1beta1.types.HumanAnnotationConfig): HumanAnnotationConfig used when requesting @@ -530,14 +548,17 @@ class Example(proto.Message): image_payload (google.cloud.datalabeling_v1beta1.types.ImagePayload): The image payload, a container of the image bytes/uri. + This field is a member of `oneof`_ ``payload``. text_payload (google.cloud.datalabeling_v1beta1.types.TextPayload): The text payload, a container of the text content. + This field is a member of `oneof`_ ``payload``. video_payload (google.cloud.datalabeling_v1beta1.types.VideoPayload): The video payload, a container of the video uri. + This field is a member of `oneof`_ ``payload``. name (str): Output only. Name of the example, in format of: diff --git a/google/cloud/datalabeling_v1beta1/types/evaluation.py b/google/cloud/datalabeling_v1beta1/types/evaluation.py index a37bede..4009e08 100644 --- a/google/cloud/datalabeling_v1beta1/types/evaluation.py +++ b/google/cloud/datalabeling_v1beta1/types/evaluation.py @@ -98,6 +98,7 @@ class EvaluationConfig(proto.Message): Only specify this field if the related model performs image object detection (``IMAGE_BOUNDING_BOX_ANNOTATION``). Describes how to evaluate bounding boxes. + This field is a member of `oneof`_ ``vertical_option``. """ diff --git a/google/cloud/datalabeling_v1beta1/types/evaluation_job.py b/google/cloud/datalabeling_v1beta1/types/evaluation_job.py index 091d843..0c91853 100644 --- a/google/cloud/datalabeling_v1beta1/types/evaluation_job.py +++ b/google/cloud/datalabeling_v1beta1/types/evaluation_job.py @@ -151,6 +151,7 @@ class EvaluationJobConfig(proto.Message): ``allowMultiLabel`` in this configuration must match ``classificationMetadata.isMultiLabel`` in [input_config][google.cloud.datalabeling.v1beta1.EvaluationJobConfig.input_config]. + This field is a member of `oneof`_ ``human_annotation_request_config``. bounding_poly_config (google.cloud.datalabeling_v1beta1.types.BoundingPolyConfig): Specify this field if your model version performs image @@ -158,6 +159,7 @@ class EvaluationJobConfig(proto.Message): ``annotationSpecSet`` in this configuration must match [EvaluationJob.annotationSpecSet][google.cloud.datalabeling.v1beta1.EvaluationJob.annotation_spec_set]. + This field is a member of `oneof`_ ``human_annotation_request_config``. text_classification_config (google.cloud.datalabeling_v1beta1.types.TextClassificationConfig): Specify this field if your model version performs text @@ -168,6 +170,7 @@ class EvaluationJobConfig(proto.Message): ``allowMultiLabel`` in this configuration must match ``classificationMetadata.isMultiLabel`` in [input_config][google.cloud.datalabeling.v1beta1.EvaluationJobConfig.input_config]. + This field is a member of `oneof`_ ``human_annotation_request_config``. input_config (google.cloud.datalabeling_v1beta1.types.InputConfig): Rquired. Details for the sampled prediction input. Within diff --git a/google/cloud/datalabeling_v1beta1/types/operations.py b/google/cloud/datalabeling_v1beta1/types/operations.py index 1087068..b07fdc1 100644 --- a/google/cloud/datalabeling_v1beta1/types/operations.py +++ b/google/cloud/datalabeling_v1beta1/types/operations.py @@ -156,48 +156,60 @@ class LabelOperationMetadata(proto.Message): image_classification_details (google.cloud.datalabeling_v1beta1.types.LabelImageClassificationOperationMetadata): Details of label image classification operation. + This field is a member of `oneof`_ ``details``. image_bounding_box_details (google.cloud.datalabeling_v1beta1.types.LabelImageBoundingBoxOperationMetadata): Details of label image bounding box operation. + This field is a member of `oneof`_ ``details``. image_bounding_poly_details (google.cloud.datalabeling_v1beta1.types.LabelImageBoundingPolyOperationMetadata): Details of label image bounding poly operation. + This field is a member of `oneof`_ ``details``. image_oriented_bounding_box_details (google.cloud.datalabeling_v1beta1.types.LabelImageOrientedBoundingBoxOperationMetadata): Details of label image oriented bounding box operation. + This field is a member of `oneof`_ ``details``. image_polyline_details (google.cloud.datalabeling_v1beta1.types.LabelImagePolylineOperationMetadata): Details of label image polyline operation. + This field is a member of `oneof`_ ``details``. image_segmentation_details (google.cloud.datalabeling_v1beta1.types.LabelImageSegmentationOperationMetadata): Details of label image segmentation operation. + This field is a member of `oneof`_ ``details``. video_classification_details (google.cloud.datalabeling_v1beta1.types.LabelVideoClassificationOperationMetadata): Details of label video classification operation. + This field is a member of `oneof`_ ``details``. video_object_detection_details (google.cloud.datalabeling_v1beta1.types.LabelVideoObjectDetectionOperationMetadata): Details of label video object detection operation. + This field is a member of `oneof`_ ``details``. video_object_tracking_details (google.cloud.datalabeling_v1beta1.types.LabelVideoObjectTrackingOperationMetadata): Details of label video object tracking operation. + This field is a member of `oneof`_ ``details``. video_event_details (google.cloud.datalabeling_v1beta1.types.LabelVideoEventOperationMetadata): Details of label video event operation. + This field is a member of `oneof`_ ``details``. text_classification_details (google.cloud.datalabeling_v1beta1.types.LabelTextClassificationOperationMetadata): Details of label text classification operation. + This field is a member of `oneof`_ ``details``. text_entity_extraction_details (google.cloud.datalabeling_v1beta1.types.LabelTextEntityExtractionOperationMetadata): Details of label text entity extraction operation. + This field is a member of `oneof`_ ``details``. progress_percent (int): Output only. Progress of label operation. Range: [0, 100]. 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 e10db40..927011a 100644 --- a/tests/unit/gapic/datalabeling_v1beta1/test_data_labeling_service.py +++ b/tests/unit/gapic/datalabeling_v1beta1/test_data_labeling_service.py @@ -702,8 +702,12 @@ def test_create_dataset_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].dataset == gcd_dataset.Dataset(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].dataset + mock_val = gcd_dataset.Dataset(name="name_value") + assert arg == mock_val def test_create_dataset_flattened_error(): @@ -743,8 +747,12 @@ async def test_create_dataset_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].dataset == gcd_dataset.Dataset(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].dataset + mock_val = gcd_dataset.Dataset(name="name_value") + assert arg == mock_val @pytest.mark.asyncio @@ -935,7 +943,9 @@ def test_get_dataset_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_get_dataset_flattened_error(): @@ -971,7 +981,9 @@ async def test_get_dataset_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -1148,8 +1160,12 @@ def test_list_datasets_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].filter == "filter_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val def test_list_datasets_flattened_error(): @@ -1191,8 +1207,12 @@ async def test_list_datasets_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].filter == "filter_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val @pytest.mark.asyncio @@ -1493,7 +1513,9 @@ def test_delete_dataset_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_delete_dataset_flattened_error(): @@ -1529,7 +1551,9 @@ async def test_delete_dataset_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -1703,10 +1727,14 @@ def test_import_data_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].input_config == dataset.InputConfig( + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].input_config + mock_val = dataset.InputConfig( text_metadata=dataset.TextMetadata(language_code="language_code_value") ) + assert arg == mock_val def test_import_data_flattened_error(): @@ -1753,10 +1781,14 @@ async def test_import_data_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].input_config == dataset.InputConfig( + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].input_config + mock_val = dataset.InputConfig( text_metadata=dataset.TextMetadata(language_code="language_code_value") ) + assert arg == mock_val @pytest.mark.asyncio @@ -1936,12 +1968,20 @@ def test_export_data_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].annotated_dataset == "annotated_dataset_value" - assert args[0].filter == "filter_value" - assert args[0].output_config == dataset.OutputConfig( + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].annotated_dataset + mock_val = "annotated_dataset_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val + arg = args[0].output_config + mock_val = dataset.OutputConfig( gcs_destination=dataset.GcsDestination(output_uri="output_uri_value") ) + assert arg == mock_val def test_export_data_flattened_error(): @@ -1992,12 +2032,20 @@ async def test_export_data_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].annotated_dataset == "annotated_dataset_value" - assert args[0].filter == "filter_value" - assert args[0].output_config == dataset.OutputConfig( + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].annotated_dataset + mock_val = "annotated_dataset_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val + arg = args[0].output_config + mock_val = dataset.OutputConfig( gcs_destination=dataset.GcsDestination(output_uri="output_uri_value") ) + assert arg == mock_val @pytest.mark.asyncio @@ -2175,7 +2223,9 @@ def test_get_data_item_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_get_data_item_flattened_error(): @@ -2211,7 +2261,9 @@ async def test_get_data_item_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2388,8 +2440,12 @@ def test_list_data_items_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].filter == "filter_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val def test_list_data_items_flattened_error(): @@ -2431,8 +2487,12 @@ async def test_list_data_items_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].filter == "filter_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2806,7 +2866,9 @@ def test_get_annotated_dataset_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_get_annotated_dataset_flattened_error(): @@ -2846,7 +2908,9 @@ async def test_get_annotated_dataset_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -3036,8 +3100,12 @@ def test_list_annotated_datasets_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].filter == "filter_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val def test_list_annotated_datasets_flattened_error(): @@ -3081,8 +3149,12 @@ async def test_list_annotated_datasets_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].filter == "filter_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val @pytest.mark.asyncio @@ -3571,14 +3643,17 @@ def test_label_image_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].basic_config == human_annotation_config.HumanAnnotationConfig( + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].basic_config + mock_val = human_annotation_config.HumanAnnotationConfig( instruction="instruction_value" ) - assert ( - args[0].feature - == data_labeling_service.LabelImageRequest.Feature.CLASSIFICATION - ) + assert arg == mock_val + arg = args[0].feature + mock_val = data_labeling_service.LabelImageRequest.Feature.CLASSIFICATION + assert arg == mock_val def test_label_image_flattened_error(): @@ -3627,14 +3702,17 @@ async def test_label_image_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].basic_config == human_annotation_config.HumanAnnotationConfig( + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].basic_config + mock_val = human_annotation_config.HumanAnnotationConfig( instruction="instruction_value" ) - assert ( - args[0].feature - == data_labeling_service.LabelImageRequest.Feature.CLASSIFICATION - ) + assert arg == mock_val + arg = args[0].feature + mock_val = data_labeling_service.LabelImageRequest.Feature.CLASSIFICATION + assert arg == mock_val @pytest.mark.asyncio @@ -3814,14 +3892,17 @@ def test_label_video_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].basic_config == human_annotation_config.HumanAnnotationConfig( + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].basic_config + mock_val = human_annotation_config.HumanAnnotationConfig( instruction="instruction_value" ) - assert ( - args[0].feature - == data_labeling_service.LabelVideoRequest.Feature.CLASSIFICATION - ) + assert arg == mock_val + arg = args[0].feature + mock_val = data_labeling_service.LabelVideoRequest.Feature.CLASSIFICATION + assert arg == mock_val def test_label_video_flattened_error(): @@ -3870,14 +3951,17 @@ async def test_label_video_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].basic_config == human_annotation_config.HumanAnnotationConfig( + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].basic_config + mock_val = human_annotation_config.HumanAnnotationConfig( instruction="instruction_value" ) - assert ( - args[0].feature - == data_labeling_service.LabelVideoRequest.Feature.CLASSIFICATION - ) + assert arg == mock_val + arg = args[0].feature + mock_val = data_labeling_service.LabelVideoRequest.Feature.CLASSIFICATION + assert arg == mock_val @pytest.mark.asyncio @@ -4056,14 +4140,17 @@ def test_label_text_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].basic_config == human_annotation_config.HumanAnnotationConfig( + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].basic_config + mock_val = human_annotation_config.HumanAnnotationConfig( instruction="instruction_value" ) - assert ( - args[0].feature - == data_labeling_service.LabelTextRequest.Feature.TEXT_CLASSIFICATION - ) + assert arg == mock_val + arg = args[0].feature + mock_val = data_labeling_service.LabelTextRequest.Feature.TEXT_CLASSIFICATION + assert arg == mock_val def test_label_text_flattened_error(): @@ -4112,14 +4199,17 @@ async def test_label_text_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].basic_config == human_annotation_config.HumanAnnotationConfig( + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].basic_config + mock_val = human_annotation_config.HumanAnnotationConfig( instruction="instruction_value" ) - assert ( - args[0].feature - == data_labeling_service.LabelTextRequest.Feature.TEXT_CLASSIFICATION - ) + assert arg == mock_val + arg = args[0].feature + mock_val = data_labeling_service.LabelTextRequest.Feature.TEXT_CLASSIFICATION + assert arg == mock_val @pytest.mark.asyncio @@ -4298,8 +4388,12 @@ def test_get_example_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].filter == "filter_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val def test_get_example_flattened_error(): @@ -4337,8 +4431,12 @@ async def test_get_example_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].filter == "filter_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val @pytest.mark.asyncio @@ -4517,8 +4615,12 @@ def test_list_examples_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].filter == "filter_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val def test_list_examples_flattened_error(): @@ -4560,8 +4662,12 @@ async def test_list_examples_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].filter == "filter_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val @pytest.mark.asyncio @@ -4902,10 +5008,12 @@ def test_create_annotation_spec_set_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].annotation_spec_set == gcd_annotation_spec_set.AnnotationSpecSet( - name="name_value" - ) + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].annotation_spec_set + mock_val = gcd_annotation_spec_set.AnnotationSpecSet(name="name_value") + assert arg == mock_val def test_create_annotation_spec_set_flattened_error(): @@ -4954,10 +5062,12 @@ async def test_create_annotation_spec_set_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].annotation_spec_set == gcd_annotation_spec_set.AnnotationSpecSet( - name="name_value" - ) + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].annotation_spec_set + mock_val = gcd_annotation_spec_set.AnnotationSpecSet(name="name_value") + assert arg == mock_val @pytest.mark.asyncio @@ -5161,7 +5271,9 @@ def test_get_annotation_spec_set_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_get_annotation_spec_set_flattened_error(): @@ -5201,7 +5313,9 @@ async def test_get_annotation_spec_set_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -5391,8 +5505,12 @@ def test_list_annotation_spec_sets_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].filter == "filter_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val def test_list_annotation_spec_sets_flattened_error(): @@ -5436,8 +5554,12 @@ async def test_list_annotation_spec_sets_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].filter == "filter_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val @pytest.mark.asyncio @@ -5795,7 +5917,9 @@ def test_delete_annotation_spec_set_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_delete_annotation_spec_set_flattened_error(): @@ -5833,7 +5957,9 @@ async def test_delete_annotation_spec_set_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -6017,8 +6143,12 @@ def test_create_instruction_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].instruction == gcd_instruction.Instruction(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].instruction + mock_val = gcd_instruction.Instruction(name="name_value") + assert arg == mock_val def test_create_instruction_flattened_error(): @@ -6063,8 +6193,12 @@ async def test_create_instruction_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].instruction == gcd_instruction.Instruction(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].instruction + mock_val = gcd_instruction.Instruction(name="name_value") + assert arg == mock_val @pytest.mark.asyncio @@ -6257,7 +6391,9 @@ def test_get_instruction_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_get_instruction_flattened_error(): @@ -6295,7 +6431,9 @@ async def test_get_instruction_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -6484,8 +6622,12 @@ def test_list_instructions_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].filter == "filter_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val def test_list_instructions_flattened_error(): @@ -6529,8 +6671,12 @@ async def test_list_instructions_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].filter == "filter_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val @pytest.mark.asyncio @@ -6867,7 +7013,9 @@ def test_delete_instruction_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_delete_instruction_flattened_error(): @@ -6905,7 +7053,9 @@ async def test_delete_instruction_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -7094,7 +7244,9 @@ def test_get_evaluation_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_get_evaluation_flattened_error(): @@ -7132,7 +7284,9 @@ async def test_get_evaluation_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -7321,8 +7475,12 @@ def test_search_evaluations_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].filter == "filter_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val def test_search_evaluations_flattened_error(): @@ -7366,8 +7524,12 @@ async def test_search_evaluations_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].filter == "filter_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val @pytest.mark.asyncio @@ -7715,7 +7877,9 @@ def test_search_example_comparisons_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val def test_search_example_comparisons_flattened_error(): @@ -7756,7 +7920,9 @@ async def test_search_example_comparisons_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val @pytest.mark.asyncio @@ -8165,8 +8331,12 @@ def test_create_evaluation_job_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].job == evaluation_job.EvaluationJob(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].job + mock_val = evaluation_job.EvaluationJob(name="name_value") + assert arg == mock_val def test_create_evaluation_job_flattened_error(): @@ -8210,8 +8380,12 @@ async def test_create_evaluation_job_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].job == evaluation_job.EvaluationJob(name="name_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].job + mock_val = evaluation_job.EvaluationJob(name="name_value") + assert arg == mock_val @pytest.mark.asyncio @@ -8434,10 +8608,12 @@ def test_update_evaluation_job_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].evaluation_job == gcd_evaluation_job.EvaluationJob( - name="name_value" - ) - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].evaluation_job + mock_val = gcd_evaluation_job.EvaluationJob(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val def test_update_evaluation_job_flattened_error(): @@ -8482,10 +8658,12 @@ async def test_update_evaluation_job_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].evaluation_job == gcd_evaluation_job.EvaluationJob( - name="name_value" - ) - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].evaluation_job + mock_val = gcd_evaluation_job.EvaluationJob(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val @pytest.mark.asyncio @@ -8698,7 +8876,9 @@ def test_get_evaluation_job_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_get_evaluation_job_flattened_error(): @@ -8738,7 +8918,9 @@ async def test_get_evaluation_job_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -8916,7 +9098,9 @@ def test_pause_evaluation_job_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_pause_evaluation_job_flattened_error(): @@ -8954,7 +9138,9 @@ async def test_pause_evaluation_job_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -9132,7 +9318,9 @@ def test_resume_evaluation_job_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_resume_evaluation_job_flattened_error(): @@ -9170,7 +9358,9 @@ async def test_resume_evaluation_job_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -9348,7 +9538,9 @@ def test_delete_evaluation_job_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val def test_delete_evaluation_job_flattened_error(): @@ -9386,7 +9578,9 @@ async def test_delete_evaluation_job_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio @@ -9576,8 +9770,12 @@ def test_list_evaluation_jobs_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].filter == "filter_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val def test_list_evaluation_jobs_flattened_error(): @@ -9621,8 +9819,12 @@ async def test_list_evaluation_jobs_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].filter == "filter_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].filter + mock_val = "filter_value" + assert arg == mock_val @pytest.mark.asyncio From 8b1430b920a7f691c5be471d985ce1194ff6ed11 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 11 Nov 2021 11:25:22 -0500 Subject: [PATCH 03/19] chore: assign googleapis/cdpe-cloudai as codeowner (#172) assign @googleapis/cdpe-cloudai as codeowner --- .repo-metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.repo-metadata.json b/.repo-metadata.json index 76b0f52..c32368a 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -12,5 +12,5 @@ "api_id": "datalabeling.googleapis.com", "requires_billing": true, "default_version": "v1beta1", - "codeowner_team": "" + "codeowner_team": "@googleapis/cdpe-cloudai" } From 118e20ec8ff3853e584d8f1d4fd4591fba37c861 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 11 Nov 2021 13:05:06 -0500 Subject: [PATCH 04/19] chore(python): add .github/CODEOWNERS as a templated file (#173) Source-Link: https://github.com/googleapis/synthtool/commit/c5026b3217973a8db55db8ee85feee0e9a65e295 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:0e18b9475fbeb12d9ad4302283171edebb6baf2dfca1bd215ee3b34ed79d95d7 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- .github/CODEOWNERS | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 108063d..7519fa3 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4ee57a76a176ede9087c14330c625a71553cf9c72828b2c0ca12f5338171ba60 + digest: sha256:0e18b9475fbeb12d9ad4302283171edebb6baf2dfca1bd215ee3b34ed79d95d7 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 1e7d876..b26afef 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -3,9 +3,10 @@ # # For syntax help see: # https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax +# Note: This file is autogenerated. To make changes to the codeowner team, please update .repo-metadata.json. -# The @googleapis/yoshi-python is the default owner for changes in this repo -* @googleapis/yoshi-python +# @googleapis/yoshi-python @googleapis/cdpe-cloudai are the default owners for changes in this repo +* @googleapis/yoshi-python @googleapis/cdpe-cloudai - -/samples/**/*.py @sgreenberg @googleapis/python-samples-owners +# @googleapis/python-samples-owners @googleapis/cdpe-cloudai are the default owners for samples changes +/samples/ @googleapis/python-samples-owners @googleapis/cdpe-cloudai From bc4fd2a8b2b050e5e02c691cd27867d75ccbed9d Mon Sep 17 00:00:00 2001 From: Dan Lee <71398022+dandhlee@users.noreply.github.com> Date: Tue, 16 Nov 2021 11:10:49 -0500 Subject: [PATCH 05/19] chore: update doc links from googleapis.dev to cloud.google.com (#174) --- .repo-metadata.json | 2 +- README.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.repo-metadata.json b/.repo-metadata.json index c32368a..6c46c1d 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -2,7 +2,7 @@ "name": "datalabeling", "name_pretty": "Google Cloud Data Labeling", "product_documentation": "https://cloud.google.com/data-labeling/docs/", - "client_documentation": "https://googleapis.dev/python/datalabeling/latest", + "client_documentation": "https://cloud.google.com/python/docs/reference/datalabeling/latest", "issue_tracker": "", "release_level": "beta", "language": "python", diff --git a/README.rst b/README.rst index 6bb3a35..8953c68 100644 --- a/README.rst +++ b/README.rst @@ -10,7 +10,7 @@ Python Client for Data Labeling API (`Beta`_) .. _Beta: https://github.com/GoogleCloudPlatform/google-cloud-python/blob/main/README.rst .. _Data Labeling API: https://cloud.google.com/data-labeling -.. _Client Library Documentation: https://googleapis.dev/python/datalabeling/latest +.. _Client Library Documentation: https://cloud.google.com/python/docs/reference/datalabeling/latest .. _Product Documentation: https://cloud.google.com/data-labeling/docs/ Quick Start From df94dedd86d1b0114c9e3f725bf843f7b0ea3a54 Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Tue, 28 Dec 2021 13:24:51 -0500 Subject: [PATCH 06/19] chore: update .repo-metadata.json (#177) --- .repo-metadata.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.repo-metadata.json b/.repo-metadata.json index 6c46c1d..6b6fd11 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -4,7 +4,7 @@ "product_documentation": "https://cloud.google.com/data-labeling/docs/", "client_documentation": "https://cloud.google.com/python/docs/reference/datalabeling/latest", "issue_tracker": "", - "release_level": "beta", + "release_level": "preview", "language": "python", "library_type": "GAPIC_AUTO", "repo": "googleapis/python-datalabeling", @@ -12,5 +12,6 @@ "api_id": "datalabeling.googleapis.com", "requires_billing": true, "default_version": "v1beta1", - "codeowner_team": "@googleapis/cdpe-cloudai" + "codeowner_team": "@googleapis/cdpe-cloudai", + "api_shortname": "datalabeling" } From 585efa2832c8e275a53bbcffd698c10ec5f262da Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 6 Jan 2022 09:11:19 -0700 Subject: [PATCH 07/19] chore: use python-samples-reviewers (#179) Source-Link: https://github.com/googleapis/synthtool/commit/da9308710160980198d85a4bcddac1d6f6f1a5bc Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:899d5d7cc340fa8ef9d8ae1a8cfba362c6898584f779e156f25ee828ba824610 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- .github/CODEOWNERS | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 7519fa3..f33299d 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:0e18b9475fbeb12d9ad4302283171edebb6baf2dfca1bd215ee3b34ed79d95d7 + digest: sha256:899d5d7cc340fa8ef9d8ae1a8cfba362c6898584f779e156f25ee828ba824610 diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b26afef..62aced9 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -8,5 +8,5 @@ # @googleapis/yoshi-python @googleapis/cdpe-cloudai are the default owners for changes in this repo * @googleapis/yoshi-python @googleapis/cdpe-cloudai -# @googleapis/python-samples-owners @googleapis/cdpe-cloudai are the default owners for samples changes -/samples/ @googleapis/python-samples-owners @googleapis/cdpe-cloudai +# @googleapis/python-samples-reviewers @googleapis/cdpe-cloudai are the default owners for samples changes +/samples/ @googleapis/python-samples-reviewers @googleapis/cdpe-cloudai From e9a9a751fe2389481c2678acf8eecdccd3d51ca8 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 7 Jan 2022 13:55:52 -0500 Subject: [PATCH 08/19] chore: use gapic-generator-python 0.58.4 (#178) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: use gapic-generator-python 0.58.4 fix: provide appropriate mock values for message body fields committer: dovs PiperOrigin-RevId: 419025932 Source-Link: https://github.com/googleapis/googleapis/commit/73da6697f598f1ba30618924936a59f8e457ec89 Source-Link: https://github.com/googleapis/googleapis-gen/commit/46df624a54b9ed47c1a7eefb7a49413cf7b82f98 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDZkZjYyNGE1NGI5ZWQ0N2MxYTdlZWZiN2E0OTQxM2NmN2I4MmY5OCJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .../data_labeling_service/transports/base.py | 1 - .../test_data_labeling_service.py | 510 ++++++++---------- 2 files changed, 215 insertions(+), 296 deletions(-) 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 e456098..7916101 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 @@ -114,7 +114,6 @@ def __init__( credentials, _ = google.auth.load_credentials_from_file( credentials_file, **scopes_kwargs, quota_project_id=quota_project_id ) - elif credentials is None: credentials, _ = google.auth.default( **scopes_kwargs, quota_project_id=quota_project_id 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 927011a..922a898 100644 --- a/tests/unit/gapic/datalabeling_v1beta1/test_data_labeling_service.py +++ b/tests/unit/gapic/datalabeling_v1beta1/test_data_labeling_service.py @@ -279,20 +279,20 @@ def test_data_labeling_service_client_client_options( # unsupported value. with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "Unsupported"}): with pytest.raises(MutualTLSChannelError): - client = client_class() + client = client_class(transport=transport_name) # Check the case GOOGLE_API_USE_CLIENT_CERTIFICATE has unsupported value. with mock.patch.dict( os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "Unsupported"} ): with pytest.raises(ValueError): - client = client_class() + client = client_class(transport=transport_name) # Check the case quota_project_id is provided options = client_options.ClientOptions(quota_project_id="octopus") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -361,7 +361,7 @@ def test_data_labeling_service_client_mtls_env_auto( ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) if use_client_cert_env == "false": expected_client_cert_source = None @@ -460,7 +460,7 @@ def test_data_labeling_service_client_client_options_scopes( options = client_options.ClientOptions(scopes=["1", "2"],) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file=None, @@ -495,7 +495,7 @@ def test_data_labeling_service_client_client_options_credentials_file( options = client_options.ClientOptions(credentials_file="credentials.json") with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None - client = client_class(transport=transport_name, client_options=options) + client = client_class(client_options=options, transport=transport_name) patched.assert_called_once_with( credentials=None, credentials_file="credentials.json", @@ -528,9 +528,10 @@ def test_data_labeling_service_client_client_options_from_dict(): ) -def test_create_dataset( - transport: str = "grpc", request_type=data_labeling_service.CreateDatasetRequest -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.CreateDatasetRequest, dict,] +) +def test_create_dataset(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -565,10 +566,6 @@ def test_create_dataset( assert response.data_item_count == 1584 -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. @@ -771,9 +768,10 @@ async def test_create_dataset_flattened_error_async(): ) -def test_get_dataset( - transport: str = "grpc", request_type=data_labeling_service.GetDatasetRequest -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.GetDatasetRequest, dict,] +) +def test_get_dataset(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -808,10 +806,6 @@ def test_get_dataset( assert response.data_item_count == 1584 -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. @@ -1000,9 +994,10 @@ async def test_get_dataset_flattened_error_async(): ) -def test_list_datasets( - transport: str = "grpc", request_type=data_labeling_service.ListDatasetsRequest -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.ListDatasetsRequest, dict,] +) +def test_list_datasets(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1029,10 +1024,6 @@ def test_list_datasets( assert response.next_page_token == "next_page_token_value" -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. @@ -1231,8 +1222,10 @@ async def test_list_datasets_flattened_error_async(): ) -def test_list_datasets_pager(): - client = DataLabelingServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_datasets_pager(transport_name: str = "grpc"): + client = DataLabelingServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_datasets), "__call__") as call: @@ -1267,8 +1260,10 @@ def test_list_datasets_pager(): assert all(isinstance(i, dataset.Dataset) for i in results) -def test_list_datasets_pages(): - client = DataLabelingServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_datasets_pages(transport_name: str = "grpc"): + client = DataLabelingServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_datasets), "__call__") as call: @@ -1365,9 +1360,10 @@ async def test_list_datasets_async_pages(): assert page_.raw_page.next_page_token == token -def test_delete_dataset( - transport: str = "grpc", request_type=data_labeling_service.DeleteDatasetRequest -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.DeleteDatasetRequest, dict,] +) +def test_delete_dataset(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1391,10 +1387,6 @@ def test_delete_dataset( assert response is None -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. @@ -1570,9 +1562,10 @@ async def test_delete_dataset_flattened_error_async(): ) -def test_import_data( - transport: str = "grpc", request_type=data_labeling_service.ImportDataRequest -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.ImportDataRequest, dict,] +) +def test_import_data(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1596,10 +1589,6 @@ def test_import_data( assert isinstance(response, future.Future) -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. @@ -1809,9 +1798,10 @@ async def test_import_data_flattened_error_async(): ) -def test_export_data( - transport: str = "grpc", request_type=data_labeling_service.ExportDataRequest -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.ExportDataRequest, dict,] +) +def test_export_data(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -1835,10 +1825,6 @@ def test_export_data( assert isinstance(response, future.Future) -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. @@ -2068,9 +2054,10 @@ async def test_export_data_flattened_error_async(): ) -def test_get_data_item( - transport: str = "grpc", request_type=data_labeling_service.GetDataItemRequest -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.GetDataItemRequest, dict,] +) +def test_get_data_item(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2098,10 +2085,6 @@ def test_get_data_item( assert response.name == "name_value" -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. @@ -2280,9 +2263,10 @@ async def test_get_data_item_flattened_error_async(): ) -def test_list_data_items( - transport: str = "grpc", request_type=data_labeling_service.ListDataItemsRequest -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.ListDataItemsRequest, dict,] +) +def test_list_data_items(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2309,10 +2293,6 @@ def test_list_data_items( assert response.next_page_token == "next_page_token_value" -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. @@ -2511,8 +2491,10 @@ async def test_list_data_items_flattened_error_async(): ) -def test_list_data_items_pager(): - client = DataLabelingServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_data_items_pager(transport_name: str = "grpc"): + client = DataLabelingServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # 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: @@ -2551,8 +2533,10 @@ def test_list_data_items_pager(): assert all(isinstance(i, dataset.DataItem) for i in results) -def test_list_data_items_pages(): - client = DataLabelingServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_data_items_pages(transport_name: str = "grpc"): + client = DataLabelingServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # 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: @@ -2661,10 +2645,10 @@ async def test_list_data_items_async_pages(): assert page_.raw_page.next_page_token == token -def test_get_annotated_dataset( - transport: str = "grpc", - request_type=data_labeling_service.GetAnnotatedDatasetRequest, -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.GetAnnotatedDatasetRequest, dict,] +) +def test_get_annotated_dataset(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2710,10 +2694,6 @@ def test_get_annotated_dataset( assert response.blocking_resources == ["blocking_resources_value"] -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. @@ -2927,10 +2907,10 @@ async def test_get_annotated_dataset_flattened_error_async(): ) -def test_list_annotated_datasets( - transport: str = "grpc", - request_type=data_labeling_service.ListAnnotatedDatasetsRequest, -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.ListAnnotatedDatasetsRequest, dict,] +) +def test_list_annotated_datasets(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -2959,10 +2939,6 @@ def test_list_annotated_datasets( assert response.next_page_token == "next_page_token_value" -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. @@ -3173,8 +3149,10 @@ async def test_list_annotated_datasets_flattened_error_async(): ) -def test_list_annotated_datasets_pager(): - client = DataLabelingServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_annotated_datasets_pager(transport_name: str = "grpc"): + client = DataLabelingServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3218,8 +3196,10 @@ def test_list_annotated_datasets_pager(): assert all(isinstance(i, dataset.AnnotatedDataset) for i in results) -def test_list_annotated_datasets_pages(): - client = DataLabelingServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_annotated_datasets_pages(transport_name: str = "grpc"): + client = DataLabelingServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3343,10 +3323,10 @@ async def test_list_annotated_datasets_async_pages(): assert page_.raw_page.next_page_token == token -def test_delete_annotated_dataset( - transport: str = "grpc", - request_type=data_labeling_service.DeleteAnnotatedDatasetRequest, -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.DeleteAnnotatedDatasetRequest, dict,] +) +def test_delete_annotated_dataset(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3372,10 +3352,6 @@ def test_delete_annotated_dataset( assert response is None -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. @@ -3485,9 +3461,10 @@ async def test_delete_annotated_dataset_field_headers_async(): assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] -def test_label_image( - transport: str = "grpc", request_type=data_labeling_service.LabelImageRequest -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.LabelImageRequest, dict,] +) +def test_label_image(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3511,10 +3488,6 @@ def test_label_image( assert isinstance(response, future.Future) -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. @@ -3734,9 +3707,10 @@ async def test_label_image_flattened_error_async(): ) -def test_label_video( - transport: str = "grpc", request_type=data_labeling_service.LabelVideoRequest -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.LabelVideoRequest, dict,] +) +def test_label_video(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -3760,10 +3734,6 @@ def test_label_video( assert isinstance(response, future.Future) -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. @@ -3983,9 +3953,10 @@ async def test_label_video_flattened_error_async(): ) -def test_label_text( - transport: str = "grpc", request_type=data_labeling_service.LabelTextRequest -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.LabelTextRequest, dict,] +) +def test_label_text(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4009,10 +3980,6 @@ def test_label_text( assert isinstance(response, future.Future) -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. @@ -4231,9 +4198,10 @@ async def test_label_text_flattened_error_async(): ) -def test_get_example( - transport: str = "grpc", request_type=data_labeling_service.GetExampleRequest -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.GetExampleRequest, dict,] +) +def test_get_example(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4261,10 +4229,6 @@ def test_get_example( assert response.name == "name_value" -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. @@ -4455,9 +4419,10 @@ async def test_get_example_flattened_error_async(): ) -def test_list_examples( - transport: str = "grpc", request_type=data_labeling_service.ListExamplesRequest -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.ListExamplesRequest, dict,] +) +def test_list_examples(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4484,10 +4449,6 @@ def test_list_examples( assert response.next_page_token == "next_page_token_value" -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. @@ -4686,8 +4647,10 @@ async def test_list_examples_flattened_error_async(): ) -def test_list_examples_pager(): - client = DataLabelingServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_examples_pager(transport_name: str = "grpc"): + client = DataLabelingServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_examples), "__call__") as call: @@ -4722,8 +4685,10 @@ def test_list_examples_pager(): assert all(isinstance(i, dataset.Example) for i in results) -def test_list_examples_pages(): - client = DataLabelingServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_examples_pages(transport_name: str = "grpc"): + client = DataLabelingServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_examples), "__call__") as call: @@ -4820,10 +4785,10 @@ async def test_list_examples_async_pages(): assert page_.raw_page.next_page_token == token -def test_create_annotation_spec_set( - transport: str = "grpc", - request_type=data_labeling_service.CreateAnnotationSpecSetRequest, -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.CreateAnnotationSpecSetRequest, dict,] +) +def test_create_annotation_spec_set(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -4858,10 +4823,6 @@ def test_create_annotation_spec_set( assert response.blocking_resources == ["blocking_resources_value"] -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. @@ -5088,10 +5049,10 @@ async def test_create_annotation_spec_set_flattened_error_async(): ) -def test_get_annotation_spec_set( - transport: str = "grpc", - request_type=data_labeling_service.GetAnnotationSpecSetRequest, -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.GetAnnotationSpecSetRequest, dict,] +) +def test_get_annotation_spec_set(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5126,10 +5087,6 @@ def test_get_annotation_spec_set( assert response.blocking_resources == ["blocking_resources_value"] -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. @@ -5332,10 +5289,10 @@ async def test_get_annotation_spec_set_flattened_error_async(): ) -def test_list_annotation_spec_sets( - transport: str = "grpc", - request_type=data_labeling_service.ListAnnotationSpecSetsRequest, -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.ListAnnotationSpecSetsRequest, dict,] +) +def test_list_annotation_spec_sets(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5364,10 +5321,6 @@ def test_list_annotation_spec_sets( assert response.next_page_token == "next_page_token_value" -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. @@ -5578,8 +5531,10 @@ async def test_list_annotation_spec_sets_flattened_error_async(): ) -def test_list_annotation_spec_sets_pager(): - client = DataLabelingServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_annotation_spec_sets_pager(transport_name: str = "grpc"): + client = DataLabelingServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5626,8 +5581,10 @@ def test_list_annotation_spec_sets_pager(): ) -def test_list_annotation_spec_sets_pages(): - client = DataLabelingServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_annotation_spec_sets_pages(transport_name: str = "grpc"): + client = DataLabelingServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5756,10 +5713,10 @@ async def test_list_annotation_spec_sets_async_pages(): assert page_.raw_page.next_page_token == token -def test_delete_annotation_spec_set( - transport: str = "grpc", - request_type=data_labeling_service.DeleteAnnotationSpecSetRequest, -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.DeleteAnnotationSpecSetRequest, dict,] +) +def test_delete_annotation_spec_set(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -5785,10 +5742,6 @@ def test_delete_annotation_spec_set( assert response is None -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. @@ -5976,9 +5929,10 @@ async def test_delete_annotation_spec_set_flattened_error_async(): ) -def test_create_instruction( - transport: str = "grpc", request_type=data_labeling_service.CreateInstructionRequest -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.CreateInstructionRequest, dict,] +) +def test_create_instruction(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6004,10 +5958,6 @@ def test_create_instruction( assert isinstance(response, future.Future) -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. @@ -6217,9 +6167,10 @@ async def test_create_instruction_flattened_error_async(): ) -def test_get_instruction( - transport: str = "grpc", request_type=data_labeling_service.GetInstructionRequest -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.GetInstructionRequest, dict,] +) +def test_get_instruction(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6254,10 +6205,6 @@ def test_get_instruction( assert response.blocking_resources == ["blocking_resources_value"] -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. @@ -6450,9 +6397,10 @@ async def test_get_instruction_flattened_error_async(): ) -def test_list_instructions( - transport: str = "grpc", request_type=data_labeling_service.ListInstructionsRequest -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.ListInstructionsRequest, dict,] +) +def test_list_instructions(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6481,10 +6429,6 @@ def test_list_instructions( assert response.next_page_token == "next_page_token_value" -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. @@ -6695,8 +6639,10 @@ async def test_list_instructions_flattened_error_async(): ) -def test_list_instructions_pager(): - client = DataLabelingServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_instructions_pager(transport_name: str = "grpc"): + client = DataLabelingServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6737,8 +6683,10 @@ def test_list_instructions_pager(): assert all(isinstance(i, instruction.Instruction) for i in results) -def test_list_instructions_pages(): - client = DataLabelingServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_instructions_pages(transport_name: str = "grpc"): + client = DataLabelingServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -6853,9 +6801,10 @@ async def test_list_instructions_async_pages(): assert page_.raw_page.next_page_token == token -def test_delete_instruction( - transport: str = "grpc", request_type=data_labeling_service.DeleteInstructionRequest -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.DeleteInstructionRequest, dict,] +) +def test_delete_instruction(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -6881,10 +6830,6 @@ def test_delete_instruction( assert response is None -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. @@ -7072,9 +7017,10 @@ async def test_delete_instruction_flattened_error_async(): ) -def test_get_evaluation( - transport: str = "grpc", request_type=data_labeling_service.GetEvaluationRequest -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.GetEvaluationRequest, dict,] +) +def test_get_evaluation(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7108,10 +7054,6 @@ def test_get_evaluation( assert response.evaluated_item_count == 2129 -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. @@ -7303,9 +7245,10 @@ async def test_get_evaluation_flattened_error_async(): ) -def test_search_evaluations( - transport: str = "grpc", request_type=data_labeling_service.SearchEvaluationsRequest -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.SearchEvaluationsRequest, dict,] +) +def test_search_evaluations(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7334,10 +7277,6 @@ def test_search_evaluations( assert response.next_page_token == "next_page_token_value" -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. @@ -7548,8 +7487,10 @@ async def test_search_evaluations_flattened_error_async(): ) -def test_search_evaluations_pager(): - client = DataLabelingServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_search_evaluations_pager(transport_name: str = "grpc"): + client = DataLabelingServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7590,8 +7531,10 @@ def test_search_evaluations_pager(): assert all(isinstance(i, evaluation.Evaluation) for i in results) -def test_search_evaluations_pages(): - client = DataLabelingServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_search_evaluations_pages(transport_name: str = "grpc"): + client = DataLabelingServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7706,10 +7649,10 @@ async def test_search_evaluations_async_pages(): assert page_.raw_page.next_page_token == token -def test_search_example_comparisons( - transport: str = "grpc", - request_type=data_labeling_service.SearchExampleComparisonsRequest, -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.SearchExampleComparisonsRequest, dict,] +) +def test_search_example_comparisons(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -7738,10 +7681,6 @@ def test_search_example_comparisons( assert response.next_page_token == "next_page_token_value" -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. @@ -7940,8 +7879,10 @@ async def test_search_example_comparisons_flattened_error_async(): ) -def test_search_example_comparisons_pager(): - client = DataLabelingServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_search_example_comparisons_pager(transport_name: str = "grpc"): + client = DataLabelingServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -7994,8 +7935,10 @@ def test_search_example_comparisons_pager(): ) -def test_search_example_comparisons_pages(): - client = DataLabelingServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_search_example_comparisons_pages(transport_name: str = "grpc"): + client = DataLabelingServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -8134,10 +8077,10 @@ async def test_search_example_comparisons_async_pages(): assert page_.raw_page.next_page_token == token -def test_create_evaluation_job( - transport: str = "grpc", - request_type=data_labeling_service.CreateEvaluationJobRequest, -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.CreateEvaluationJobRequest, dict,] +) +def test_create_evaluation_job(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8178,10 +8121,6 @@ def test_create_evaluation_job( assert response.label_missing_ground_truth is True -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. @@ -8404,10 +8343,10 @@ async def test_create_evaluation_job_flattened_error_async(): ) -def test_update_evaluation_job( - transport: str = "grpc", - request_type=data_labeling_service.UpdateEvaluationJobRequest, -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.UpdateEvaluationJobRequest, dict,] +) +def test_update_evaluation_job(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8448,10 +8387,6 @@ def test_update_evaluation_job( assert response.label_missing_ground_truth is True -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. @@ -8682,9 +8617,10 @@ async def test_update_evaluation_job_flattened_error_async(): ) -def test_get_evaluation_job( - transport: str = "grpc", request_type=data_labeling_service.GetEvaluationJobRequest -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.GetEvaluationJobRequest, dict,] +) +def test_get_evaluation_job(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8725,10 +8661,6 @@ def test_get_evaluation_job( assert response.label_missing_ground_truth is True -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. @@ -8937,10 +8869,10 @@ async def test_get_evaluation_job_flattened_error_async(): ) -def test_pause_evaluation_job( - transport: str = "grpc", - request_type=data_labeling_service.PauseEvaluationJobRequest, -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.PauseEvaluationJobRequest, dict,] +) +def test_pause_evaluation_job(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -8966,10 +8898,6 @@ def test_pause_evaluation_job( assert response is None -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. @@ -9157,10 +9085,10 @@ async def test_pause_evaluation_job_flattened_error_async(): ) -def test_resume_evaluation_job( - transport: str = "grpc", - request_type=data_labeling_service.ResumeEvaluationJobRequest, -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.ResumeEvaluationJobRequest, dict,] +) +def test_resume_evaluation_job(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9186,10 +9114,6 @@ def test_resume_evaluation_job( assert response is None -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. @@ -9377,10 +9301,10 @@ async def test_resume_evaluation_job_flattened_error_async(): ) -def test_delete_evaluation_job( - transport: str = "grpc", - request_type=data_labeling_service.DeleteEvaluationJobRequest, -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.DeleteEvaluationJobRequest, dict,] +) +def test_delete_evaluation_job(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9406,10 +9330,6 @@ def test_delete_evaluation_job( assert response is None -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. @@ -9597,10 +9517,10 @@ async def test_delete_evaluation_job_flattened_error_async(): ) -def test_list_evaluation_jobs( - transport: str = "grpc", - request_type=data_labeling_service.ListEvaluationJobsRequest, -): +@pytest.mark.parametrize( + "request_type", [data_labeling_service.ListEvaluationJobsRequest, dict,] +) +def test_list_evaluation_jobs(request_type, transport: str = "grpc"): client = DataLabelingServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -9629,10 +9549,6 @@ def test_list_evaluation_jobs( assert response.next_page_token == "next_page_token_value" -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. @@ -9843,8 +9759,10 @@ async def test_list_evaluation_jobs_flattened_error_async(): ) -def test_list_evaluation_jobs_pager(): - client = DataLabelingServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_evaluation_jobs_pager(transport_name: str = "grpc"): + client = DataLabelingServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -9889,8 +9807,10 @@ def test_list_evaluation_jobs_pager(): assert all(isinstance(i, evaluation_job.EvaluationJob) for i in results) -def test_list_evaluation_jobs_pages(): - client = DataLabelingServiceClient(credentials=ga_credentials.AnonymousCredentials,) +def test_list_evaluation_jobs_pages(transport_name: str = "grpc"): + client = DataLabelingServiceClient( + credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -10770,7 +10690,7 @@ def test_parse_common_location_path(): assert expected == actual -def test_client_withDEFAULT_CLIENT_INFO(): +def test_client_with_default_client_info(): client_info = gapic_v1.client_info.ClientInfo() with mock.patch.object( From c8e13bc216c1d27bd6ddb3ee3cd88a691f85bde7 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 11 Jan 2022 07:39:41 -0500 Subject: [PATCH 09/19] chore(samples): Add check for tests in directory (#181) Source-Link: https://github.com/googleapis/synthtool/commit/52aef91f8d25223d9dbdb4aebd94ba8eea2101f3 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:36a95b8f494e4674dc9eee9af98961293b51b86b3649942aac800ae6c1f796d4 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- samples/snippets/noxfile.py | 70 +++++++++++++++++++++---------------- 2 files changed, 40 insertions(+), 32 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index f33299d..6b8a73b 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:899d5d7cc340fa8ef9d8ae1a8cfba362c6898584f779e156f25ee828ba824610 + digest: sha256:36a95b8f494e4674dc9eee9af98961293b51b86b3649942aac800ae6c1f796d4 diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py index 93a9122..3bbef5d 100644 --- a/samples/snippets/noxfile.py +++ b/samples/snippets/noxfile.py @@ -14,6 +14,7 @@ from __future__ import print_function +import glob import os from pathlib import Path import sys @@ -184,37 +185,44 @@ def blacken(session: nox.sessions.Session) -> None: def _session_tests( session: nox.sessions.Session, post_install: Callable = None ) -> None: - if TEST_CONFIG["pip_version_override"]: - pip_version = TEST_CONFIG["pip_version_override"] - session.install(f"pip=={pip_version}") - """Runs py.test for a particular project.""" - if os.path.exists("requirements.txt"): - if os.path.exists("constraints.txt"): - session.install("-r", "requirements.txt", "-c", "constraints.txt") - else: - session.install("-r", "requirements.txt") - - if os.path.exists("requirements-test.txt"): - if os.path.exists("constraints-test.txt"): - session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt") - else: - session.install("-r", "requirements-test.txt") - - if INSTALL_LIBRARY_FROM_SOURCE: - session.install("-e", _get_repo_root()) - - if post_install: - post_install(session) - - session.run( - "pytest", - *(PYTEST_COMMON_ARGS + session.posargs), - # Pytest will return 5 when no tests are collected. This can happen - # on travis where slow and flaky tests are excluded. - # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html - success_codes=[0, 5], - env=get_pytest_env_vars(), - ) + # check for presence of tests + test_list = glob.glob("*_test.py") + glob.glob("test_*.py") + if len(test_list) == 0: + print("No tests found, skipping directory.") + else: + if TEST_CONFIG["pip_version_override"]: + pip_version = TEST_CONFIG["pip_version_override"] + session.install(f"pip=={pip_version}") + """Runs py.test for a particular project.""" + if os.path.exists("requirements.txt"): + if os.path.exists("constraints.txt"): + session.install("-r", "requirements.txt", "-c", "constraints.txt") + else: + session.install("-r", "requirements.txt") + + if os.path.exists("requirements-test.txt"): + if os.path.exists("constraints-test.txt"): + session.install( + "-r", "requirements-test.txt", "-c", "constraints-test.txt" + ) + else: + session.install("-r", "requirements-test.txt") + + if INSTALL_LIBRARY_FROM_SOURCE: + session.install("-e", _get_repo_root()) + + if post_install: + post_install(session) + + session.run( + "pytest", + *(PYTEST_COMMON_ARGS + session.posargs), + # Pytest will return 5 when no tests are collected. This can happen + # on travis where slow and flaky tests are excluded. + # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html + success_codes=[0, 5], + env=get_pytest_env_vars(), + ) @nox.session(python=ALL_VERSIONS) From d6cffd2761a4ce9ac7991e56306476185c5f2437 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 13 Jan 2022 15:56:24 +0000 Subject: [PATCH 10/19] build: switch to release-please for tagging (#182) --- .github/.OwlBot.lock.yaml | 2 +- .github/release-please.yml | 1 + .github/release-trigger.yml | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 .github/release-trigger.yml diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 6b8a73b..ff5126c 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:36a95b8f494e4674dc9eee9af98961293b51b86b3649942aac800ae6c1f796d4 + digest: sha256:dfa9b663b32de8b5b327e32c1da665a80de48876558dd58091d8160c60ad7355 diff --git a/.github/release-please.yml b/.github/release-please.yml index 4507ad0..466597e 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1 +1,2 @@ releaseType: python +handleGHRelease: true diff --git a/.github/release-trigger.yml b/.github/release-trigger.yml new file mode 100644 index 0000000..d4ca941 --- /dev/null +++ b/.github/release-trigger.yml @@ -0,0 +1 @@ +enabled: true From 4975d8bb99c697df05efd73840af41b0d2287a1b Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 14 Jan 2022 11:25:43 -0500 Subject: [PATCH 11/19] chore(python): update release.sh to use keystore (#183) Source-Link: https://github.com/googleapis/synthtool/commit/69fda12e2994f0b595a397e8bb6e3e9f380524eb Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:ae600f36b6bc972b368367b6f83a1d91ec2c82a4a116b383d67d547c56fe6de3 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- .kokoro/release.sh | 2 +- .kokoro/release/common.cfg | 12 +++++++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index ff5126c..eecb84c 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:dfa9b663b32de8b5b327e32c1da665a80de48876558dd58091d8160c60ad7355 + digest: sha256:ae600f36b6bc972b368367b6f83a1d91ec2c82a4a116b383d67d547c56fe6de3 diff --git a/.kokoro/release.sh b/.kokoro/release.sh index cbdd17a..69c8b60 100755 --- a/.kokoro/release.sh +++ b/.kokoro/release.sh @@ -26,7 +26,7 @@ python3 -m pip install --upgrade twine wheel setuptools export PYTHONUNBUFFERED=1 # Move into the package, build the distribution and upload. -TWINE_PASSWORD=$(cat "${KOKORO_GFILE_DIR}/secret_manager/google-cloud-pypi-token") +TWINE_PASSWORD=$(cat "${KOKORO_KEYSTORE_DIR}/73713_google-cloud-pypi-token-keystore-1") cd github/python-datalabeling python3 setup.py sdist bdist_wheel twine upload --username __token__ --password "${TWINE_PASSWORD}" dist/* diff --git a/.kokoro/release/common.cfg b/.kokoro/release/common.cfg index 139ceca..18e76e3 100644 --- a/.kokoro/release/common.cfg +++ b/.kokoro/release/common.cfg @@ -23,8 +23,18 @@ env_vars: { value: "github/python-datalabeling/.kokoro/release.sh" } +# Fetch PyPI password +before_action { + fetch_keystore { + keystore_resource { + keystore_config_id: 73713 + keyname: "google-cloud-pypi-token-keystore-1" + } + } +} + # Tokens needed to report release status back to GitHub env_vars: { key: "SECRET_MANAGER_KEYS" - value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem,google-cloud-pypi-token" + value: "releasetool-publish-reporter-app,releasetool-publish-reporter-googleapis-installation,releasetool-publish-reporter-pem" } From c4f37f7c4f8d21a3c9e773454f99f34232ca0fe8 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 18 Jan 2022 21:04:20 -0500 Subject: [PATCH 12/19] chore(python): Noxfile recognizes that tests can live in a folder (#185) Source-Link: https://github.com/googleapis/synthtool/commit/4760d8dce1351d93658cb11d02a1b7ceb23ae5d7 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f0e4b51deef56bed74d3e2359c583fc104a8d6367da3984fc5c66938db738828 Co-authored-by: Owl Bot --- .github/.OwlBot.lock.yaml | 2 +- samples/snippets/noxfile.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index eecb84c..52d79c1 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,3 @@ docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:ae600f36b6bc972b368367b6f83a1d91ec2c82a4a116b383d67d547c56fe6de3 + digest: sha256:f0e4b51deef56bed74d3e2359c583fc104a8d6367da3984fc5c66938db738828 diff --git a/samples/snippets/noxfile.py b/samples/snippets/noxfile.py index 3bbef5d..20cdfc6 100644 --- a/samples/snippets/noxfile.py +++ b/samples/snippets/noxfile.py @@ -187,6 +187,7 @@ def _session_tests( ) -> None: # check for presence of tests test_list = glob.glob("*_test.py") + glob.glob("test_*.py") + test_list.extend(glob.glob("tests")) if len(test_list) == 0: print("No tests found, skipping directory.") else: From c17d1f12a83dc7cd915b4ea2249fb04e752b4455 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 21 Jan 2022 07:14:07 -0500 Subject: [PATCH 13/19] ci(python): run lint / unit tests / docs as GH actions (#186) * ci(python): run lint / unit tests / docs as GH actions Source-Link: https://github.com/googleapis/synthtool/commit/57be0cdb0b94e1669cee0ca38d790de1dfdbcd44 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:ed1f9983d5a935a89fe8085e8bb97d94e41015252c5b6c9771257cf8624367e6 * add commit to trigger gh actions Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .github/.OwlBot.lock.yaml | 16 +++++++++- .github/workflows/docs.yml | 38 +++++++++++++++++++++++ .github/workflows/lint.yml | 25 +++++++++++++++ .github/workflows/unittest.yml | 57 ++++++++++++++++++++++++++++++++++ 4 files changed, 135 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/docs.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/unittest.yml diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 52d79c1..b668c04 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -1,3 +1,17 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:f0e4b51deef56bed74d3e2359c583fc104a8d6367da3984fc5c66938db738828 + digest: sha256:ed1f9983d5a935a89fe8085e8bb97d94e41015252c5b6c9771257cf8624367e6 + diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..f7b8344 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,38 @@ +on: + pull_request: + branches: + - main +name: docs +jobs: + docs: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run docs + run: | + nox -s docs + docfx: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run docfx + run: | + nox -s docfx diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..1e8b05c --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,25 @@ +on: + pull_request: + branches: + - main +name: lint +jobs: + lint: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run lint + run: | + nox -s lint + - name: Run lint_setup_py + run: | + nox -s lint_setup_py diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml new file mode 100644 index 0000000..074ee25 --- /dev/null +++ b/.github/workflows/unittest.yml @@ -0,0 +1,57 @@ +on: + pull_request: + branches: + - main +name: unittest +jobs: + unit: + runs-on: ubuntu-latest + strategy: + matrix: + python: ['3.6', '3.7', '3.8', '3.9', '3.10'] + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python }} + - name: Install nox + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install nox + - name: Run unit tests + env: + COVERAGE_FILE: .coverage-${{ matrix.python }} + run: | + nox -s unit-${{ matrix.python }} + - name: Upload coverage results + uses: actions/upload-artifact@v2 + with: + name: coverage-artifacts + path: .coverage-${{ matrix.python }} + + cover: + runs-on: ubuntu-latest + needs: + - unit + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Install coverage + run: | + python -m pip install --upgrade setuptools pip wheel + python -m pip install coverage + - name: Download coverage results + uses: actions/download-artifact@v2 + with: + name: coverage-artifacts + path: .coverage-results/ + - name: Report coverage results + run: | + coverage combine .coverage-results/.coverage* + coverage report --show-missing --fail-under=100 From 06ee95d9cae1e0995a93aec425b8a3b3425a2131 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim <8822365+busunkim96@users.noreply.github.com> Date: Mon, 24 Jan 2022 13:09:14 -0700 Subject: [PATCH 14/19] chore: make samples 3.6 check optional (#187) --- .github/sync-repo-settings.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/sync-repo-settings.yaml b/.github/sync-repo-settings.yaml index 3e98ae7..37438d3 100644 --- a/.github/sync-repo-settings.yaml +++ b/.github/sync-repo-settings.yaml @@ -10,6 +10,5 @@ branchProtectionRules: - 'Kokoro' - 'cla/google' - 'Samples - Lint' - - 'Samples - Python 3.6' - 'Samples - Python 3.7' - 'Samples - Python 3.8' From 05f02e66d6f5a02bfd43d811bdde7240a0abfe61 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 25 Jan 2022 14:36:26 -0500 Subject: [PATCH 15/19] feat: add api key support (#188) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: upgrade gapic-generator-java, gax-java and gapic-generator-python PiperOrigin-RevId: 423842556 Source-Link: https://github.com/googleapis/googleapis/commit/a616ca08f4b1416abbac7bc5dd6d61c791756a81 Source-Link: https://github.com/googleapis/googleapis-gen/commit/29b938c58c1e51d019f2ee539d55dc0a3c86a905 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjliOTM4YzU4YzFlNTFkMDE5ZjJlZTUzOWQ1NWRjMGEzYzg2YTkwNSJ9 * 🦉 Updates from OwlBot See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot --- .../data_labeling_service/async_client.py | 38 ++++- .../services/data_labeling_service/client.py | 127 +++++++++++------ .../test_data_labeling_service.py | 131 ++++++++++++++++++ 3 files changed, 252 insertions(+), 44 deletions(-) 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 31b6d07..dd26c95 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 @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Sequence, Tuple, Type, Union +from typing import Dict, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -153,6 +153,42 @@ def from_service_account_file(cls, filename: str, *args, **kwargs): from_service_account_json = from_service_account_file + @classmethod + def get_mtls_endpoint_and_cert_source( + cls, client_options: Optional[ClientOptions] = None + ): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + return DataLabelingServiceClient.get_mtls_endpoint_and_cert_source(client_options) # type: ignore + @property def transport(self) -> DataLabelingServiceTransport: """Returns the transport used by the client instance. 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 1a41c33..5e1a202 100644 --- a/google/cloud/datalabeling_v1beta1/services/data_labeling_service/client.py +++ b/google/cloud/datalabeling_v1beta1/services/data_labeling_service/client.py @@ -369,6 +369,73 @@ def parse_common_location_path(path: str) -> Dict[str, str]: m = re.match(r"^projects/(?P.+?)/locations/(?P.+?)$", path) return m.groupdict() if m else {} + @classmethod + def get_mtls_endpoint_and_cert_source( + cls, client_options: Optional[client_options_lib.ClientOptions] = None + ): + """Return the API endpoint and client cert source for mutual TLS. + + The client cert source is determined in the following order: + (1) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is not "true", the + client cert source is None. + (2) if `client_options.client_cert_source` is provided, use the provided one; if the + default client cert source exists, use the default one; otherwise the client cert + source is None. + + The API endpoint is determined in the following order: + (1) if `client_options.api_endpoint` if provided, use the provided one. + (2) if `GOOGLE_API_USE_CLIENT_CERTIFICATE` environment variable is "always", use the + default mTLS endpoint; if the environment variabel is "never", use the default API + endpoint; otherwise if client cert source exists, use the default mTLS endpoint, otherwise + use the default API endpoint. + + More details can be found at https://google.aip.dev/auth/4114. + + Args: + client_options (google.api_core.client_options.ClientOptions): Custom options for the + client. Only the `api_endpoint` and `client_cert_source` properties may be used + in this method. + + Returns: + Tuple[str, Callable[[], Tuple[bytes, bytes]]]: returns the API endpoint and the + client cert source to use. + + Raises: + google.auth.exceptions.MutualTLSChannelError: If any errors happen. + """ + if client_options is None: + client_options = client_options_lib.ClientOptions() + use_client_cert = os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") + use_mtls_endpoint = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") + if use_client_cert not in ("true", "false"): + raise ValueError( + "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" + ) + if use_mtls_endpoint not in ("auto", "never", "always"): + raise MutualTLSChannelError( + "Environment variable `GOOGLE_API_USE_MTLS_ENDPOINT` must be `never`, `auto` or `always`" + ) + + # Figure out the client cert source to use. + client_cert_source = None + if use_client_cert == "true": + if client_options.client_cert_source: + client_cert_source = client_options.client_cert_source + elif mtls.has_default_client_cert_source(): + client_cert_source = mtls.default_client_cert_source() + + # Figure out which api endpoint to use. + if client_options.api_endpoint is not None: + api_endpoint = client_options.api_endpoint + elif use_mtls_endpoint == "always" or ( + use_mtls_endpoint == "auto" and client_cert_source + ): + api_endpoint = cls.DEFAULT_MTLS_ENDPOINT + else: + api_endpoint = cls.DEFAULT_ENDPOINT + + return api_endpoint, client_cert_source + def __init__( self, *, @@ -419,57 +486,22 @@ def __init__( if client_options is None: client_options = client_options_lib.ClientOptions() - # Create SSL credentials for mutual TLS if needed. - if os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") not in ( - "true", - "false", - ): - raise ValueError( - "Environment variable `GOOGLE_API_USE_CLIENT_CERTIFICATE` must be either `true` or `false`" - ) - use_client_cert = ( - os.getenv("GOOGLE_API_USE_CLIENT_CERTIFICATE", "false") == "true" + api_endpoint, client_cert_source_func = self.get_mtls_endpoint_and_cert_source( + client_options ) - client_cert_source_func = None - is_mtls = False - if use_client_cert: - if client_options.client_cert_source: - is_mtls = True - client_cert_source_func = client_options.client_cert_source - else: - is_mtls = mtls.has_default_client_cert_source() - if is_mtls: - client_cert_source_func = mtls.default_client_cert_source() - else: - client_cert_source_func = None - - # Figure out which api endpoint to use. - if client_options.api_endpoint is not None: - api_endpoint = client_options.api_endpoint - else: - use_mtls_env = os.getenv("GOOGLE_API_USE_MTLS_ENDPOINT", "auto") - if use_mtls_env == "never": - api_endpoint = self.DEFAULT_ENDPOINT - elif use_mtls_env == "always": - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - elif use_mtls_env == "auto": - if is_mtls: - api_endpoint = self.DEFAULT_MTLS_ENDPOINT - else: - api_endpoint = self.DEFAULT_ENDPOINT - else: - raise MutualTLSChannelError( - "Unsupported GOOGLE_API_USE_MTLS_ENDPOINT value. Accepted " - "values: never, auto, always" - ) + api_key_value = getattr(client_options, "api_key", None) + if api_key_value and credentials: + raise ValueError( + "client_options.api_key and credentials are mutually exclusive" + ) # Save or instantiate the transport. # Ordinarily, we provide the transport, but allowing a custom transport # instance provides an extensibility point for unusual situations. if isinstance(transport, DataLabelingServiceTransport): # transport is a DataLabelingServiceTransport instance. - if credentials or client_options.credentials_file: + if credentials or client_options.credentials_file or api_key_value: raise ValueError( "When providing a transport instance, " "provide its credentials directly." @@ -481,6 +513,15 @@ def __init__( ) self._transport = transport else: + import google.auth._default # type: ignore + + if api_key_value and hasattr( + google.auth._default, "get_api_key_credentials" + ): + credentials = google.auth._default.get_api_key_credentials( + api_key_value + ) + Transport = type(self).get_transport_class(transport) self._transport = Transport( credentials=credentials, 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 922a898..c729627 100644 --- a/tests/unit/gapic/datalabeling_v1beta1/test_data_labeling_service.py +++ b/tests/unit/gapic/datalabeling_v1beta1/test_data_labeling_service.py @@ -438,6 +438,87 @@ def test_data_labeling_service_client_mtls_env_auto( ) +@pytest.mark.parametrize( + "client_class", [DataLabelingServiceClient, DataLabelingServiceAsyncClient] +) +@mock.patch.object( + DataLabelingServiceClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(DataLabelingServiceClient), +) +@mock.patch.object( + DataLabelingServiceAsyncClient, + "DEFAULT_ENDPOINT", + modify_default_endpoint(DataLabelingServiceAsyncClient), +) +def test_data_labeling_service_client_get_mtls_endpoint_and_cert_source(client_class): + mock_client_cert_source = mock.Mock() + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "true". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + mock_api_endpoint = "foo" + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) + assert api_endpoint == mock_api_endpoint + assert cert_source == mock_client_cert_source + + # Test the case GOOGLE_API_USE_CLIENT_CERTIFICATE is "false". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "false"}): + mock_client_cert_source = mock.Mock() + mock_api_endpoint = "foo" + options = client_options.ClientOptions( + client_cert_source=mock_client_cert_source, api_endpoint=mock_api_endpoint + ) + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source( + options + ) + assert api_endpoint == mock_api_endpoint + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "never". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "never"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "always". + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_MTLS_ENDPOINT": "always"}): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert doesn't exist. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=False, + ): + api_endpoint, cert_source = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_ENDPOINT + assert cert_source is None + + # Test the case GOOGLE_API_USE_MTLS_ENDPOINT is "auto" and default cert exists. + with mock.patch.dict(os.environ, {"GOOGLE_API_USE_CLIENT_CERTIFICATE": "true"}): + with mock.patch( + "google.auth.transport.mtls.has_default_client_cert_source", + return_value=True, + ): + with mock.patch( + "google.auth.transport.mtls.default_client_cert_source", + return_value=mock_client_cert_source, + ): + ( + api_endpoint, + cert_source, + ) = client_class.get_mtls_endpoint_and_cert_source() + assert api_endpoint == client_class.DEFAULT_MTLS_ENDPOINT + assert cert_source == mock_client_cert_source + + @pytest.mark.parametrize( "client_class,transport_class,transport_name", [ @@ -9957,6 +10038,23 @@ def test_credentials_transport_error(): transport=transport, ) + # It is an error to provide an api_key and a transport instance. + transport = transports.DataLabelingServiceGrpcTransport( + credentials=ga_credentials.AnonymousCredentials(), + ) + options = client_options.ClientOptions() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = DataLabelingServiceClient(client_options=options, transport=transport,) + + # It is an error to provide an api_key and a credential. + options = mock.Mock() + options.api_key = "api_key" + with pytest.raises(ValueError): + client = DataLabelingServiceClient( + client_options=options, credentials=ga_credentials.AnonymousCredentials() + ) + # It is an error to provide scopes and a transport instance. transport = transports.DataLabelingServiceGrpcTransport( credentials=ga_credentials.AnonymousCredentials(), @@ -10755,3 +10853,36 @@ def test_client_ctx(): with client: pass close.assert_called() + + +@pytest.mark.parametrize( + "client_class,transport_class", + [ + (DataLabelingServiceClient, transports.DataLabelingServiceGrpcTransport), + ( + DataLabelingServiceAsyncClient, + transports.DataLabelingServiceGrpcAsyncIOTransport, + ), + ], +) +def test_api_key_credentials(client_class, transport_class): + with mock.patch.object( + google.auth._default, "get_api_key_credentials", create=True + ) as get_api_key_credentials: + mock_cred = mock.Mock() + get_api_key_credentials.return_value = mock_cred + options = client_options.ClientOptions() + options.api_key = "api_key" + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options) + patched.assert_called_once_with( + credentials=mock_cred, + 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, + always_use_jwt_access=True, + ) From 12dab81f7c7d909e2696ee0e8213a778f25fa77f Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 3 Feb 2022 14:20:46 +0000 Subject: [PATCH 16/19] chore: use gapic-generator-python 0.62.1 (#191) - [ ] Regenerate this pull request now. fix: resolve DuplicateCredentialArgs error when using credentials_file committer: parthea PiperOrigin-RevId: 425964861 Source-Link: https://github.com/googleapis/googleapis/commit/84b1a5a4f6fb2d04905be58e586b8a7a4310a8cf Source-Link: https://github.com/googleapis/googleapis-gen/commit/4fb761bbd8506ac156f49bac5f18306aa8eb3aa8 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGZiNzYxYmJkODUwNmFjMTU2ZjQ5YmFjNWYxODMwNmFhOGViM2FhOCJ9 --- .../data_labeling_service/async_client.py | 66 ++++++++--------- .../services/data_labeling_service/client.py | 66 ++++++++--------- .../data_labeling_service/transports/grpc.py | 7 +- .../transports/grpc_asyncio.py | 7 +- .../datalabeling_v1beta1/types/dataset.py | 4 +- .../test_data_labeling_service.py | 74 ++++++++++++++++++- 6 files changed, 150 insertions(+), 74 deletions(-) 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 dd26c95..de7a6a4 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 @@ -293,7 +293,7 @@ async def create_dataset( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, dataset]) if request is not None and has_flattened_params: @@ -367,7 +367,7 @@ async def get_dataset( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -459,7 +459,7 @@ async def list_datasets( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, filter]) if request is not None and has_flattened_params: @@ -541,7 +541,7 @@ async def delete_dataset( sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -636,7 +636,7 @@ async def import_data( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name, input_config]) if request is not None and has_flattened_params: @@ -746,7 +746,7 @@ async def export_data( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name, annotated_dataset, filter, output_config]) if request is not None and has_flattened_params: @@ -841,7 +841,7 @@ async def get_data_item( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -934,7 +934,7 @@ async def list_data_items( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, filter]) if request is not None and has_flattened_params: @@ -1027,7 +1027,7 @@ async def get_annotated_dataset( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -1121,7 +1121,7 @@ async def list_annotated_datasets( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, filter]) if request is not None and has_flattened_params: @@ -1274,7 +1274,7 @@ async def label_image( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, basic_config, feature]) if request is not None and has_flattened_params: @@ -1376,7 +1376,7 @@ async def label_video( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, basic_config, feature]) if request is not None and has_flattened_params: @@ -1478,7 +1478,7 @@ async def label_text( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, basic_config, feature]) if request is not None and has_flattened_params: @@ -1572,7 +1572,7 @@ async def get_example( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name, filter]) if request is not None and has_flattened_params: @@ -1666,7 +1666,7 @@ async def list_examples( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, filter]) if request is not None and has_flattened_params: @@ -1771,7 +1771,7 @@ async def create_annotation_spec_set( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, annotation_spec_set]) if request is not None and has_flattened_params: @@ -1848,7 +1848,7 @@ async def get_annotation_spec_set( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -1943,7 +1943,7 @@ async def list_annotation_spec_sets( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, filter]) if request is not None and has_flattened_params: @@ -2028,7 +2028,7 @@ async def delete_annotation_spec_set( sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -2119,7 +2119,7 @@ async def create_instruction( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, instruction]) if request is not None and has_flattened_params: @@ -2201,7 +2201,7 @@ async def get_instruction( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -2294,7 +2294,7 @@ async def list_instructions( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, filter]) if request is not None and has_flattened_params: @@ -2377,7 +2377,7 @@ async def delete_instruction( sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -2460,7 +2460,7 @@ async def get_evaluation( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -2584,7 +2584,7 @@ async def search_evaluations( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, filter]) if request is not None and has_flattened_params: @@ -2684,7 +2684,7 @@ async def search_example_comparisons( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -2773,7 +2773,7 @@ async def create_evaluation_job( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, job]) if request is not None and has_flattened_params: @@ -2872,7 +2872,7 @@ async def update_evaluation_job( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([evaluation_job, update_mask]) if request is not None and has_flattened_params: @@ -2952,7 +2952,7 @@ async def get_evaluation_job( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -3030,7 +3030,7 @@ async def pause_evaluation_job( sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -3097,7 +3097,7 @@ async def resume_evaluation_job( sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -3162,7 +3162,7 @@ async def delete_evaluation_job( sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -3261,7 +3261,7 @@ async def list_evaluation_jobs( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, filter]) if request is not None and has_flattened_params: 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 5e1a202..16efb14 100644 --- a/google/cloud/datalabeling_v1beta1/services/data_labeling_service/client.py +++ b/google/cloud/datalabeling_v1beta1/services/data_labeling_service/client.py @@ -577,7 +577,7 @@ def create_dataset( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, dataset]) if request is not None and has_flattened_params: @@ -651,7 +651,7 @@ def get_dataset( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -733,7 +733,7 @@ def list_datasets( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, filter]) if request is not None and has_flattened_params: @@ -805,7 +805,7 @@ def delete_dataset( sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -890,7 +890,7 @@ def import_data( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name, input_config]) if request is not None and has_flattened_params: @@ -1000,7 +1000,7 @@ def export_data( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name, annotated_dataset, filter, output_config]) if request is not None and has_flattened_params: @@ -1085,7 +1085,7 @@ def get_data_item( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -1168,7 +1168,7 @@ def list_data_items( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, filter]) if request is not None and has_flattened_params: @@ -1251,7 +1251,7 @@ def get_annotated_dataset( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -1335,7 +1335,7 @@ def list_annotated_datasets( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, filter]) if request is not None and has_flattened_params: @@ -1479,7 +1479,7 @@ def label_image( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, basic_config, feature]) if request is not None and has_flattened_params: @@ -1581,7 +1581,7 @@ def label_video( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, basic_config, feature]) if request is not None and has_flattened_params: @@ -1683,7 +1683,7 @@ def label_text( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, basic_config, feature]) if request is not None and has_flattened_params: @@ -1777,7 +1777,7 @@ def get_example( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name, filter]) if request is not None and has_flattened_params: @@ -1861,7 +1861,7 @@ def list_examples( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, filter]) if request is not None and has_flattened_params: @@ -1956,7 +1956,7 @@ def create_annotation_spec_set( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, annotation_spec_set]) if request is not None and has_flattened_params: @@ -2037,7 +2037,7 @@ def get_annotation_spec_set( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -2122,7 +2122,7 @@ def list_annotation_spec_sets( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, filter]) if request is not None and has_flattened_params: @@ -2199,7 +2199,7 @@ def delete_annotation_spec_set( sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -2284,7 +2284,7 @@ def create_instruction( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, instruction]) if request is not None and has_flattened_params: @@ -2366,7 +2366,7 @@ def get_instruction( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -2449,7 +2449,7 @@ def list_instructions( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, filter]) if request is not None and has_flattened_params: @@ -2522,7 +2522,7 @@ def delete_instruction( sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -2595,7 +2595,7 @@ def get_evaluation( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -2709,7 +2709,7 @@ def search_evaluations( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, filter]) if request is not None and has_flattened_params: @@ -2799,7 +2799,7 @@ def search_example_comparisons( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent]) if request is not None and has_flattened_params: @@ -2892,7 +2892,7 @@ def create_evaluation_job( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, job]) if request is not None and has_flattened_params: @@ -2991,7 +2991,7 @@ def update_evaluation_job( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([evaluation_job, update_mask]) if request is not None and has_flattened_params: @@ -3071,7 +3071,7 @@ def get_evaluation_job( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -3139,7 +3139,7 @@ def pause_evaluation_job( sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -3206,7 +3206,7 @@ def resume_evaluation_job( sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -3271,7 +3271,7 @@ def delete_evaluation_job( sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) if request is not None and has_flattened_params: @@ -3360,7 +3360,7 @@ def list_evaluation_jobs( """ # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have + # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([parent, filter]) if request is not None and has_flattened_params: 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 c2ebd4e..4d14988 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 @@ -172,8 +172,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, @@ -246,7 +249,7 @@ def operations_client(self) -> operations_v1.OperationsClient: This property caches on the instance; repeated calls return the same client. """ - # Sanity check: Only create a new client if we do not already have one. + # Quick check: Only create a new client if we do not already have one. if self._operations_client is None: self._operations_client = operations_v1.OperationsClient(self.grpc_channel) 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 f37d83a..a6c9189 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 @@ -217,8 +217,11 @@ def __init__( if not self._grpc_channel: self._grpc_channel = type(self).create_channel( self._host, + # use the credentials which are saved credentials=self._credentials, - credentials_file=credentials_file, + # Set ``credentials_file`` to ``None`` here as + # the credentials that we saved earlier should be used. + credentials_file=None, scopes=self._scopes, ssl_credentials=self._ssl_channel_credentials, quota_project_id=quota_project_id, @@ -248,7 +251,7 @@ def operations_client(self) -> operations_v1.OperationsAsyncClient: This property caches on the instance; repeated calls return the same client. """ - # Sanity check: Only create a new client if we do not already have one. + # Quick check: Only create a new client if we do not already have one. if self._operations_client is None: self._operations_client = operations_v1.OperationsAsyncClient( self.grpc_channel diff --git a/google/cloud/datalabeling_v1beta1/types/dataset.py b/google/cloud/datalabeling_v1beta1/types/dataset.py index a362c12..faada79 100644 --- a/google/cloud/datalabeling_v1beta1/types/dataset.py +++ b/google/cloud/datalabeling_v1beta1/types/dataset.py @@ -171,8 +171,8 @@ class ClassificationMetadata(proto.Message): Attributes: is_multi_label (bool): - Whether the classification task is multi- - abel or not. + Whether the classification task is + multi-label or not. """ is_multi_label = proto.Field(proto.BOOL, number=1,) 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 c729627..448bfcb 100644 --- a/tests/unit/gapic/datalabeling_v1beta1/test_data_labeling_service.py +++ b/tests/unit/gapic/datalabeling_v1beta1/test_data_labeling_service.py @@ -29,6 +29,7 @@ from google.api_core import gapic_v1 from google.api_core import grpc_helpers from google.api_core import grpc_helpers_async +from google.api_core import operation from google.api_core import operation_async # type: ignore from google.api_core import operations_v1 from google.api_core import path_template @@ -555,25 +556,28 @@ def test_data_labeling_service_client_client_options_scopes( @pytest.mark.parametrize( - "client_class,transport_class,transport_name", + "client_class,transport_class,transport_name,grpc_helpers", [ ( DataLabelingServiceClient, transports.DataLabelingServiceGrpcTransport, "grpc", + grpc_helpers, ), ( DataLabelingServiceAsyncClient, transports.DataLabelingServiceGrpcAsyncIOTransport, "grpc_asyncio", + grpc_helpers_async, ), ], ) def test_data_labeling_service_client_client_options_credentials_file( - client_class, transport_class, transport_name + client_class, transport_class, transport_name, grpc_helpers ): # Check the case credentials file is provided. options = client_options.ClientOptions(credentials_file="credentials.json") + with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -609,6 +613,72 @@ def test_data_labeling_service_client_client_options_from_dict(): ) +@pytest.mark.parametrize( + "client_class,transport_class,transport_name,grpc_helpers", + [ + ( + DataLabelingServiceClient, + transports.DataLabelingServiceGrpcTransport, + "grpc", + grpc_helpers, + ), + ( + DataLabelingServiceAsyncClient, + transports.DataLabelingServiceGrpcAsyncIOTransport, + "grpc_asyncio", + grpc_helpers_async, + ), + ], +) +def test_data_labeling_service_client_create_channel_credentials_file( + client_class, transport_class, transport_name, grpc_helpers +): + # Check the case credentials file is provided. + options = client_options.ClientOptions(credentials_file="credentials.json") + + with mock.patch.object(transport_class, "__init__") as patched: + patched.return_value = None + client = client_class(client_options=options, transport=transport_name) + patched.assert_called_once_with( + credentials=None, + credentials_file="credentials.json", + host=client.DEFAULT_ENDPOINT, + scopes=None, + client_cert_source_for_mtls=None, + quota_project_id=None, + client_info=transports.base.DEFAULT_CLIENT_INFO, + always_use_jwt_access=True, + ) + + # test that the credentials from file are saved and used as the credentials. + with mock.patch.object( + google.auth, "load_credentials_from_file", autospec=True + ) as load_creds, mock.patch.object( + google.auth, "default", autospec=True + ) as adc, mock.patch.object( + grpc_helpers, "create_channel" + ) as create_channel: + creds = ga_credentials.AnonymousCredentials() + file_creds = ga_credentials.AnonymousCredentials() + load_creds.return_value = (file_creds, None) + adc.return_value = (creds, None) + client = client_class(client_options=options, transport=transport_name) + create_channel.assert_called_with( + "datalabeling.googleapis.com:443", + credentials=file_creds, + credentials_file=None, + quota_project_id=None, + default_scopes=("https://www.googleapis.com/auth/cloud-platform",), + scopes=None, + default_host="datalabeling.googleapis.com", + ssl_credentials=None, + options=[ + ("grpc.max_send_message_length", -1), + ("grpc.max_receive_message_length", -1), + ], + ) + + @pytest.mark.parametrize( "request_type", [data_labeling_service.CreateDatasetRequest, dict,] ) From a46b9f954f350088fadbaa1ed0b3261d9e27c0ad Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 7 Feb 2022 17:14:54 +0100 Subject: [PATCH 17/19] chore(deps): update dependency pytest to v7 (#193) --- samples/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/requirements-test.txt b/samples/snippets/requirements-test.txt index fbe6c1c..27df463 100644 --- a/samples/snippets/requirements-test.txt +++ b/samples/snippets/requirements-test.txt @@ -1,2 +1,2 @@ backoff==1.11.1 -pytest==6.2.5 +pytest==7.0.0 From da32efbf4da9df340845f5d731e898f60cdaff7b Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Mon, 14 Feb 2022 16:52:00 +0100 Subject: [PATCH 18/19] chore(deps): update dependency pytest to v7.0.1 (#195) --- samples/snippets/requirements-test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/snippets/requirements-test.txt b/samples/snippets/requirements-test.txt index 27df463..c531e81 100644 --- a/samples/snippets/requirements-test.txt +++ b/samples/snippets/requirements-test.txt @@ -1,2 +1,2 @@ backoff==1.11.1 -pytest==7.0.0 +pytest==7.0.1 From 913773a7356580529cd8817b9a48c236f277f97a Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 14 Feb 2022 10:59:46 -0700 Subject: [PATCH 19/19] chore(main): release 1.5.0 (#189) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- CHANGELOG.md | 12 ++++++++++++ setup.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c468ed..6f79771 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,18 @@ [1]: https://pypi.org/project/google-cloud-datalabeling/#history +## [1.5.0](https://github.com/googleapis/python-datalabeling/compare/v1.4.0...v1.5.0) (2022-02-14) + + +### Features + +* add api key support ([#188](https://github.com/googleapis/python-datalabeling/issues/188)) ([05f02e6](https://github.com/googleapis/python-datalabeling/commit/05f02e66d6f5a02bfd43d811bdde7240a0abfe61)) + + +### Bug Fixes + +* resolve DuplicateCredentialArgs error when using credentials_file ([12dab81](https://github.com/googleapis/python-datalabeling/commit/12dab81f7c7d909e2696ee0e8213a778f25fa77f)) + ## [1.4.0](https://www.github.com/googleapis/python-datalabeling/compare/v1.3.0...v1.4.0) (2021-11-01) diff --git a/setup.py b/setup.py index 554e0a2..1caedd5 100644 --- a/setup.py +++ b/setup.py @@ -21,7 +21,7 @@ name = "google-cloud-datalabeling" description = "Data Labeling API client library" -version = "1.4.0" +version = "1.5.0" release_status = "Development Status :: 4 - Beta" dependencies = [ # NOTE: Maintainers, please do not require google-api-core>=2.x.x