From b1a21c62bbae3c62da1a95d3fddf88767103eca2 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Wed, 3 Nov 2021 09:06:52 +0100 Subject: [PATCH 01/10] chore(deps): update dependency google-cloud-vision to v2.6.2 (#265) --- samples/snippets/crop_hints/requirements.txt | 2 +- samples/snippets/detect/requirements.txt | 2 +- samples/snippets/document_text/requirements.txt | 2 +- samples/snippets/face_detection/requirements.txt | 2 +- samples/snippets/product_search/requirements.txt | 2 +- samples/snippets/quickstart/requirements.txt | 2 +- samples/snippets/web/requirements.txt | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/samples/snippets/crop_hints/requirements.txt b/samples/snippets/crop_hints/requirements.txt index e9164b17..2a8d0f96 100644 --- a/samples/snippets/crop_hints/requirements.txt +++ b/samples/snippets/crop_hints/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-vision==2.6.1 +google-cloud-vision==2.6.2 pillow==8.4.0 diff --git a/samples/snippets/detect/requirements.txt b/samples/snippets/detect/requirements.txt index 1ca24fdc..6a02ba03 100644 --- a/samples/snippets/detect/requirements.txt +++ b/samples/snippets/detect/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-vision==2.6.1 +google-cloud-vision==2.6.2 google-cloud-storage==1.42.3 diff --git a/samples/snippets/document_text/requirements.txt b/samples/snippets/document_text/requirements.txt index e9164b17..2a8d0f96 100644 --- a/samples/snippets/document_text/requirements.txt +++ b/samples/snippets/document_text/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-vision==2.6.1 +google-cloud-vision==2.6.2 pillow==8.4.0 diff --git a/samples/snippets/face_detection/requirements.txt b/samples/snippets/face_detection/requirements.txt index e9164b17..2a8d0f96 100644 --- a/samples/snippets/face_detection/requirements.txt +++ b/samples/snippets/face_detection/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-vision==2.6.1 +google-cloud-vision==2.6.2 pillow==8.4.0 diff --git a/samples/snippets/product_search/requirements.txt b/samples/snippets/product_search/requirements.txt index 1ca24fdc..6a02ba03 100644 --- a/samples/snippets/product_search/requirements.txt +++ b/samples/snippets/product_search/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-vision==2.6.1 +google-cloud-vision==2.6.2 google-cloud-storage==1.42.3 diff --git a/samples/snippets/quickstart/requirements.txt b/samples/snippets/quickstart/requirements.txt index ee03c023..1856a360 100644 --- a/samples/snippets/quickstart/requirements.txt +++ b/samples/snippets/quickstart/requirements.txt @@ -1 +1 @@ -google-cloud-vision==2.6.1 +google-cloud-vision==2.6.2 diff --git a/samples/snippets/web/requirements.txt b/samples/snippets/web/requirements.txt index ee03c023..1856a360 100644 --- a/samples/snippets/web/requirements.txt +++ b/samples/snippets/web/requirements.txt @@ -1 +1 @@ -google-cloud-vision==2.6.1 +google-cloud-vision==2.6.2 From bb82c82b9c593af7f6ca70c5d367b89361176f56 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 15:33:15 -0500 Subject: [PATCH 02/10] chore: use gapic-generator-python 0.56.2 (#269) 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 --- .../services/image_annotator/async_client.py | 13 +- .../services/image_annotator/client.py | 25 +- .../image_annotator/transports/base.py | 10 +- .../image_annotator/transports/grpc.py | 6 +- .../transports/grpc_asyncio.py | 6 +- .../services/product_search/async_client.py | 13 +- .../services/product_search/client.py | 25 +- .../product_search/transports/base.py | 10 +- .../product_search/transports/grpc.py | 6 +- .../product_search/transports/grpc_asyncio.py | 6 +- .../vision_v1/types/product_search_service.py | 3 + .../services/image_annotator/async_client.py | 13 +- .../services/image_annotator/client.py | 25 +- .../image_annotator/transports/base.py | 8 +- .../image_annotator/transports/grpc.py | 4 +- .../transports/grpc_asyncio.py | 4 +- .../services/image_annotator/async_client.py | 13 +- .../services/image_annotator/client.py | 25 +- .../image_annotator/transports/base.py | 10 +- .../image_annotator/transports/grpc.py | 6 +- .../transports/grpc_asyncio.py | 6 +- .../services/image_annotator/async_client.py | 13 +- .../services/image_annotator/client.py | 25 +- .../image_annotator/transports/base.py | 10 +- .../image_annotator/transports/grpc.py | 6 +- .../transports/grpc_asyncio.py | 6 +- .../services/product_search/async_client.py | 13 +- .../services/product_search/client.py | 25 +- .../product_search/transports/base.py | 10 +- .../product_search/transports/grpc.py | 6 +- .../product_search/transports/grpc_asyncio.py | 6 +- .../types/product_search_service.py | 1 + .../services/image_annotator/async_client.py | 13 +- .../services/image_annotator/client.py | 25 +- .../image_annotator/transports/base.py | 10 +- .../image_annotator/transports/grpc.py | 6 +- .../transports/grpc_asyncio.py | 6 +- .../services/product_search/async_client.py | 13 +- .../services/product_search/client.py | 25 +- .../product_search/transports/base.py | 10 +- .../product_search/transports/grpc.py | 6 +- .../product_search/transports/grpc_asyncio.py | 6 +- .../types/product_search_service.py | 3 + .../gapic/vision_v1/test_image_annotator.py | 40 ++- .../gapic/vision_v1/test_product_search.py | 256 ++++++++++++------ .../vision_v1p1beta1/test_image_annotator.py | 8 +- .../vision_v1p2beta1/test_image_annotator.py | 16 +- .../vision_v1p3beta1/test_image_annotator.py | 16 +- .../vision_v1p3beta1/test_product_search.py | 248 ++++++++++++----- .../vision_v1p4beta1/test_image_annotator.py | 40 ++- .../vision_v1p4beta1/test_product_search.py | 256 ++++++++++++------ 51 files changed, 916 insertions(+), 445 deletions(-) diff --git a/google/cloud/vision_v1/services/image_annotator/async_client.py b/google/cloud/vision_v1/services/image_annotator/async_client.py index c6f36401..42d7fa6d 100644 --- a/google/cloud/vision_v1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1/services/image_annotator/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/vision_v1/services/image_annotator/client.py b/google/cloud/vision_v1/services/image_annotator/client.py index fd5e2285..220497d8 100644 --- a/google/cloud/vision_v1/services/image_annotator/client.py +++ b/google/cloud/vision_v1/services/image_annotator/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 @@ -304,8 +306,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/vision_v1/services/image_annotator/transports/base.py b/google/cloud/vision_v1/services/image_annotator/transports/base.py index 8f564aea..b3cebed0 100644 --- a/google/cloud/vision_v1/services/image_annotator/transports/base.py +++ b/google/cloud/vision_v1/services/image_annotator/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/vision_v1/services/image_annotator/transports/grpc.py b/google/cloud/vision_v1/services/image_annotator/transports/grpc.py index 92dfcee9..7feec28f 100644 --- a/google/cloud/vision_v1/services/image_annotator/transports/grpc.py +++ b/google/cloud/vision_v1/services/image_annotator/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/vision_v1/services/image_annotator/transports/grpc_asyncio.py b/google/cloud/vision_v1/services/image_annotator/transports/grpc_asyncio.py index b57bf52f..f4486945 100644 --- a/google/cloud/vision_v1/services/image_annotator/transports/grpc_asyncio.py +++ b/google/cloud/vision_v1/services/image_annotator/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/vision_v1/services/product_search/async_client.py b/google/cloud/vision_v1/services/product_search/async_client.py index e2b15290..f3ca08a3 100644 --- a/google/cloud/vision_v1/services/product_search/async_client.py +++ b/google/cloud/vision_v1/services/product_search/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/vision_v1/services/product_search/client.py b/google/cloud/vision_v1/services/product_search/client.py index 984fa4b1..9d64ec1e 100644 --- a/google/cloud/vision_v1/services/product_search/client.py +++ b/google/cloud/vision_v1/services/product_search/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 @@ -343,8 +345,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/vision_v1/services/product_search/transports/base.py b/google/cloud/vision_v1/services/product_search/transports/base.py index ceabc2a7..a24f4523 100644 --- a/google/cloud/vision_v1/services/product_search/transports/base.py +++ b/google/cloud/vision_v1/services/product_search/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/vision_v1/services/product_search/transports/grpc.py b/google/cloud/vision_v1/services/product_search/transports/grpc.py index efd04d99..4c7f6741 100644 --- a/google/cloud/vision_v1/services/product_search/transports/grpc.py +++ b/google/cloud/vision_v1/services/product_search/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/vision_v1/services/product_search/transports/grpc_asyncio.py b/google/cloud/vision_v1/services/product_search/transports/grpc_asyncio.py index dd300088..6952b9e1 100644 --- a/google/cloud/vision_v1/services/product_search/transports/grpc_asyncio.py +++ b/google/cloud/vision_v1/services/product_search/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/vision_v1/types/product_search_service.py b/google/cloud/vision_v1/types/product_search_service.py index f4a9317a..05be5f57 100644 --- a/google/cloud/vision_v1/types/product_search_service.py +++ b/google/cloud/vision_v1/types/product_search_service.py @@ -718,6 +718,7 @@ class ImportProductSetsInputConfig(proto.Message): The Google Cloud Storage location for a csv file which preserves a list of ImportProductSetRequests in each line. + This field is a member of `oneof`_ ``source``. """ @@ -836,10 +837,12 @@ class PurgeProductsRequest(proto.Message): product_set_purge_config (google.cloud.vision_v1.types.ProductSetPurgeConfig): Specify which ProductSet contains the Products to be deleted. + This field is a member of `oneof`_ ``target``. delete_orphan_products (bool): If delete_orphan_products is true, all Products that are not in any ProductSet will be deleted. + This field is a member of `oneof`_ ``target``. parent (str): Required. The project and location in which the Products diff --git a/google/cloud/vision_v1p1beta1/services/image_annotator/async_client.py b/google/cloud/vision_v1p1beta1/services/image_annotator/async_client.py index 6c68dede..2b8f8785 100644 --- a/google/cloud/vision_v1p1beta1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1p1beta1/services/image_annotator/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.cloud.vision_v1p1beta1.types import image_annotator from .transports.base import ImageAnnotatorTransport, DEFAULT_CLIENT_INFO diff --git a/google/cloud/vision_v1p1beta1/services/image_annotator/client.py b/google/cloud/vision_v1p1beta1/services/image_annotator/client.py index 5ade3826..3494d849 100644 --- a/google/cloud/vision_v1p1beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p1beta1/services/image_annotator/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.cloud.vision_v1p1beta1.types import image_annotator from .transports.base import ImageAnnotatorTransport, DEFAULT_CLIENT_INFO @@ -270,8 +272,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/vision_v1p1beta1/services/image_annotator/transports/base.py b/google/cloud/vision_v1p1beta1/services/image_annotator/transports/base.py index 6f066390..c04b41ba 100644 --- a/google/cloud/vision_v1p1beta1/services/image_annotator/transports/base.py +++ b/google/cloud/vision_v1p1beta1/services/image_annotator/transports/base.py @@ -18,10 +18,10 @@ 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 +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.auth import credentials as ga_credentials # type: ignore from google.oauth2 import service_account # type: ignore diff --git a/google/cloud/vision_v1p1beta1/services/image_annotator/transports/grpc.py b/google/cloud/vision_v1p1beta1/services/image_annotator/transports/grpc.py index bdb337c0..80bfa44d 100644 --- a/google/cloud/vision_v1p1beta1/services/image_annotator/transports/grpc.py +++ b/google/cloud/vision_v1p1beta1/services/image_annotator/transports/grpc.py @@ -16,8 +16,8 @@ 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 gapic_v1 # type: ignore +from google.api_core import grpc_helpers +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/vision_v1p1beta1/services/image_annotator/transports/grpc_asyncio.py b/google/cloud/vision_v1p1beta1/services/image_annotator/transports/grpc_asyncio.py index 8f64a1bc..d054014e 100644 --- a/google/cloud/vision_v1p1beta1/services/image_annotator/transports/grpc_asyncio.py +++ b/google/cloud/vision_v1p1beta1/services/image_annotator/transports/grpc_asyncio.py @@ -16,8 +16,8 @@ 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 gapic_v1 +from google.api_core import grpc_helpers_async from google.auth import credentials as ga_credentials # type: ignore from google.auth.transport.grpc import SslCredentials # type: ignore diff --git a/google/cloud/vision_v1p2beta1/services/image_annotator/async_client.py b/google/cloud/vision_v1p2beta1/services/image_annotator/async_client.py index bab8d5e5..633eec1c 100644 --- a/google/cloud/vision_v1p2beta1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1p2beta1/services/image_annotator/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/vision_v1p2beta1/services/image_annotator/client.py b/google/cloud/vision_v1p2beta1/services/image_annotator/client.py index a9217b5c..6836bf41 100644 --- a/google/cloud/vision_v1p2beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p2beta1/services/image_annotator/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 @@ -272,8 +274,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/vision_v1p2beta1/services/image_annotator/transports/base.py b/google/cloud/vision_v1p2beta1/services/image_annotator/transports/base.py index 8afc6f65..dceb4db3 100644 --- a/google/cloud/vision_v1p2beta1/services/image_annotator/transports/base.py +++ b/google/cloud/vision_v1p2beta1/services/image_annotator/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/vision_v1p2beta1/services/image_annotator/transports/grpc.py b/google/cloud/vision_v1p2beta1/services/image_annotator/transports/grpc.py index 02a351e9..2eab8766 100644 --- a/google/cloud/vision_v1p2beta1/services/image_annotator/transports/grpc.py +++ b/google/cloud/vision_v1p2beta1/services/image_annotator/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/vision_v1p2beta1/services/image_annotator/transports/grpc_asyncio.py b/google/cloud/vision_v1p2beta1/services/image_annotator/transports/grpc_asyncio.py index 9354a560..4fc73541 100644 --- a/google/cloud/vision_v1p2beta1/services/image_annotator/transports/grpc_asyncio.py +++ b/google/cloud/vision_v1p2beta1/services/image_annotator/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/vision_v1p3beta1/services/image_annotator/async_client.py b/google/cloud/vision_v1p3beta1/services/image_annotator/async_client.py index b076383e..5adce9e0 100644 --- a/google/cloud/vision_v1p3beta1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1p3beta1/services/image_annotator/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/vision_v1p3beta1/services/image_annotator/client.py b/google/cloud/vision_v1p3beta1/services/image_annotator/client.py index 5062ea91..a6640c35 100644 --- a/google/cloud/vision_v1p3beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p3beta1/services/image_annotator/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 @@ -304,8 +306,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/vision_v1p3beta1/services/image_annotator/transports/base.py b/google/cloud/vision_v1p3beta1/services/image_annotator/transports/base.py index 87320f06..eaf5f784 100644 --- a/google/cloud/vision_v1p3beta1/services/image_annotator/transports/base.py +++ b/google/cloud/vision_v1p3beta1/services/image_annotator/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/vision_v1p3beta1/services/image_annotator/transports/grpc.py b/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc.py index 1946436a..1a961671 100644 --- a/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc.py +++ b/google/cloud/vision_v1p3beta1/services/image_annotator/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/vision_v1p3beta1/services/image_annotator/transports/grpc_asyncio.py b/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc_asyncio.py index 60967a41..1d4725df 100644 --- a/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc_asyncio.py +++ b/google/cloud/vision_v1p3beta1/services/image_annotator/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/vision_v1p3beta1/services/product_search/async_client.py b/google/cloud/vision_v1p3beta1/services/product_search/async_client.py index 68fb8a1f..09368e2b 100644 --- a/google/cloud/vision_v1p3beta1/services/product_search/async_client.py +++ b/google/cloud/vision_v1p3beta1/services/product_search/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/vision_v1p3beta1/services/product_search/client.py b/google/cloud/vision_v1p3beta1/services/product_search/client.py index a8033e90..a7810c46 100644 --- a/google/cloud/vision_v1p3beta1/services/product_search/client.py +++ b/google/cloud/vision_v1p3beta1/services/product_search/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 @@ -344,8 +346,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/vision_v1p3beta1/services/product_search/transports/base.py b/google/cloud/vision_v1p3beta1/services/product_search/transports/base.py index f04547b3..2f9320d9 100644 --- a/google/cloud/vision_v1p3beta1/services/product_search/transports/base.py +++ b/google/cloud/vision_v1p3beta1/services/product_search/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/vision_v1p3beta1/services/product_search/transports/grpc.py b/google/cloud/vision_v1p3beta1/services/product_search/transports/grpc.py index 6e33bc98..cf63871a 100644 --- a/google/cloud/vision_v1p3beta1/services/product_search/transports/grpc.py +++ b/google/cloud/vision_v1p3beta1/services/product_search/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/vision_v1p3beta1/services/product_search/transports/grpc_asyncio.py b/google/cloud/vision_v1p3beta1/services/product_search/transports/grpc_asyncio.py index 711f47fc..f9822553 100644 --- a/google/cloud/vision_v1p3beta1/services/product_search/transports/grpc_asyncio.py +++ b/google/cloud/vision_v1p3beta1/services/product_search/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/vision_v1p3beta1/types/product_search_service.py b/google/cloud/vision_v1p3beta1/types/product_search_service.py index 0e98cb80..50e10191 100644 --- a/google/cloud/vision_v1p3beta1/types/product_search_service.py +++ b/google/cloud/vision_v1p3beta1/types/product_search_service.py @@ -699,6 +699,7 @@ class ImportProductSetsInputConfig(proto.Message): The Google Cloud Storage location for a csv file which preserves a list of ImportProductSetRequests in each line. + This field is a member of `oneof`_ ``source``. """ diff --git a/google/cloud/vision_v1p4beta1/services/image_annotator/async_client.py b/google/cloud/vision_v1p4beta1/services/image_annotator/async_client.py index 9635fbf3..805c91c2 100644 --- a/google/cloud/vision_v1p4beta1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1p4beta1/services/image_annotator/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/vision_v1p4beta1/services/image_annotator/client.py b/google/cloud/vision_v1p4beta1/services/image_annotator/client.py index 58062701..1d942b66 100644 --- a/google/cloud/vision_v1p4beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p4beta1/services/image_annotator/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 @@ -304,8 +306,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/vision_v1p4beta1/services/image_annotator/transports/base.py b/google/cloud/vision_v1p4beta1/services/image_annotator/transports/base.py index a3985d91..a09b6b22 100644 --- a/google/cloud/vision_v1p4beta1/services/image_annotator/transports/base.py +++ b/google/cloud/vision_v1p4beta1/services/image_annotator/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/vision_v1p4beta1/services/image_annotator/transports/grpc.py b/google/cloud/vision_v1p4beta1/services/image_annotator/transports/grpc.py index e79ff8f2..8efff3d5 100644 --- a/google/cloud/vision_v1p4beta1/services/image_annotator/transports/grpc.py +++ b/google/cloud/vision_v1p4beta1/services/image_annotator/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/vision_v1p4beta1/services/image_annotator/transports/grpc_asyncio.py b/google/cloud/vision_v1p4beta1/services/image_annotator/transports/grpc_asyncio.py index bee42ccf..a5906c75 100644 --- a/google/cloud/vision_v1p4beta1/services/image_annotator/transports/grpc_asyncio.py +++ b/google/cloud/vision_v1p4beta1/services/image_annotator/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/vision_v1p4beta1/services/product_search/async_client.py b/google/cloud/vision_v1p4beta1/services/product_search/async_client.py index c586f4fd..a8b59156 100644 --- a/google/cloud/vision_v1p4beta1/services/product_search/async_client.py +++ b/google/cloud/vision_v1p4beta1/services/product_search/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/vision_v1p4beta1/services/product_search/client.py b/google/cloud/vision_v1p4beta1/services/product_search/client.py index fdeb27d0..d935b9e1 100644 --- a/google/cloud/vision_v1p4beta1/services/product_search/client.py +++ b/google/cloud/vision_v1p4beta1/services/product_search/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 @@ -345,8 +347,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/vision_v1p4beta1/services/product_search/transports/base.py b/google/cloud/vision_v1p4beta1/services/product_search/transports/base.py index 2687367f..2b2fe864 100644 --- a/google/cloud/vision_v1p4beta1/services/product_search/transports/base.py +++ b/google/cloud/vision_v1p4beta1/services/product_search/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/vision_v1p4beta1/services/product_search/transports/grpc.py b/google/cloud/vision_v1p4beta1/services/product_search/transports/grpc.py index 72d9ff61..6f3a4a53 100644 --- a/google/cloud/vision_v1p4beta1/services/product_search/transports/grpc.py +++ b/google/cloud/vision_v1p4beta1/services/product_search/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/vision_v1p4beta1/services/product_search/transports/grpc_asyncio.py b/google/cloud/vision_v1p4beta1/services/product_search/transports/grpc_asyncio.py index 798cf1d1..5f5f28c0 100644 --- a/google/cloud/vision_v1p4beta1/services/product_search/transports/grpc_asyncio.py +++ b/google/cloud/vision_v1p4beta1/services/product_search/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/vision_v1p4beta1/types/product_search_service.py b/google/cloud/vision_v1p4beta1/types/product_search_service.py index 135a434e..225acf94 100644 --- a/google/cloud/vision_v1p4beta1/types/product_search_service.py +++ b/google/cloud/vision_v1p4beta1/types/product_search_service.py @@ -720,6 +720,7 @@ class ImportProductSetsInputConfig(proto.Message): The Google Cloud Storage location for a csv file which preserves a list of ImportProductSetRequests in each line. + This field is a member of `oneof`_ ``source``. """ @@ -838,10 +839,12 @@ class PurgeProductsRequest(proto.Message): product_set_purge_config (google.cloud.vision_v1p4beta1.types.ProductSetPurgeConfig): Specify which ProductSet contains the Products to be deleted. + This field is a member of `oneof`_ ``target``. delete_orphan_products (bool): If delete_orphan_products is true, all Products that are not in any ProductSet will be deleted. + This field is a member of `oneof`_ ``target``. parent (str): Required. The project and location in which the Products diff --git a/tests/unit/gapic/vision_v1/test_image_annotator.py b/tests/unit/gapic/vision_v1/test_image_annotator.py index 92c9f73d..e559059e 100644 --- a/tests/unit/gapic/vision_v1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1/test_image_annotator.py @@ -592,11 +592,13 @@ def test_batch_annotate_images_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AnnotateImageRequest( image=image_annotator.Image(content=b"content_blob") ) ] + assert arg == mock_val def test_batch_annotate_images_flattened_error(): @@ -645,11 +647,13 @@ async def test_batch_annotate_images_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AnnotateImageRequest( image=image_annotator.Image(content=b"content_blob") ) ] + assert arg == mock_val @pytest.mark.asyncio @@ -782,13 +786,15 @@ def test_batch_annotate_files_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AnnotateFileRequest( input_config=image_annotator.InputConfig( gcs_source=image_annotator.GcsSource(uri="uri_value") ) ) ] + assert arg == mock_val def test_batch_annotate_files_flattened_error(): @@ -841,13 +847,15 @@ async def test_batch_annotate_files_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AnnotateFileRequest( input_config=image_annotator.InputConfig( gcs_source=image_annotator.GcsSource(uri="uri_value") ) ) ] + assert arg == mock_val @pytest.mark.asyncio @@ -984,14 +992,18 @@ def test_async_batch_annotate_images_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AnnotateImageRequest( image=image_annotator.Image(content=b"content_blob") ) ] - assert args[0].output_config == image_annotator.OutputConfig( + assert arg == mock_val + arg = args[0].output_config + mock_val = image_annotator.OutputConfig( gcs_destination=image_annotator.GcsDestination(uri="uri_value") ) + assert arg == mock_val def test_async_batch_annotate_images_flattened_error(): @@ -1046,14 +1058,18 @@ async def test_async_batch_annotate_images_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AnnotateImageRequest( image=image_annotator.Image(content=b"content_blob") ) ] - assert args[0].output_config == image_annotator.OutputConfig( + assert arg == mock_val + arg = args[0].output_config + mock_val = image_annotator.OutputConfig( gcs_destination=image_annotator.GcsDestination(uri="uri_value") ) + assert arg == mock_val @pytest.mark.asyncio @@ -1189,13 +1205,15 @@ def test_async_batch_annotate_files_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AsyncAnnotateFileRequest( input_config=image_annotator.InputConfig( gcs_source=image_annotator.GcsSource(uri="uri_value") ) ) ] + assert arg == mock_val def test_async_batch_annotate_files_flattened_error(): @@ -1248,13 +1266,15 @@ async def test_async_batch_annotate_files_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AsyncAnnotateFileRequest( input_config=image_annotator.InputConfig( gcs_source=image_annotator.GcsSource(uri="uri_value") ) ) ] + assert arg == mock_val @pytest.mark.asyncio diff --git a/tests/unit/gapic/vision_v1/test_product_search.py b/tests/unit/gapic/vision_v1/test_product_search.py index 49b181c5..1dcbdba3 100644 --- a/tests/unit/gapic/vision_v1/test_product_search.py +++ b/tests/unit/gapic/vision_v1/test_product_search.py @@ -658,11 +658,15 @@ def test_create_product_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].product_set == product_search_service.ProductSet( - name="name_value" - ) - assert args[0].product_set_id == "product_set_id_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].product_set + mock_val = product_search_service.ProductSet(name="name_value") + assert arg == mock_val + arg = args[0].product_set_id + mock_val = "product_set_id_value" + assert arg == mock_val def test_create_product_set_flattened_error(): @@ -707,11 +711,15 @@ async def test_create_product_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].product_set == product_search_service.ProductSet( - name="name_value" - ) - assert args[0].product_set_id == "product_set_id_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].product_set + mock_val = product_search_service.ProductSet(name="name_value") + assert arg == mock_val + arg = args[0].product_set_id + mock_val = "product_set_id_value" + assert arg == mock_val @pytest.mark.asyncio @@ -897,7 +905,9 @@ def test_list_product_sets_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_list_product_sets_flattened_error(): @@ -935,7 +945,9 @@ async def test_list_product_sets_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 @@ -1278,7 +1290,9 @@ def test_get_product_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_product_set_flattened_error(): @@ -1314,7 +1328,9 @@ async def test_get_product_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 @@ -1506,10 +1522,12 @@ def test_update_product_set_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].product_set == product_search_service.ProductSet( - name="name_value" - ) - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].product_set + mock_val = product_search_service.ProductSet(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_product_set_flattened_error(): @@ -1552,10 +1570,12 @@ async def test_update_product_set_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].product_set == product_search_service.ProductSet( - name="name_value" - ) - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].product_set + mock_val = product_search_service.ProductSet(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 @@ -1730,7 +1750,9 @@ def test_delete_product_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_product_set_flattened_error(): @@ -1766,7 +1788,9 @@ async def test_delete_product_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 @@ -1953,9 +1977,15 @@ def test_create_product_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].product == product_search_service.Product(name="name_value") - assert args[0].product_id == "product_id_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].product + mock_val = product_search_service.Product(name="name_value") + assert arg == mock_val + arg = args[0].product_id + mock_val = "product_id_value" + assert arg == mock_val def test_create_product_flattened_error(): @@ -1998,9 +2028,15 @@ async def test_create_product_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].product == product_search_service.Product(name="name_value") - assert args[0].product_id == "product_id_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].product + mock_val = product_search_service.Product(name="name_value") + assert arg == mock_val + arg = args[0].product_id + mock_val = "product_id_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2174,7 +2210,9 @@ def test_list_products_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_list_products_flattened_error(): @@ -2210,7 +2248,9 @@ async def test_list_products_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 @@ -2551,7 +2591,9 @@ def test_get_product_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_product_flattened_error(): @@ -2587,7 +2629,9 @@ async def test_get_product_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 @@ -2777,8 +2821,12 @@ def test_update_product_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].product == product_search_service.Product(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].product + mock_val = product_search_service.Product(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_product_flattened_error(): @@ -2819,8 +2867,12 @@ async def test_update_product_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].product == product_search_service.Product(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].product + mock_val = product_search_service.Product(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 @@ -2983,7 +3035,9 @@ def test_delete_product_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_product_flattened_error(): @@ -3017,7 +3071,9 @@ async def test_delete_product_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 @@ -3205,11 +3261,15 @@ def test_create_reference_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].reference_image == product_search_service.ReferenceImage( - name="name_value" - ) - assert args[0].reference_image_id == "reference_image_id_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].reference_image + mock_val = product_search_service.ReferenceImage(name="name_value") + assert arg == mock_val + arg = args[0].reference_image_id + mock_val = "reference_image_id_value" + assert arg == mock_val def test_create_reference_image_flattened_error(): @@ -3254,11 +3314,15 @@ async def test_create_reference_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].reference_image == product_search_service.ReferenceImage( - name="name_value" - ) - assert args[0].reference_image_id == "reference_image_id_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].reference_image + mock_val = product_search_service.ReferenceImage(name="name_value") + assert arg == mock_val + arg = args[0].reference_image_id + mock_val = "reference_image_id_value" + assert arg == mock_val @pytest.mark.asyncio @@ -3435,7 +3499,9 @@ def test_delete_reference_image_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_reference_image_flattened_error(): @@ -3471,7 +3537,9 @@ async def test_delete_reference_image_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 @@ -3657,7 +3725,9 @@ def test_list_reference_images_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_list_reference_images_flattened_error(): @@ -3695,7 +3765,9 @@ async def test_list_reference_images_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 @@ -4053,7 +4125,9 @@ def test_get_reference_image_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_reference_image_flattened_error(): @@ -4091,7 +4165,9 @@ async def test_get_reference_image_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 @@ -4267,8 +4343,12 @@ def test_add_product_to_product_set_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].product == "product_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].product + mock_val = "product_value" + assert arg == mock_val def test_add_product_to_product_set_flattened_error(): @@ -4308,8 +4388,12 @@ async def test_add_product_to_product_set_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].product == "product_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].product + mock_val = "product_value" + assert arg == mock_val @pytest.mark.asyncio @@ -4487,8 +4571,12 @@ def test_remove_product_from_product_set_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].product == "product_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].product + mock_val = "product_value" + assert arg == mock_val def test_remove_product_from_product_set_flattened_error(): @@ -4528,8 +4616,12 @@ async def test_remove_product_from_product_set_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].product == "product_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].product + mock_val = "product_value" + assert arg == mock_val @pytest.mark.asyncio @@ -4715,7 +4807,9 @@ def test_list_products_in_product_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_list_products_in_product_set_flattened_error(): @@ -4753,7 +4847,9 @@ async def test_list_products_in_product_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 @@ -5106,14 +5202,16 @@ def test_import_product_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 - ].input_config == product_search_service.ImportProductSetsInputConfig( + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].input_config + mock_val = product_search_service.ImportProductSetsInputConfig( gcs_source=product_search_service.ImportProductSetsGcsSource( csv_file_uri="csv_file_uri_value" ) ) + assert arg == mock_val def test_import_product_sets_flattened_error(): @@ -5164,14 +5262,16 @@ async def test_import_product_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 - ].input_config == product_search_service.ImportProductSetsInputConfig( + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].input_config + mock_val = product_search_service.ImportProductSetsInputConfig( gcs_source=product_search_service.ImportProductSetsGcsSource( csv_file_uri="csv_file_uri_value" ) ) + assert arg == mock_val @pytest.mark.asyncio @@ -5342,7 +5442,9 @@ def test_purge_products_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_purge_products_flattened_error(): @@ -5378,7 +5480,9 @@ async def test_purge_products_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 diff --git a/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.py b/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.py index 17342271..bb524466 100644 --- a/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.py @@ -588,11 +588,13 @@ def test_batch_annotate_images_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AnnotateImageRequest( image=image_annotator.Image(content=b"content_blob") ) ] + assert arg == mock_val def test_batch_annotate_images_flattened_error(): @@ -641,11 +643,13 @@ async def test_batch_annotate_images_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AnnotateImageRequest( image=image_annotator.Image(content=b"content_blob") ) ] + assert arg == mock_val @pytest.mark.asyncio diff --git a/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.py b/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.py index c3176d05..52785a1c 100644 --- a/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.py @@ -592,11 +592,13 @@ def test_batch_annotate_images_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AnnotateImageRequest( image=image_annotator.Image(content=b"content_blob") ) ] + assert arg == mock_val def test_batch_annotate_images_flattened_error(): @@ -645,11 +647,13 @@ async def test_batch_annotate_images_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AnnotateImageRequest( image=image_annotator.Image(content=b"content_blob") ) ] + assert arg == mock_val @pytest.mark.asyncio @@ -782,13 +786,15 @@ def test_async_batch_annotate_files_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AsyncAnnotateFileRequest( input_config=image_annotator.InputConfig( gcs_source=image_annotator.GcsSource(uri="uri_value") ) ) ] + assert arg == mock_val def test_async_batch_annotate_files_flattened_error(): @@ -841,13 +847,15 @@ async def test_async_batch_annotate_files_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AsyncAnnotateFileRequest( input_config=image_annotator.InputConfig( gcs_source=image_annotator.GcsSource(uri="uri_value") ) ) ] + assert arg == mock_val @pytest.mark.asyncio diff --git a/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.py b/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.py index 595422bc..f6aa6ce1 100644 --- a/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.py @@ -594,11 +594,13 @@ def test_batch_annotate_images_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AnnotateImageRequest( image=image_annotator.Image(content=b"content_blob") ) ] + assert arg == mock_val def test_batch_annotate_images_flattened_error(): @@ -647,11 +649,13 @@ async def test_batch_annotate_images_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AnnotateImageRequest( image=image_annotator.Image(content=b"content_blob") ) ] + assert arg == mock_val @pytest.mark.asyncio @@ -784,13 +788,15 @@ def test_async_batch_annotate_files_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AsyncAnnotateFileRequest( input_config=image_annotator.InputConfig( gcs_source=image_annotator.GcsSource(uri="uri_value") ) ) ] + assert arg == mock_val def test_async_batch_annotate_files_flattened_error(): @@ -843,13 +849,15 @@ async def test_async_batch_annotate_files_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AsyncAnnotateFileRequest( input_config=image_annotator.InputConfig( gcs_source=image_annotator.GcsSource(uri="uri_value") ) ) ] + assert arg == mock_val @pytest.mark.asyncio diff --git a/tests/unit/gapic/vision_v1p3beta1/test_product_search.py b/tests/unit/gapic/vision_v1p3beta1/test_product_search.py index c5eaa0de..1878ddcd 100644 --- a/tests/unit/gapic/vision_v1p3beta1/test_product_search.py +++ b/tests/unit/gapic/vision_v1p3beta1/test_product_search.py @@ -660,11 +660,15 @@ def test_create_product_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].product_set == product_search_service.ProductSet( - name="name_value" - ) - assert args[0].product_set_id == "product_set_id_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].product_set + mock_val = product_search_service.ProductSet(name="name_value") + assert arg == mock_val + arg = args[0].product_set_id + mock_val = "product_set_id_value" + assert arg == mock_val def test_create_product_set_flattened_error(): @@ -709,11 +713,15 @@ async def test_create_product_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].product_set == product_search_service.ProductSet( - name="name_value" - ) - assert args[0].product_set_id == "product_set_id_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].product_set + mock_val = product_search_service.ProductSet(name="name_value") + assert arg == mock_val + arg = args[0].product_set_id + mock_val = "product_set_id_value" + assert arg == mock_val @pytest.mark.asyncio @@ -899,7 +907,9 @@ def test_list_product_sets_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_list_product_sets_flattened_error(): @@ -937,7 +947,9 @@ async def test_list_product_sets_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 @@ -1280,7 +1292,9 @@ def test_get_product_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_product_set_flattened_error(): @@ -1316,7 +1330,9 @@ async def test_get_product_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 @@ -1508,10 +1524,12 @@ def test_update_product_set_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].product_set == product_search_service.ProductSet( - name="name_value" - ) - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].product_set + mock_val = product_search_service.ProductSet(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_product_set_flattened_error(): @@ -1554,10 +1572,12 @@ async def test_update_product_set_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].product_set == product_search_service.ProductSet( - name="name_value" - ) - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].product_set + mock_val = product_search_service.ProductSet(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 @@ -1732,7 +1752,9 @@ def test_delete_product_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_product_set_flattened_error(): @@ -1768,7 +1790,9 @@ async def test_delete_product_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 @@ -1955,9 +1979,15 @@ def test_create_product_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].product == product_search_service.Product(name="name_value") - assert args[0].product_id == "product_id_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].product + mock_val = product_search_service.Product(name="name_value") + assert arg == mock_val + arg = args[0].product_id + mock_val = "product_id_value" + assert arg == mock_val def test_create_product_flattened_error(): @@ -2000,9 +2030,15 @@ async def test_create_product_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].product == product_search_service.Product(name="name_value") - assert args[0].product_id == "product_id_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].product + mock_val = product_search_service.Product(name="name_value") + assert arg == mock_val + arg = args[0].product_id + mock_val = "product_id_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2176,7 +2212,9 @@ def test_list_products_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_list_products_flattened_error(): @@ -2212,7 +2250,9 @@ async def test_list_products_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 @@ -2553,7 +2593,9 @@ def test_get_product_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_product_flattened_error(): @@ -2589,7 +2631,9 @@ async def test_get_product_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 @@ -2779,8 +2823,12 @@ def test_update_product_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].product == product_search_service.Product(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].product + mock_val = product_search_service.Product(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_product_flattened_error(): @@ -2821,8 +2869,12 @@ async def test_update_product_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].product == product_search_service.Product(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].product + mock_val = product_search_service.Product(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 @@ -2985,7 +3037,9 @@ def test_delete_product_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_product_flattened_error(): @@ -3019,7 +3073,9 @@ async def test_delete_product_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 @@ -3207,11 +3263,15 @@ def test_create_reference_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].reference_image == product_search_service.ReferenceImage( - name="name_value" - ) - assert args[0].reference_image_id == "reference_image_id_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].reference_image + mock_val = product_search_service.ReferenceImage(name="name_value") + assert arg == mock_val + arg = args[0].reference_image_id + mock_val = "reference_image_id_value" + assert arg == mock_val def test_create_reference_image_flattened_error(): @@ -3256,11 +3316,15 @@ async def test_create_reference_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].reference_image == product_search_service.ReferenceImage( - name="name_value" - ) - assert args[0].reference_image_id == "reference_image_id_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].reference_image + mock_val = product_search_service.ReferenceImage(name="name_value") + assert arg == mock_val + arg = args[0].reference_image_id + mock_val = "reference_image_id_value" + assert arg == mock_val @pytest.mark.asyncio @@ -3437,7 +3501,9 @@ def test_delete_reference_image_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_reference_image_flattened_error(): @@ -3473,7 +3539,9 @@ async def test_delete_reference_image_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 @@ -3659,7 +3727,9 @@ def test_list_reference_images_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_list_reference_images_flattened_error(): @@ -3697,7 +3767,9 @@ async def test_list_reference_images_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 @@ -4055,7 +4127,9 @@ def test_get_reference_image_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_reference_image_flattened_error(): @@ -4093,7 +4167,9 @@ async def test_get_reference_image_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 @@ -4269,8 +4345,12 @@ def test_add_product_to_product_set_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].product == "product_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].product + mock_val = "product_value" + assert arg == mock_val def test_add_product_to_product_set_flattened_error(): @@ -4310,8 +4390,12 @@ async def test_add_product_to_product_set_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].product == "product_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].product + mock_val = "product_value" + assert arg == mock_val @pytest.mark.asyncio @@ -4489,8 +4573,12 @@ def test_remove_product_from_product_set_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].product == "product_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].product + mock_val = "product_value" + assert arg == mock_val def test_remove_product_from_product_set_flattened_error(): @@ -4530,8 +4618,12 @@ async def test_remove_product_from_product_set_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].product == "product_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].product + mock_val = "product_value" + assert arg == mock_val @pytest.mark.asyncio @@ -4717,7 +4809,9 @@ def test_list_products_in_product_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_list_products_in_product_set_flattened_error(): @@ -4755,7 +4849,9 @@ async def test_list_products_in_product_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 @@ -5108,14 +5204,16 @@ def test_import_product_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 - ].input_config == product_search_service.ImportProductSetsInputConfig( + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].input_config + mock_val = product_search_service.ImportProductSetsInputConfig( gcs_source=product_search_service.ImportProductSetsGcsSource( csv_file_uri="csv_file_uri_value" ) ) + assert arg == mock_val def test_import_product_sets_flattened_error(): @@ -5166,14 +5264,16 @@ async def test_import_product_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 - ].input_config == product_search_service.ImportProductSetsInputConfig( + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].input_config + mock_val = product_search_service.ImportProductSetsInputConfig( gcs_source=product_search_service.ImportProductSetsGcsSource( csv_file_uri="csv_file_uri_value" ) ) + assert arg == mock_val @pytest.mark.asyncio diff --git a/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.py b/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.py index 813316f0..558be5c8 100644 --- a/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.py @@ -595,11 +595,13 @@ def test_batch_annotate_images_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AnnotateImageRequest( image=image_annotator.Image(content=b"content_blob") ) ] + assert arg == mock_val def test_batch_annotate_images_flattened_error(): @@ -648,11 +650,13 @@ async def test_batch_annotate_images_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AnnotateImageRequest( image=image_annotator.Image(content=b"content_blob") ) ] + assert arg == mock_val @pytest.mark.asyncio @@ -785,13 +789,15 @@ def test_batch_annotate_files_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AnnotateFileRequest( input_config=image_annotator.InputConfig( gcs_source=image_annotator.GcsSource(uri="uri_value") ) ) ] + assert arg == mock_val def test_batch_annotate_files_flattened_error(): @@ -844,13 +850,15 @@ async def test_batch_annotate_files_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AnnotateFileRequest( input_config=image_annotator.InputConfig( gcs_source=image_annotator.GcsSource(uri="uri_value") ) ) ] + assert arg == mock_val @pytest.mark.asyncio @@ -987,14 +995,18 @@ def test_async_batch_annotate_images_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AnnotateImageRequest( image=image_annotator.Image(content=b"content_blob") ) ] - assert args[0].output_config == image_annotator.OutputConfig( + assert arg == mock_val + arg = args[0].output_config + mock_val = image_annotator.OutputConfig( gcs_destination=image_annotator.GcsDestination(uri="uri_value") ) + assert arg == mock_val def test_async_batch_annotate_images_flattened_error(): @@ -1049,14 +1061,18 @@ async def test_async_batch_annotate_images_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AnnotateImageRequest( image=image_annotator.Image(content=b"content_blob") ) ] - assert args[0].output_config == image_annotator.OutputConfig( + assert arg == mock_val + arg = args[0].output_config + mock_val = image_annotator.OutputConfig( gcs_destination=image_annotator.GcsDestination(uri="uri_value") ) + assert arg == mock_val @pytest.mark.asyncio @@ -1192,13 +1208,15 @@ def test_async_batch_annotate_files_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AsyncAnnotateFileRequest( input_config=image_annotator.InputConfig( gcs_source=image_annotator.GcsSource(uri="uri_value") ) ) ] + assert arg == mock_val def test_async_batch_annotate_files_flattened_error(): @@ -1251,13 +1269,15 @@ async def test_async_batch_annotate_files_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].requests == [ + arg = args[0].requests + mock_val = [ image_annotator.AsyncAnnotateFileRequest( input_config=image_annotator.InputConfig( gcs_source=image_annotator.GcsSource(uri="uri_value") ) ) ] + assert arg == mock_val @pytest.mark.asyncio diff --git a/tests/unit/gapic/vision_v1p4beta1/test_product_search.py b/tests/unit/gapic/vision_v1p4beta1/test_product_search.py index a34ee76a..fafdeef8 100644 --- a/tests/unit/gapic/vision_v1p4beta1/test_product_search.py +++ b/tests/unit/gapic/vision_v1p4beta1/test_product_search.py @@ -660,11 +660,15 @@ def test_create_product_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].product_set == product_search_service.ProductSet( - name="name_value" - ) - assert args[0].product_set_id == "product_set_id_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].product_set + mock_val = product_search_service.ProductSet(name="name_value") + assert arg == mock_val + arg = args[0].product_set_id + mock_val = "product_set_id_value" + assert arg == mock_val def test_create_product_set_flattened_error(): @@ -709,11 +713,15 @@ async def test_create_product_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].product_set == product_search_service.ProductSet( - name="name_value" - ) - assert args[0].product_set_id == "product_set_id_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].product_set + mock_val = product_search_service.ProductSet(name="name_value") + assert arg == mock_val + arg = args[0].product_set_id + mock_val = "product_set_id_value" + assert arg == mock_val @pytest.mark.asyncio @@ -899,7 +907,9 @@ def test_list_product_sets_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_list_product_sets_flattened_error(): @@ -937,7 +947,9 @@ async def test_list_product_sets_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 @@ -1280,7 +1292,9 @@ def test_get_product_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_product_set_flattened_error(): @@ -1316,7 +1330,9 @@ async def test_get_product_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 @@ -1508,10 +1524,12 @@ def test_update_product_set_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].product_set == product_search_service.ProductSet( - name="name_value" - ) - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].product_set + mock_val = product_search_service.ProductSet(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_product_set_flattened_error(): @@ -1554,10 +1572,12 @@ async def test_update_product_set_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].product_set == product_search_service.ProductSet( - name="name_value" - ) - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].product_set + mock_val = product_search_service.ProductSet(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 @@ -1732,7 +1752,9 @@ def test_delete_product_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_product_set_flattened_error(): @@ -1768,7 +1790,9 @@ async def test_delete_product_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 @@ -1955,9 +1979,15 @@ def test_create_product_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].product == product_search_service.Product(name="name_value") - assert args[0].product_id == "product_id_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].product + mock_val = product_search_service.Product(name="name_value") + assert arg == mock_val + arg = args[0].product_id + mock_val = "product_id_value" + assert arg == mock_val def test_create_product_flattened_error(): @@ -2000,9 +2030,15 @@ async def test_create_product_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].product == product_search_service.Product(name="name_value") - assert args[0].product_id == "product_id_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].product + mock_val = product_search_service.Product(name="name_value") + assert arg == mock_val + arg = args[0].product_id + mock_val = "product_id_value" + assert arg == mock_val @pytest.mark.asyncio @@ -2176,7 +2212,9 @@ def test_list_products_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_list_products_flattened_error(): @@ -2212,7 +2250,9 @@ async def test_list_products_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 @@ -2553,7 +2593,9 @@ def test_get_product_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_product_flattened_error(): @@ -2589,7 +2631,9 @@ async def test_get_product_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 @@ -2779,8 +2823,12 @@ def test_update_product_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].product == product_search_service.Product(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].product + mock_val = product_search_service.Product(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_product_flattened_error(): @@ -2821,8 +2869,12 @@ async def test_update_product_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].product == product_search_service.Product(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].product + mock_val = product_search_service.Product(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 @@ -2985,7 +3037,9 @@ def test_delete_product_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_product_flattened_error(): @@ -3019,7 +3073,9 @@ async def test_delete_product_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 @@ -3207,11 +3263,15 @@ def test_create_reference_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].reference_image == product_search_service.ReferenceImage( - name="name_value" - ) - assert args[0].reference_image_id == "reference_image_id_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].reference_image + mock_val = product_search_service.ReferenceImage(name="name_value") + assert arg == mock_val + arg = args[0].reference_image_id + mock_val = "reference_image_id_value" + assert arg == mock_val def test_create_reference_image_flattened_error(): @@ -3256,11 +3316,15 @@ async def test_create_reference_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].reference_image == product_search_service.ReferenceImage( - name="name_value" - ) - assert args[0].reference_image_id == "reference_image_id_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].reference_image + mock_val = product_search_service.ReferenceImage(name="name_value") + assert arg == mock_val + arg = args[0].reference_image_id + mock_val = "reference_image_id_value" + assert arg == mock_val @pytest.mark.asyncio @@ -3437,7 +3501,9 @@ def test_delete_reference_image_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_reference_image_flattened_error(): @@ -3473,7 +3539,9 @@ async def test_delete_reference_image_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 @@ -3659,7 +3727,9 @@ def test_list_reference_images_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_list_reference_images_flattened_error(): @@ -3697,7 +3767,9 @@ async def test_list_reference_images_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 @@ -4055,7 +4127,9 @@ def test_get_reference_image_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_reference_image_flattened_error(): @@ -4093,7 +4167,9 @@ async def test_get_reference_image_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 @@ -4269,8 +4345,12 @@ def test_add_product_to_product_set_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].product == "product_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].product + mock_val = "product_value" + assert arg == mock_val def test_add_product_to_product_set_flattened_error(): @@ -4310,8 +4390,12 @@ async def test_add_product_to_product_set_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].product == "product_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].product + mock_val = "product_value" + assert arg == mock_val @pytest.mark.asyncio @@ -4489,8 +4573,12 @@ def test_remove_product_from_product_set_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].product == "product_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].product + mock_val = "product_value" + assert arg == mock_val def test_remove_product_from_product_set_flattened_error(): @@ -4530,8 +4618,12 @@ async def test_remove_product_from_product_set_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" - assert args[0].product == "product_value" + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + arg = args[0].product + mock_val = "product_value" + assert arg == mock_val @pytest.mark.asyncio @@ -4717,7 +4809,9 @@ def test_list_products_in_product_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_list_products_in_product_set_flattened_error(): @@ -4755,7 +4849,9 @@ async def test_list_products_in_product_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 @@ -5108,14 +5204,16 @@ def test_import_product_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 - ].input_config == product_search_service.ImportProductSetsInputConfig( + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].input_config + mock_val = product_search_service.ImportProductSetsInputConfig( gcs_source=product_search_service.ImportProductSetsGcsSource( csv_file_uri="csv_file_uri_value" ) ) + assert arg == mock_val def test_import_product_sets_flattened_error(): @@ -5166,14 +5264,16 @@ async def test_import_product_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 - ].input_config == product_search_service.ImportProductSetsInputConfig( + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].input_config + mock_val = product_search_service.ImportProductSetsInputConfig( gcs_source=product_search_service.ImportProductSetsGcsSource( csv_file_uri="csv_file_uri_value" ) ) + assert arg == mock_val @pytest.mark.asyncio @@ -5344,7 +5444,9 @@ def test_purge_products_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_purge_products_flattened_error(): @@ -5380,7 +5482,9 @@ async def test_purge_products_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 From 2882eaa123cb093789730fdc8ce84cfd0ba6390e Mon Sep 17 00:00:00 2001 From: Anthonios Partheniou Date: Thu, 11 Nov 2021 11:23:57 -0500 Subject: [PATCH 03/10] chore: assign googleapis/cdpe-cloudai as codeowner (#270) assign @googleapis/cdpe-cloudai as codeowner --- .repo-metadata.json | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/.repo-metadata.json b/.repo-metadata.json index 06c44beb..5098d5ce 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -1,14 +1,16 @@ { - "name": "vision", - "name_pretty": "Cloud Vision", - "product_documentation": "https://cloud.google.com/vision/docs/", - "client_documentation": "https://googleapis.dev/python/vision/latest", - "issue_tracker": "https://issuetracker.google.com/issues?q=status:open%20componentid:187174", - "release_level": "ga", - "language": "python", - "library_type": "GAPIC_COMBO", - "repo": "googleapis/python-vision", - "distribution_name": "google-cloud-vision", - "api_id": "vision.googleapis.com", - "requires_billing": false -} \ No newline at end of file + "name": "vision", + "name_pretty": "Cloud Vision", + "product_documentation": "https://cloud.google.com/vision/docs/", + "client_documentation": "https://googleapis.dev/python/vision/latest", + "issue_tracker": "https://issuetracker.google.com/issues?q=status:open%20componentid:187174", + "release_level": "ga", + "language": "python", + "library_type": "GAPIC_COMBO", + "repo": "googleapis/python-vision", + "distribution_name": "google-cloud-vision", + "api_id": "vision.googleapis.com", + "requires_billing": false, + "default_version": "v1", + "codeowner_team": "@googleapis/cdpe-cloudai" +} From b400180245e9857e85f194d39ec1c27e7ef296a6 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 18:44:55 -0500 Subject: [PATCH 04/10] chore(python): add .github/CODEOWNERS as a templated file (#271) 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 108063d4..7519fa3a 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 5900ab68..b26afefd 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 @telpirion @sirtorry @googleapis/python-samples-owners \ No newline at end of file +# @googleapis/python-samples-owners @googleapis/cdpe-cloudai are the default owners for samples changes +/samples/ @googleapis/python-samples-owners @googleapis/cdpe-cloudai From fc30dda4bb80f3c7672c67943595249daa02fa47 Mon Sep 17 00:00:00 2001 From: Dan Lee <71398022+dandhlee@users.noreply.github.com> Date: Tue, 16 Nov 2021 10:58:54 -0500 Subject: [PATCH 05/10] chore: update doc links from googleapis.dev to cloud.google.com (#273) --- .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 5098d5ce..d944e21a 100644 --- a/.repo-metadata.json +++ b/.repo-metadata.json @@ -2,7 +2,7 @@ "name": "vision", "name_pretty": "Cloud Vision", "product_documentation": "https://cloud.google.com/vision/docs/", - "client_documentation": "https://googleapis.dev/python/vision/latest", + "client_documentation": "https://cloud.google.com/python/docs/reference/vision/latest", "issue_tracker": "https://issuetracker.google.com/issues?q=status:open%20componentid:187174", "release_level": "ga", "language": "python", diff --git a/README.rst b/README.rst index 1866f216..7b676dc1 100644 --- a/README.rst +++ b/README.rst @@ -26,7 +26,7 @@ Storage. .. _Vision: https://cloud.google.com/vision/ .. _Google Cloud Vision: https://cloud.google.com/vision/ -.. _Client Library Documentation: https://googleapis.dev/python/vision/latest +.. _Client Library Documentation: https://cloud.google.com/python/docs/reference/vision/latest .. _Product Documentation: https://cloud.google.com/vision/reference/rest/ From 5a8062e12f8a419dfb62d91a5f79e94d6a3199e9 Mon Sep 17 00:00:00 2001 From: WhiteSource Renovate Date: Thu, 18 Nov 2021 19:01:48 +0100 Subject: [PATCH 06/10] chore(deps): update dependency google-cloud-storage to v1.43.0 (#274) --- samples/snippets/detect/requirements.txt | 2 +- samples/snippets/product_search/requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/snippets/detect/requirements.txt b/samples/snippets/detect/requirements.txt index 6a02ba03..a2085c26 100644 --- a/samples/snippets/detect/requirements.txt +++ b/samples/snippets/detect/requirements.txt @@ -1,2 +1,2 @@ google-cloud-vision==2.6.2 -google-cloud-storage==1.42.3 +google-cloud-storage==1.43.0 diff --git a/samples/snippets/product_search/requirements.txt b/samples/snippets/product_search/requirements.txt index 6a02ba03..a2085c26 100644 --- a/samples/snippets/product_search/requirements.txt +++ b/samples/snippets/product_search/requirements.txt @@ -1,2 +1,2 @@ google-cloud-vision==2.6.2 -google-cloud-storage==1.42.3 +google-cloud-storage==1.43.0 From b059f3a7b39a6f17c0086e18fc69776265de18d7 Mon Sep 17 00:00:00 2001 From: Karl Weinmeister <11586922+kweinmeister@users.noreply.github.com> Date: Thu, 18 Nov 2021 12:25:42 -0600 Subject: [PATCH 07/10] docs: Update doctext sample to include method signature (#275) * docs: update async_detect_document() sample * docs: Update doctext sample to include method signature Co-authored-by: Anthonios Partheniou --- samples/snippets/document_text/doctext.py | 45 ++++++++++++++--------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/samples/snippets/document_text/doctext.py b/samples/snippets/document_text/doctext.py index 1f7a5a84..6bfb2b90 100644 --- a/samples/snippets/document_text/doctext.py +++ b/samples/snippets/document_text/doctext.py @@ -43,22 +43,31 @@ def draw_boxes(image, bounds, color): draw = ImageDraw.Draw(image) for bound in bounds: - draw.polygon([ - bound.vertices[0].x, bound.vertices[0].y, - bound.vertices[1].x, bound.vertices[1].y, - bound.vertices[2].x, bound.vertices[2].y, - bound.vertices[3].x, bound.vertices[3].y], None, color) + draw.polygon( + [ + bound.vertices[0].x, + bound.vertices[0].y, + bound.vertices[1].x, + bound.vertices[1].y, + bound.vertices[2].x, + bound.vertices[2].y, + bound.vertices[3].x, + bound.vertices[3].y, + ], + None, + color, + ) return image +# [START vision_document_text_tutorial_detect_bounds] def get_document_bounds(image_file, feature): - # [START vision_document_text_tutorial_detect_bounds] """Returns document bounds given an image.""" client = vision.ImageAnnotatorClient() bounds = [] - with io.open(image_file, 'rb') as image_file: + with io.open(image_file, "rb") as image_file: content = image_file.read() image = vision.Image(content=content) @@ -72,31 +81,31 @@ def get_document_bounds(image_file, feature): for paragraph in block.paragraphs: for word in paragraph.words: for symbol in word.symbols: - if (feature == FeatureType.SYMBOL): + if feature == FeatureType.SYMBOL: bounds.append(symbol.bounding_box) - if (feature == FeatureType.WORD): + if feature == FeatureType.WORD: bounds.append(word.bounding_box) - if (feature == FeatureType.PARA): + if feature == FeatureType.PARA: bounds.append(paragraph.bounding_box) - if (feature == FeatureType.BLOCK): + if feature == FeatureType.BLOCK: bounds.append(block.bounding_box) # The list `bounds` contains the coordinates of the bounding boxes. - # [END vision_document_text_tutorial_detect_bounds] return bounds +# [END vision_document_text_tutorial_detect_bounds] def render_doc_text(filein, fileout): image = Image.open(filein) bounds = get_document_bounds(filein, FeatureType.BLOCK) - draw_boxes(image, bounds, 'blue') + draw_boxes(image, bounds, "blue") bounds = get_document_bounds(filein, FeatureType.PARA) - draw_boxes(image, bounds, 'red') + draw_boxes(image, bounds, "red") bounds = get_document_bounds(filein, FeatureType.WORD) - draw_boxes(image, bounds, 'yellow') + draw_boxes(image, bounds, "yellow") if fileout != 0: image.save(fileout) @@ -104,11 +113,11 @@ def render_doc_text(filein, fileout): image.show() -if __name__ == '__main__': +if __name__ == "__main__": # [START vision_document_text_tutorial_run_application] parser = argparse.ArgumentParser() - parser.add_argument('detect_file', help='The image for text detection.') - parser.add_argument('-out_file', help='Optional output file', default=0) + parser.add_argument("detect_file", help="The image for text detection.") + parser.add_argument("-out_file", help="Optional output file", default=0) args = parser.parse_args() render_doc_text(args.detect_file, args.out_file) From cf4dafe7c716c8091efd3bcc5a6fa5729c72fed3 Mon Sep 17 00:00:00 2001 From: Andrew Ferlitsch Date: Fri, 10 Dec 2021 15:04:16 -0800 Subject: [PATCH 08/10] docs: Add example of how to use max_results (#277) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [x] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/python-vision/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [x] Code coverage does not decrease (if any source code was changed) - [x] Appropriate docs were updated (if necessary) Fixes b/203493363 🦕 --- .../snippets/product_search/product_search.py | 29 +++++++++++++------ .../product_search/product_search_test.py | 5 ++-- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/samples/snippets/product_search/product_search.py b/samples/snippets/product_search/product_search.py index abfd5342..095f28e1 100755 --- a/samples/snippets/product_search/product_search.py +++ b/samples/snippets/product_search/product_search.py @@ -34,8 +34,14 @@ # [START vision_product_search_get_similar_products] def get_similar_products_file( - project_id, location, product_set_id, product_category, - file_path, filter): + project_id, + location, + product_set_id, + product_category, + file_path, + filter, + max_results +): """Search similar products to image. Args: project_id: Id of the project. @@ -44,10 +50,11 @@ def get_similar_products_file( product_category: Category of the product. file_path: Local file path of the image to be searched. filter: Condition to be applied on the labels. - Example for filter: (color = red OR color = blue) AND style = kids - It will search on all products with the following labels: - color:red AND style:kids - color:blue AND style:kids + Example for filter: (color = red OR color = blue) AND style = kids + It will search on all products with the following labels: + color:red AND style:kids + color:blue AND style:kids + max_results: The maximum number of results (matches) to return. If omitted, all results are returned. """ # product_search_client is needed only for its helper methods. product_search_client = vision.ProductSearchClient() @@ -73,7 +80,10 @@ def get_similar_products_file( # Search products similar to the image. response = image_annotator_client.product_search( - image, image_context=image_context) + image, + image_context=image_context, + max_results=max_results + ) index_time = response.product_search_results.index_time print('Product set index time: ') @@ -173,6 +183,7 @@ def get_similar_products_uri( parser.add_argument('--product_set_id') parser.add_argument('--product_category') parser.add_argument('--filter', default='') + parser.add_argument('--max_results', default='') get_similar_products_file_parser = subparsers.add_parser( 'get_similar_products_file', help=get_similar_products_file.__doc__) @@ -187,8 +198,8 @@ def get_similar_products_uri( if args.command == 'get_similar_products_file': get_similar_products_file( args.project_id, args.location, args.product_set_id, - args.product_category, args.file_path, args.filter) + args.product_category, args.file_path, args.filter, args.max_results) elif args.command == 'get_similar_products_uri': get_similar_products_uri( args.project_id, args.location, args.product_set_id, - args.product_category, args.image_uri, args.filter) + args.product_category, args.image_uri, args.filter, args.max_results) diff --git a/samples/snippets/product_search/product_search_test.py b/samples/snippets/product_search/product_search_test.py index 8f862fc2..c7d00998 100644 --- a/samples/snippets/product_search/product_search_test.py +++ b/samples/snippets/product_search/product_search_test.py @@ -30,13 +30,14 @@ FILE_PATH_1 = 'resources/shoes_1.jpg' IMAGE_URI_1 = 'gs://cloud-samples-data/vision/product_search/shoes_1.jpg' FILTER = 'style=womens' +MAX_RESULTS = 6 @pytest.mark.flaky(max_runs=5, min_passes=1) def test_get_similar_products_file(capsys): get_similar_products_file( PROJECT_ID, LOCATION, PRODUCT_SET_ID, PRODUCT_CATEGORY, FILE_PATH_1, - '') + '', MAX_RESULTS) out, _ = capsys.readouterr() assert PRODUCT_ID_1 in out assert PRODUCT_ID_2 in out @@ -54,7 +55,7 @@ def test_get_similar_products_uri(capsys): def test_get_similar_products_file_with_filter(capsys): get_similar_products_file( PROJECT_ID, LOCATION, PRODUCT_SET_ID, PRODUCT_CATEGORY, FILE_PATH_1, - FILTER) + FILTER, MAX_RESULTS) out, _ = capsys.readouterr() assert PRODUCT_ID_1 in out assert PRODUCT_ID_2 not in out From 350213013a0c48f54dc619984ba496adf3d9aca1 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Sun, 12 Dec 2021 12:03:16 -0500 Subject: [PATCH 09/10] chore: update python-docs-samples link to main branch (#278) Source-Link: https://github.com/googleapis/synthtool/commit/0941ef32b18aff0be34a40404f3971d9f51996e9 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:2f90537dd7df70f6b663cd654b1fa5dee483cf6a4edcfd46072b2775be8a23ec Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .github/.OwlBot.lock.yaml | 2 +- samples/AUTHORING_GUIDE.md | 2 +- samples/CONTRIBUTING.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 7519fa3a..0b3c8cd9 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:2f90537dd7df70f6b663cd654b1fa5dee483cf6a4edcfd46072b2775be8a23ec diff --git a/samples/AUTHORING_GUIDE.md b/samples/AUTHORING_GUIDE.md index 55c97b32..8249522f 100644 --- a/samples/AUTHORING_GUIDE.md +++ b/samples/AUTHORING_GUIDE.md @@ -1 +1 @@ -See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/AUTHORING_GUIDE.md \ No newline at end of file +See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/AUTHORING_GUIDE.md \ No newline at end of file diff --git a/samples/CONTRIBUTING.md b/samples/CONTRIBUTING.md index 34c882b6..f5fe2e6b 100644 --- a/samples/CONTRIBUTING.md +++ b/samples/CONTRIBUTING.md @@ -1 +1 @@ -See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/master/CONTRIBUTING.md \ No newline at end of file +See https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/CONTRIBUTING.md \ No newline at end of file From fefc8b1d30d4c431416b8ffc3ded5a90cd29472d Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Mon, 13 Dec 2021 10:28:17 +0000 Subject: [PATCH 10/10] chore: release 2.6.3 (#276) :robot: I have created a release \*beep\* \*boop\* --- ### [2.6.3](https://www.github.com/googleapis/python-vision/compare/v2.6.2...v2.6.3) (2021-12-12) ### Documentation * Add example of how to use max_results ([#277](https://www.github.com/googleapis/python-vision/issues/277)) ([cf4dafe](https://www.github.com/googleapis/python-vision/commit/cf4dafe7c716c8091efd3bcc5a6fa5729c72fed3)) * Update doctext sample to include method signature ([#275](https://www.github.com/googleapis/python-vision/issues/275)) ([b059f3a](https://www.github.com/googleapis/python-vision/commit/b059f3a7b39a6f17c0086e18fc69776265de18d7)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --- CHANGELOG.md | 8 ++++++++ setup.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e336fcf..1e3d59c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,14 @@ [1]: https://pypi.org/project/google-cloud-vision/#history +### [2.6.3](https://www.github.com/googleapis/python-vision/compare/v2.6.2...v2.6.3) (2021-12-12) + + +### Documentation + +* Add example of how to use max_results ([#277](https://www.github.com/googleapis/python-vision/issues/277)) ([cf4dafe](https://www.github.com/googleapis/python-vision/commit/cf4dafe7c716c8091efd3bcc5a6fa5729c72fed3)) +* Update doctext sample to include method signature ([#275](https://www.github.com/googleapis/python-vision/issues/275)) ([b059f3a](https://www.github.com/googleapis/python-vision/commit/b059f3a7b39a6f17c0086e18fc69776265de18d7)) + ### [2.6.2](https://www.github.com/googleapis/python-vision/compare/v2.6.1...v2.6.2) (2021-11-01) diff --git a/setup.py b/setup.py index 3ce3d956..3104ca07 100644 --- a/setup.py +++ b/setup.py @@ -19,7 +19,7 @@ name = "google-cloud-vision" description = "Cloud Vision API API client library" -version = "2.6.2" +version = "2.6.3" release_status = "Development Status :: 5 - Production/Stable" dependencies = [ # NOTE: Maintainers, please do not require google-api-core>=2.x.x