diff --git a/.flake8 b/.flake8 index 29227d4c..2e438749 100644 --- a/.flake8 +++ b/.flake8 @@ -16,7 +16,7 @@ # Generated by synthtool. DO NOT EDIT! [flake8] -ignore = E203, E266, E501, W503 +ignore = E203, E231, E266, E501, W503 exclude = # Exclude generated code. **/proto/** diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 44c78f7c..757c9dca 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,4 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:4e1991042fe54b991db9ca17c8fb386e61b22fe4d1472a568bf0fcac85dcf5d3 + digest: sha256:81ed5ecdfc7cac5b699ba4537376f3563f6f04122c4ec9e735d3b3dc1d43dd32 +# created: 2022-05-05T22:08:23.383410683Z diff --git a/.github/auto-approve.yml b/.github/auto-approve.yml new file mode 100644 index 00000000..311ebbb8 --- /dev/null +++ b/.github/auto-approve.yml @@ -0,0 +1,3 @@ +# https://github.com/googleapis/repo-automation-bots/tree/main/packages/auto-approve +processes: + - "OwlBotTemplateChanges" diff --git a/.github/auto-label.yaml b/.github/auto-label.yaml new file mode 100644 index 00000000..41bff0b5 --- /dev/null +++ b/.github/auto-label.yaml @@ -0,0 +1,15 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +requestsize: + enabled: true diff --git a/.github/release-please.yml b/.github/release-please.yml index 466597e5..29601ad4 100644 --- a/.github/release-please.yml +++ b/.github/release-please.yml @@ -1,2 +1,11 @@ releaseType: python handleGHRelease: true +# NOTE: this section is generated by synthtool.languages.python +# See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py +branches: +- branch: v1 + handleGHRelease: true + releaseType: python +- branch: v0 + handleGHRelease: true + releaseType: python diff --git a/.kokoro/docker/docs/Dockerfile b/.kokoro/docker/docs/Dockerfile index 4e1b1fb8..238b87b9 100644 --- a/.kokoro/docker/docs/Dockerfile +++ b/.kokoro/docker/docs/Dockerfile @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from ubuntu:20.04 +from ubuntu:22.04 ENV DEBIAN_FRONTEND noninteractive @@ -60,8 +60,24 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* \ && rm -f /var/cache/apt/archives/*.deb +###################### Install python 3.8.11 + +# Download python 3.8.11 +RUN wget https://www.python.org/ftp/python/3.8.11/Python-3.8.11.tgz + +# Extract files +RUN tar -xvf Python-3.8.11.tgz + +# Install python 3.8.11 +RUN ./Python-3.8.11/configure --enable-optimizations +RUN make altinstall + +###################### Install pip RUN wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && python3.8 /tmp/get-pip.py \ + && python3 /tmp/get-pip.py \ && rm /tmp/get-pip.py +# Test pip +RUN python3 -m pip + CMD ["python3.8"] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 62eb5a77..46d23716 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -22,7 +22,7 @@ repos: - id: end-of-file-fixer - id: check-yaml - repo: https://github.com/psf/black - rev: 19.10b0 + rev: 22.3.0 hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 diff --git a/CHANGELOG.md b/CHANGELOG.md index d60a6257..13bbf481 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,14 +4,26 @@ [1]: https://pypi.org/project/google-cloud-vision/#history -### [2.7.2](https://github.com/googleapis/python-vision/compare/v2.7.1...v2.7.2) (2022-03-25) +## [2.7.3](https://github.com/googleapis/python-vision/compare/v2.7.2...v2.7.3) (2022-06-06) + + +### Bug Fixes + +* **deps:** require protobuf <4.0.0dev ([#438](https://github.com/googleapis/python-vision/issues/438)) ([927e833](https://github.com/googleapis/python-vision/commit/927e8331c0825fbabb382942b3e0c1efd8bd7c11)) + + +### Documentation + +* fix changelog header to consistent size ([#439](https://github.com/googleapis/python-vision/issues/439)) ([e3bd56d](https://github.com/googleapis/python-vision/commit/e3bd56de3138830a931413d065ccc850b2e90a06)) + +## [2.7.2](https://github.com/googleapis/python-vision/compare/v2.7.1...v2.7.2) (2022-03-25) ### Documentation * fixed 'annotate an image' ([#330](https://github.com/googleapis/python-vision/issues/330)) ([1019f29](https://github.com/googleapis/python-vision/commit/1019f2920b065359306f654cf864d9f27a90cf9d)) -### [2.7.1](https://github.com/googleapis/python-vision/compare/v2.7.0...v2.7.1) (2022-03-05) +## [2.7.1](https://github.com/googleapis/python-vision/compare/v2.7.0...v2.7.1) (2022-03-05) ### Bug Fixes @@ -35,7 +47,7 @@ * add auto-generated samples ([#309](https://github.com/googleapis/python-vision/issues/309)) ([efc022d](https://github.com/googleapis/python-vision/commit/efc022d6b850dffbb621c066aa8fd1ff69cb0519)) -### [2.6.3](https://www.github.com/googleapis/python-vision/compare/v2.6.2...v2.6.3) (2021-12-12) +## [2.6.3](https://www.github.com/googleapis/python-vision/compare/v2.6.2...v2.6.3) (2021-12-12) ### Documentation @@ -43,7 +55,7 @@ * 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) +## [2.6.2](https://www.github.com/googleapis/python-vision/compare/v2.6.1...v2.6.2) (2021-11-01) ### Bug Fixes @@ -56,7 +68,7 @@ * list oneofs in docstring ([b6bf6ab](https://www.github.com/googleapis/python-vision/commit/b6bf6abb9114ffbf426ad3aca49d76190a421e3e)) -### [2.6.1](https://www.github.com/googleapis/python-vision/compare/v2.6.0...v2.6.1) (2021-10-26) +## [2.6.1](https://www.github.com/googleapis/python-vision/compare/v2.6.0...v2.6.1) (2021-10-26) ### Documentation @@ -82,21 +94,21 @@ * add context manager support in client ([#247](https://www.github.com/googleapis/python-vision/issues/247)) ([629365f](https://www.github.com/googleapis/python-vision/commit/629365f32d67bf3a6863615832e5443e185b8e3b)) -### [2.4.4](https://www.github.com/googleapis/python-vision/compare/v2.4.3...v2.4.4) (2021-09-30) +## [2.4.4](https://www.github.com/googleapis/python-vision/compare/v2.4.3...v2.4.4) (2021-09-30) ### Bug Fixes * improper types in pagers generation ([29b57f6](https://www.github.com/googleapis/python-vision/commit/29b57f6ef6506ba36c66e18d46781e6a15e872b2)) -### [2.4.3](https://www.github.com/googleapis/python-vision/compare/v2.4.2...v2.4.3) (2021-09-27) +## [2.4.3](https://www.github.com/googleapis/python-vision/compare/v2.4.2...v2.4.3) (2021-09-27) ### Bug Fixes * add 'dict' annotation type to 'request' ([87ad0ea](https://www.github.com/googleapis/python-vision/commit/87ad0eabbba08754320fd836c5e76fba48222b5c)) -### [2.4.2](https://www.github.com/googleapis/python-vision/compare/v2.4.1...v2.4.2) (2021-07-29) +## [2.4.2](https://www.github.com/googleapis/python-vision/compare/v2.4.1...v2.4.2) (2021-07-29) ### Bug Fixes @@ -113,7 +125,7 @@ * release as 2.4.2 ([#209](https://www.github.com/googleapis/python-vision/issues/209)) ([8d48b1b](https://www.github.com/googleapis/python-vision/commit/8d48b1b2284da8eff95190478292f5422d59a2f1)) -### [2.4.1](https://www.github.com/googleapis/python-vision/compare/v2.4.0...v2.4.1) (2021-07-21) +## [2.4.1](https://www.github.com/googleapis/python-vision/compare/v2.4.0...v2.4.1) (2021-07-21) ### Bug Fixes @@ -138,14 +150,14 @@ * omit mention of Python 2.7 in 'CONTRIBUTING.rst' ([#1127](https://www.github.com/googleapis/python-vision/issues/1127)) ([#161](https://www.github.com/googleapis/python-vision/issues/161)) ([78740ad](https://www.github.com/googleapis/python-vision/commit/78740ade95bf3eb7a2c613383e6ed602dfd1f1db)), closes [#1126](https://www.github.com/googleapis/python-vision/issues/1126) -### [2.3.2](https://www.github.com/googleapis/python-vision/compare/v2.3.1...v2.3.2) (2021-06-02) +## [2.3.2](https://www.github.com/googleapis/python-vision/compare/v2.3.1...v2.3.2) (2021-06-02) ### Bug Fixes * **deps:** add packaging requirement ([#147](https://www.github.com/googleapis/python-vision/issues/147)) ([41b88bd](https://www.github.com/googleapis/python-vision/commit/41b88bd482d4d6ec76fc6efc99aa9343496faf72)) -### [2.3.1](https://www.github.com/googleapis/python-vision/compare/v2.3.0...v2.3.1) (2021-04-13) +## [2.3.1](https://www.github.com/googleapis/python-vision/compare/v2.3.0...v2.3.1) (2021-04-13) ### Documentation diff --git a/docs/conf.py b/docs/conf.py index 107afc35..67093d16 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -314,7 +314,13 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - (root_doc, "google-cloud-vision", "google-cloud-vision Documentation", [author], 1,) + ( + root_doc, + "google-cloud-vision", + "google-cloud-vision Documentation", + [author], + 1, + ) ] # If true, show URL addresses after external links. @@ -355,7 +361,10 @@ intersphinx_mapping = { "python": ("https://python.readthedocs.org/en/latest/", None), "google-auth": ("https://googleapis.dev/python/google-auth/latest/", None), - "google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,), + "google.api_core": ( + "https://googleapis.dev/python/google-api-core/latest/", + None, + ), "grpc": ("https://grpc.github.io/grpc/python/", None), "proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None), "protobuf": ("https://googleapis.dev/python/protobuf/latest/", None), 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 f8f2191a..e5b69fb4 100644 --- a/google/cloud/vision_v1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1/services/image_annotator/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -221,21 +221,20 @@ async def batch_annotate_images( r"""Run image detection and annotation for a batch of images. - .. code-block:: python from google.cloud import vision_v1 - def sample_batch_annotate_images(): + async def sample_batch_annotate_images(): # Create a client - client = vision_v1.ImageAnnotatorClient() + client = vision_v1.ImageAnnotatorAsyncClient() # Initialize request argument(s) request = vision_v1.BatchAnnotateImagesRequest( ) # Make the request - response = client.batch_annotate_images(request=request) + response = await client.batch_annotate_images(request=request) # Handle the response print(response) @@ -299,7 +298,12 @@ def sample_batch_annotate_images(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -322,21 +326,20 @@ async def batch_annotate_files( perform detection and annotation for each image extracted. - .. code-block:: python from google.cloud import vision_v1 - def sample_batch_annotate_files(): + async def sample_batch_annotate_files(): # Create a client - client = vision_v1.ImageAnnotatorClient() + client = vision_v1.ImageAnnotatorAsyncClient() # Initialize request argument(s) request = vision_v1.BatchAnnotateFilesRequest( ) # Make the request - response = client.batch_annotate_files(request=request) + response = await client.batch_annotate_files(request=request) # Handle the response print(response) @@ -400,7 +403,12 @@ def sample_batch_annotate_files(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -428,14 +436,13 @@ async def async_batch_annotate_images( in customer GCS bucket, each json file containing BatchAnnotateImagesResponse proto. - .. code-block:: python from google.cloud import vision_v1 - def sample_async_batch_annotate_images(): + async def sample_async_batch_annotate_images(): # Create a client - client = vision_v1.ImageAnnotatorClient() + client = vision_v1.ImageAnnotatorAsyncClient() # Initialize request argument(s) request = vision_v1.AsyncBatchAnnotateImagesRequest( @@ -446,7 +453,7 @@ def sample_async_batch_annotate_images(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -522,7 +529,12 @@ def sample_async_batch_annotate_images(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -552,14 +564,13 @@ async def async_batch_annotate_files( (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` (results). - .. code-block:: python from google.cloud import vision_v1 - def sample_async_batch_annotate_files(): + async def sample_async_batch_annotate_files(): # Create a client - client = vision_v1.ImageAnnotatorClient() + client = vision_v1.ImageAnnotatorAsyncClient() # Initialize request argument(s) request = vision_v1.AsyncBatchAnnotateFilesRequest( @@ -570,7 +581,7 @@ def sample_async_batch_annotate_files(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -637,7 +648,12 @@ def sample_async_batch_annotate_files(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -659,7 +675,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/vision_v1/services/image_annotator/client.py b/google/cloud/vision_v1/services/image_annotator/client.py index 4a90a27d..9b7c44e8 100644 --- a/google/cloud/vision_v1/services/image_annotator/client.py +++ b/google/cloud/vision_v1/services/image_annotator/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -56,7 +56,10 @@ class ImageAnnotatorClientMeta(type): _transport_registry["grpc"] = ImageAnnotatorGrpcTransport _transport_registry["grpc_asyncio"] = ImageAnnotatorGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[ImageAnnotatorTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ImageAnnotatorTransport]: """Returns an appropriate transport class. Args: @@ -165,10 +168,16 @@ def transport(self) -> ImageAnnotatorTransport: return self._transport @staticmethod - def product_path(project: str, location: str, product: str,) -> str: + def product_path( + project: str, + location: str, + product: str, + ) -> str: """Returns a fully-qualified product string.""" return "projects/{project}/locations/{location}/products/{product}".format( - project=project, location=location, product=product, + project=project, + location=location, + product=product, ) @staticmethod @@ -181,10 +190,18 @@ def parse_product_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def product_set_path(project: str, location: str, product_set: str,) -> str: + def product_set_path( + project: str, + location: str, + product_set: str, + ) -> str: """Returns a fully-qualified product_set string.""" - return "projects/{project}/locations/{location}/productSets/{product_set}".format( - project=project, location=location, product_set=product_set, + return ( + "projects/{project}/locations/{location}/productSets/{product_set}".format( + project=project, + location=location, + product_set=product_set, + ) ) @staticmethod @@ -197,7 +214,9 @@ def parse_product_set_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -210,9 +229,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -221,9 +244,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -232,9 +259,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -243,10 +274,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -432,7 +467,6 @@ def batch_annotate_images( r"""Run image detection and annotation for a batch of images. - .. code-block:: python from google.cloud import vision_v1 @@ -503,7 +537,12 @@ def sample_batch_annotate_images(): rpc = self._transport._wrapped_methods[self._transport.batch_annotate_images] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -526,7 +565,6 @@ def batch_annotate_files( perform detection and annotation for each image extracted. - .. code-block:: python from google.cloud import vision_v1 @@ -597,7 +635,12 @@ def sample_batch_annotate_files(): rpc = self._transport._wrapped_methods[self._transport.batch_annotate_files] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -625,7 +668,6 @@ def async_batch_annotate_images( in customer GCS bucket, each json file containing BatchAnnotateImagesResponse proto. - .. code-block:: python from google.cloud import vision_v1 @@ -714,7 +756,12 @@ def sample_async_batch_annotate_images(): ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -744,7 +791,6 @@ def async_batch_annotate_files( (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` (results). - .. code-block:: python from google.cloud import vision_v1 @@ -824,7 +870,12 @@ def sample_async_batch_annotate_files(): ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -853,7 +904,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() 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 73affdfd..2b5433fd 100644 --- a/google/cloud/vision_v1/services/image_annotator/transports/base.py +++ b/google/cloud/vision_v1/services/image_annotator/transports/base.py @@ -31,7 +31,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -83,6 +85,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -188,9 +191,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -241,5 +244,9 @@ def async_batch_annotate_files( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("ImageAnnotatorTransport",) 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 fcf02b74..7bfc69dd 100644 --- a/google/cloud/vision_v1/services/image_annotator/transports/grpc.py +++ b/google/cloud/vision_v1/services/image_annotator/transports/grpc.py @@ -230,8 +230,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -390,5 +389,9 @@ def async_batch_annotate_files( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("ImageAnnotatorGrpcTransport",) 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 91e79755..97cbee53 100644 --- a/google/cloud/vision_v1/services/product_search/async_client.py +++ b/google/cloud/vision_v1/services/product_search/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -251,14 +251,13 @@ async def create_product_set( - Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters. - .. code-block:: python from google.cloud import vision_v1 - def sample_create_product_set(): + async def sample_create_product_set(): # Create a client - client = vision_v1.ProductSearchClient() + client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.CreateProductSetRequest( @@ -266,7 +265,7 @@ def sample_create_product_set(): ) # Make the request - response = client.create_product_set(request=request) + response = await client.create_product_set(request=request) # Handle the response print(response) @@ -357,7 +356,12 @@ def sample_create_product_set(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -378,14 +382,13 @@ async def list_product_sets( - Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1. - .. code-block:: python from google.cloud import vision_v1 - def sample_list_product_sets(): + async def sample_list_product_sets(): # Create a client - client = vision_v1.ProductSearchClient() + client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.ListProductSetsRequest( @@ -396,7 +399,7 @@ def sample_list_product_sets(): page_result = client.list_product_sets(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -468,12 +471,20 @@ def sample_list_product_sets(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListProductSetsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -494,14 +505,13 @@ async def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. - .. code-block:: python from google.cloud import vision_v1 - def sample_get_product_set(): + async def sample_get_product_set(): # Create a client - client = vision_v1.ProductSearchClient() + client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.GetProductSetRequest( @@ -509,7 +519,7 @@ def sample_get_product_set(): ) # Make the request - response = client.get_product_set(request=request) + response = await client.get_product_set(request=request) # Handle the response print(response) @@ -584,7 +594,12 @@ def sample_get_product_set(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -609,21 +624,20 @@ async def update_product_set( update_mask but missing from the request or longer than 4096 characters. - .. code-block:: python from google.cloud import vision_v1 - def sample_update_product_set(): + async def sample_update_product_set(): # Create a client - client = vision_v1.ProductSearchClient() + client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.UpdateProductSetRequest( ) # Make the request - response = client.update_product_set(request=request) + response = await client.update_product_set(request=request) # Handle the response print(response) @@ -709,7 +723,12 @@ def sample_update_product_set(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -728,14 +747,13 @@ async def delete_product_set( The actual image files are not deleted from Google Cloud Storage. - .. code-block:: python from google.cloud import vision_v1 - def sample_delete_product_set(): + async def sample_delete_product_set(): # Create a client - client = vision_v1.ProductSearchClient() + client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.DeleteProductSetRequest( @@ -743,7 +761,7 @@ def sample_delete_product_set(): ) # Make the request - client.delete_product_set(request=request) + await client.delete_product_set(request=request) Args: request (Union[google.cloud.vision_v1.types.DeleteProductSetRequest, dict]): @@ -807,7 +825,10 @@ def sample_delete_product_set(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def create_product( @@ -832,14 +853,13 @@ async def create_product( - Returns INVALID_ARGUMENT if product_category is missing or invalid. - .. code-block:: python from google.cloud import vision_v1 - def sample_create_product(): + async def sample_create_product(): # Create a client - client = vision_v1.ProductSearchClient() + client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.CreateProductRequest( @@ -847,7 +867,7 @@ def sample_create_product(): ) # Make the request - response = client.create_product(request=request) + response = await client.create_product(request=request) # Handle the response print(response) @@ -933,7 +953,12 @@ def sample_create_product(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -954,14 +979,13 @@ async def list_products( - Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. - .. code-block:: python from google.cloud import vision_v1 - def sample_list_products(): + async def sample_list_products(): # Create a client - client = vision_v1.ProductSearchClient() + client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.ListProductsRequest( @@ -972,7 +996,7 @@ def sample_list_products(): page_result = client.list_products(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -1044,12 +1068,20 @@ def sample_list_products(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListProductsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1070,14 +1102,13 @@ async def get_product( - Returns NOT_FOUND if the Product does not exist. - .. code-block:: python from google.cloud import vision_v1 - def sample_get_product(): + async def sample_get_product(): # Create a client - client = vision_v1.ProductSearchClient() + client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.GetProductRequest( @@ -1085,7 +1116,7 @@ def sample_get_product(): ) # Make the request - response = client.get_product(request=request) + response = await client.get_product(request=request) # Handle the response print(response) @@ -1155,7 +1186,12 @@ def sample_get_product(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1187,21 +1223,20 @@ async def update_product( - Returns INVALID_ARGUMENT if product_category is present in update_mask. - .. code-block:: python from google.cloud import vision_v1 - def sample_update_product(): + async def sample_update_product(): # Create a client - client = vision_v1.ProductSearchClient() + client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.UpdateProductRequest( ) # Make the request - response = client.update_product(request=request) + response = await client.update_product(request=request) # Handle the response print(response) @@ -1284,7 +1319,12 @@ def sample_update_product(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1305,14 +1345,13 @@ async def delete_product( ProductSets containing the product may still work until all related caches are refreshed. - .. code-block:: python from google.cloud import vision_v1 - def sample_delete_product(): + async def sample_delete_product(): # Create a client - client = vision_v1.ProductSearchClient() + client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.DeleteProductRequest( @@ -1320,7 +1359,7 @@ def sample_delete_product(): ) # Make the request - client.delete_product(request=request) + await client.delete_product(request=request) Args: request (Union[google.cloud.vision_v1.types.DeleteProductRequest, dict]): @@ -1384,7 +1423,10 @@ def sample_delete_product(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def create_reference_image( @@ -1421,14 +1463,13 @@ async def create_reference_image( - Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. - .. code-block:: python from google.cloud import vision_v1 - def sample_create_reference_image(): + async def sample_create_reference_image(): # Create a client - client = vision_v1.ProductSearchClient() + client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) reference_image = vision_v1.ReferenceImage() @@ -1440,7 +1481,7 @@ def sample_create_reference_image(): ) # Make the request - response = client.create_reference_image(request=request) + response = await client.create_reference_image(request=request) # Handle the response print(response) @@ -1532,7 +1573,12 @@ def sample_create_reference_image(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1554,14 +1600,13 @@ async def delete_reference_image( The actual image files are not deleted from Google Cloud Storage. - .. code-block:: python from google.cloud import vision_v1 - def sample_delete_reference_image(): + async def sample_delete_reference_image(): # Create a client - client = vision_v1.ProductSearchClient() + client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.DeleteReferenceImageRequest( @@ -1569,7 +1614,7 @@ def sample_delete_reference_image(): ) # Make the request - client.delete_reference_image(request=request) + await client.delete_reference_image(request=request) Args: request (Union[google.cloud.vision_v1.types.DeleteReferenceImageRequest, dict]): @@ -1634,7 +1679,10 @@ def sample_delete_reference_image(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def list_reference_images( @@ -1654,14 +1702,13 @@ async def list_reference_images( - Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1. - .. code-block:: python from google.cloud import vision_v1 - def sample_list_reference_images(): + async def sample_list_reference_images(): # Create a client - client = vision_v1.ProductSearchClient() + client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.ListReferenceImagesRequest( @@ -1672,7 +1719,7 @@ def sample_list_reference_images(): page_result = client.list_reference_images(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -1745,12 +1792,20 @@ def sample_list_reference_images(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListReferenceImagesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1771,14 +1826,13 @@ async def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. - .. code-block:: python from google.cloud import vision_v1 - def sample_get_reference_image(): + async def sample_get_reference_image(): # Create a client - client = vision_v1.ProductSearchClient() + client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.GetReferenceImageRequest( @@ -1786,7 +1840,7 @@ def sample_get_reference_image(): ) # Make the request - response = client.get_reference_image(request=request) + response = await client.get_reference_image(request=request) # Handle the response print(response) @@ -1859,7 +1913,12 @@ def sample_get_reference_image(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1886,14 +1945,13 @@ async def add_product_to_product_set( - Returns NOT_FOUND if the Product or the ProductSet doesn't exist. - .. code-block:: python from google.cloud import vision_v1 - def sample_add_product_to_product_set(): + async def sample_add_product_to_product_set(): # Create a client - client = vision_v1.ProductSearchClient() + client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.AddProductToProductSetRequest( @@ -1902,7 +1960,7 @@ def sample_add_product_to_product_set(): ) # Make the request - client.add_product_to_product_set(request=request) + await client.add_product_to_product_set(request=request) Args: request (Union[google.cloud.vision_v1.types.AddProductToProductSetRequest, dict]): @@ -1979,7 +2037,10 @@ def sample_add_product_to_product_set(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def remove_product_from_product_set( @@ -2000,9 +2061,9 @@ async def remove_product_from_product_set( from google.cloud import vision_v1 - def sample_remove_product_from_product_set(): + async def sample_remove_product_from_product_set(): # Create a client - client = vision_v1.ProductSearchClient() + client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.RemoveProductFromProductSetRequest( @@ -2011,7 +2072,7 @@ def sample_remove_product_from_product_set(): ) # Make the request - client.remove_product_from_product_set(request=request) + await client.remove_product_from_product_set(request=request) Args: request (Union[google.cloud.vision_v1.types.RemoveProductFromProductSetRequest, dict]): @@ -2088,7 +2149,10 @@ def sample_remove_product_from_product_set(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def list_products_in_product_set( @@ -2111,14 +2175,13 @@ async def list_products_in_product_set( - Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. - .. code-block:: python from google.cloud import vision_v1 - def sample_list_products_in_product_set(): + async def sample_list_products_in_product_set(): # Create a client - client = vision_v1.ProductSearchClient() + client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.ListProductsInProductSetRequest( @@ -2129,7 +2192,7 @@ def sample_list_products_in_product_set(): page_result = client.list_products_in_product_set(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -2203,12 +2266,20 @@ def sample_list_products_in_product_set(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListProductsInProductSetAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -2237,14 +2308,13 @@ async def import_product_sets( Storage. For the format of the csv file please see [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri]. - .. code-block:: python from google.cloud import vision_v1 - def sample_import_product_sets(): + async def sample_import_product_sets(): # Create a client - client = vision_v1.ProductSearchClient() + client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.ImportProductSetsRequest( @@ -2256,7 +2326,7 @@ def sample_import_product_sets(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -2343,7 +2413,12 @@ def sample_import_product_sets(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -2393,14 +2468,13 @@ async def purge_products( request. ``Operation.metadata`` contains ``BatchOperationMetadata``. (progress) - .. code-block:: python from google.cloud import vision_v1 - def sample_purge_products(): + async def sample_purge_products(): # Create a client - client = vision_v1.ProductSearchClient() + client = vision_v1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1.PurgeProductsRequest( @@ -2412,7 +2486,7 @@ def sample_purge_products(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -2494,7 +2568,12 @@ def sample_purge_products(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -2516,7 +2595,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/vision_v1/services/product_search/client.py b/google/cloud/vision_v1/services/product_search/client.py index 7e1d0966..7a75d565 100644 --- a/google/cloud/vision_v1/services/product_search/client.py +++ b/google/cloud/vision_v1/services/product_search/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -60,7 +60,10 @@ class ProductSearchClientMeta(type): _transport_registry["grpc"] = ProductSearchGrpcTransport _transport_registry["grpc_asyncio"] = ProductSearchGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[ProductSearchTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ProductSearchTransport]: """Returns an appropriate transport class. Args: @@ -183,10 +186,16 @@ def transport(self) -> ProductSearchTransport: return self._transport @staticmethod - def product_path(project: str, location: str, product: str,) -> str: + def product_path( + project: str, + location: str, + product: str, + ) -> str: """Returns a fully-qualified product string.""" return "projects/{project}/locations/{location}/products/{product}".format( - project=project, location=location, product=product, + project=project, + location=location, + product=product, ) @staticmethod @@ -199,10 +208,18 @@ def parse_product_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def product_set_path(project: str, location: str, product_set: str,) -> str: + def product_set_path( + project: str, + location: str, + product_set: str, + ) -> str: """Returns a fully-qualified product_set string.""" - return "projects/{project}/locations/{location}/productSets/{product_set}".format( - project=project, location=location, product_set=product_set, + return ( + "projects/{project}/locations/{location}/productSets/{product_set}".format( + project=project, + location=location, + product_set=product_set, + ) ) @staticmethod @@ -216,7 +233,10 @@ def parse_product_set_path(path: str) -> Dict[str, str]: @staticmethod def reference_image_path( - project: str, location: str, product: str, reference_image: str, + project: str, + location: str, + product: str, + reference_image: str, ) -> str: """Returns a fully-qualified reference_image string.""" return "projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}".format( @@ -236,7 +256,9 @@ def parse_reference_image_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -249,9 +271,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -260,9 +286,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -271,9 +301,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -282,10 +316,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -477,7 +515,6 @@ def create_product_set( - Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters. - .. code-block:: python from google.cloud import vision_v1 @@ -576,7 +613,12 @@ def sample_create_product_set(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -597,7 +639,6 @@ def list_product_sets( - Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1. - .. code-block:: python from google.cloud import vision_v1 @@ -677,12 +718,20 @@ def sample_list_product_sets(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListProductSetsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -703,7 +752,6 @@ def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. - .. code-block:: python from google.cloud import vision_v1 @@ -783,7 +831,12 @@ def sample_get_product_set(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -808,7 +861,6 @@ def update_product_set( update_mask but missing from the request or longer than 4096 characters. - .. code-block:: python from google.cloud import vision_v1 @@ -898,7 +950,12 @@ def sample_update_product_set(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -917,7 +974,6 @@ def delete_product_set( The actual image files are not deleted from Google Cloud Storage. - .. code-block:: python from google.cloud import vision_v1 @@ -986,7 +1042,10 @@ def sample_delete_product_set(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def create_product( @@ -1011,7 +1070,6 @@ def create_product( - Returns INVALID_ARGUMENT if product_category is missing or invalid. - .. code-block:: python from google.cloud import vision_v1 @@ -1105,7 +1163,12 @@ def sample_create_product(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1126,7 +1189,6 @@ def list_products( - Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. - .. code-block:: python from google.cloud import vision_v1 @@ -1206,12 +1268,20 @@ def sample_list_products(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListProductsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1232,7 +1302,6 @@ def get_product( - Returns NOT_FOUND if the Product does not exist. - .. code-block:: python from google.cloud import vision_v1 @@ -1307,7 +1376,12 @@ def sample_get_product(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1339,7 +1413,6 @@ def update_product( - Returns INVALID_ARGUMENT if product_category is present in update_mask. - .. code-block:: python from google.cloud import vision_v1 @@ -1426,7 +1499,12 @@ def sample_update_product(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1447,7 +1525,6 @@ def delete_product( ProductSets containing the product may still work until all related caches are refreshed. - .. code-block:: python from google.cloud import vision_v1 @@ -1516,7 +1593,10 @@ def sample_delete_product(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def create_reference_image( @@ -1553,7 +1633,6 @@ def create_reference_image( - Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. - .. code-block:: python from google.cloud import vision_v1 @@ -1657,7 +1736,12 @@ def sample_create_reference_image(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1679,7 +1763,6 @@ def delete_reference_image( The actual image files are not deleted from Google Cloud Storage. - .. code-block:: python from google.cloud import vision_v1 @@ -1749,7 +1832,10 @@ def sample_delete_reference_image(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def list_reference_images( @@ -1769,7 +1855,6 @@ def list_reference_images( - Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1. - .. code-block:: python from google.cloud import vision_v1 @@ -1850,12 +1935,20 @@ def sample_list_reference_images(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListReferenceImagesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1876,7 +1969,6 @@ def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. - .. code-block:: python from google.cloud import vision_v1 @@ -1954,7 +2046,12 @@ def sample_get_reference_image(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1981,7 +2078,6 @@ def add_product_to_product_set( - Returns NOT_FOUND if the Product or the ProductSet doesn't exist. - .. code-block:: python from google.cloud import vision_v1 @@ -2068,7 +2164,10 @@ def sample_add_product_to_product_set(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def remove_product_from_product_set( @@ -2171,7 +2270,10 @@ def sample_remove_product_from_product_set(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def list_products_in_product_set( @@ -2194,7 +2296,6 @@ def list_products_in_product_set( - Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. - .. code-block:: python from google.cloud import vision_v1 @@ -2280,12 +2381,20 @@ def sample_list_products_in_product_set(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListProductsInProductSetPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -2314,7 +2423,6 @@ def import_product_sets( Storage. For the format of the csv file please see [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri]. - .. code-block:: python from google.cloud import vision_v1 @@ -2413,7 +2521,12 @@ def sample_import_product_sets(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -2463,7 +2576,6 @@ def purge_products( request. ``Operation.metadata`` contains ``BatchOperationMetadata``. (progress) - .. code-block:: python from google.cloud import vision_v1 @@ -2557,7 +2669,12 @@ def sample_purge_products(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -2586,7 +2703,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() 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 128571c9..9a1416e3 100644 --- a/google/cloud/vision_v1/services/product_search/transports/base.py +++ b/google/cloud/vision_v1/services/product_search/transports/base.py @@ -32,7 +32,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -84,6 +86,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -399,9 +402,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -614,5 +617,9 @@ def purge_products( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("ProductSearchTransport",) 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 9df85193..26b26c84 100644 --- a/google/cloud/vision_v1/services/product_search/transports/grpc.py +++ b/google/cloud/vision_v1/services/product_search/transports/grpc.py @@ -245,8 +245,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -957,5 +956,9 @@ def purge_products( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("ProductSearchGrpcTransport",) diff --git a/google/cloud/vision_v1/types/__init__.py b/google/cloud/vision_v1/types/__init__.py index 123c02e5..ab5344f6 100644 --- a/google/cloud/vision_v1/types/__init__.py +++ b/google/cloud/vision_v1/types/__init__.py @@ -106,7 +106,9 @@ TextAnnotation, Word, ) -from .web_detection import WebDetection +from .web_detection import ( + WebDetection, +) __all__ = ( "BoundingPoly", diff --git a/google/cloud/vision_v1/types/geometry.py b/google/cloud/vision_v1/types/geometry.py index 7fa5fbef..f03e3551 100644 --- a/google/cloud/vision_v1/types/geometry.py +++ b/google/cloud/vision_v1/types/geometry.py @@ -18,7 +18,12 @@ __protobuf__ = proto.module( package="google.cloud.vision.v1", - manifest={"Vertex", "NormalizedVertex", "BoundingPoly", "Position",}, + manifest={ + "Vertex", + "NormalizedVertex", + "BoundingPoly", + "Position", + }, ) @@ -34,8 +39,14 @@ class Vertex(proto.Message): Y coordinate. """ - x = proto.Field(proto.INT32, number=1,) - y = proto.Field(proto.INT32, number=2,) + x = proto.Field( + proto.INT32, + number=1, + ) + y = proto.Field( + proto.INT32, + number=2, + ) class NormalizedVertex(proto.Message): @@ -50,8 +61,14 @@ class NormalizedVertex(proto.Message): Y coordinate. """ - x = proto.Field(proto.FLOAT, number=1,) - y = proto.Field(proto.FLOAT, number=2,) + x = proto.Field( + proto.FLOAT, + number=1, + ) + y = proto.Field( + proto.FLOAT, + number=2, + ) class BoundingPoly(proto.Message): @@ -64,9 +81,15 @@ class BoundingPoly(proto.Message): The bounding polygon normalized vertices. """ - vertices = proto.RepeatedField(proto.MESSAGE, number=1, message="Vertex",) + vertices = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Vertex", + ) normalized_vertices = proto.RepeatedField( - proto.MESSAGE, number=2, message="NormalizedVertex", + proto.MESSAGE, + number=2, + message="NormalizedVertex", ) @@ -85,9 +108,18 @@ class Position(proto.Message): Z coordinate (or depth). """ - x = proto.Field(proto.FLOAT, number=1,) - y = proto.Field(proto.FLOAT, number=2,) - z = proto.Field(proto.FLOAT, number=3,) + x = proto.Field( + proto.FLOAT, + number=1, + ) + y = proto.Field( + proto.FLOAT, + number=2, + ) + z = proto.Field( + proto.FLOAT, + number=3, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/vision_v1/types/image_annotator.py b/google/cloud/vision_v1/types/image_annotator.py index bd5f9230..cb355d93 100644 --- a/google/cloud/vision_v1/types/image_annotator.py +++ b/google/cloud/vision_v1/types/image_annotator.py @@ -118,9 +118,19 @@ class Type(proto.Enum): PRODUCT_SEARCH = 12 OBJECT_LOCALIZATION = 19 - type_ = proto.Field(proto.ENUM, number=1, enum=Type,) - max_results = proto.Field(proto.INT32, number=2,) - model = proto.Field(proto.STRING, number=3,) + type_ = proto.Field( + proto.ENUM, + number=1, + enum=Type, + ) + max_results = proto.Field( + proto.INT32, + number=2, + ) + model = proto.Field( + proto.STRING, + number=3, + ) class ImageSource(proto.Message): @@ -158,8 +168,14 @@ class ImageSource(proto.Message): ``image_uri`` takes precedence. """ - gcs_image_uri = proto.Field(proto.STRING, number=1,) - image_uri = proto.Field(proto.STRING, number=2,) + gcs_image_uri = proto.Field( + proto.STRING, + number=1, + ) + image_uri = proto.Field( + proto.STRING, + number=2, + ) class Image(proto.Message): @@ -181,8 +197,15 @@ class Image(proto.Message): perform the image annotation request. """ - content = proto.Field(proto.BYTES, number=1,) - source = proto.Field(proto.MESSAGE, number=2, message="ImageSource",) + content = proto.Field( + proto.BYTES, + number=1, + ) + source = proto.Field( + proto.MESSAGE, + number=2, + message="ImageSource", + ) class FaceAnnotation(proto.Message): @@ -295,26 +318,87 @@ class Type(proto.Enum): LEFT_CHEEK_CENTER = 35 RIGHT_CHEEK_CENTER = 36 - type_ = proto.Field(proto.ENUM, number=3, enum="FaceAnnotation.Landmark.Type",) - position = proto.Field(proto.MESSAGE, number=4, message=geometry.Position,) - - bounding_poly = proto.Field(proto.MESSAGE, number=1, message=geometry.BoundingPoly,) + type_ = proto.Field( + proto.ENUM, + number=3, + enum="FaceAnnotation.Landmark.Type", + ) + position = proto.Field( + proto.MESSAGE, + number=4, + message=geometry.Position, + ) + + bounding_poly = proto.Field( + proto.MESSAGE, + number=1, + message=geometry.BoundingPoly, + ) fd_bounding_poly = proto.Field( - proto.MESSAGE, number=2, message=geometry.BoundingPoly, - ) - landmarks = proto.RepeatedField(proto.MESSAGE, number=3, message=Landmark,) - roll_angle = proto.Field(proto.FLOAT, number=4,) - pan_angle = proto.Field(proto.FLOAT, number=5,) - tilt_angle = proto.Field(proto.FLOAT, number=6,) - detection_confidence = proto.Field(proto.FLOAT, number=7,) - landmarking_confidence = proto.Field(proto.FLOAT, number=8,) - joy_likelihood = proto.Field(proto.ENUM, number=9, enum="Likelihood",) - sorrow_likelihood = proto.Field(proto.ENUM, number=10, enum="Likelihood",) - anger_likelihood = proto.Field(proto.ENUM, number=11, enum="Likelihood",) - surprise_likelihood = proto.Field(proto.ENUM, number=12, enum="Likelihood",) - under_exposed_likelihood = proto.Field(proto.ENUM, number=13, enum="Likelihood",) - blurred_likelihood = proto.Field(proto.ENUM, number=14, enum="Likelihood",) - headwear_likelihood = proto.Field(proto.ENUM, number=15, enum="Likelihood",) + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + landmarks = proto.RepeatedField( + proto.MESSAGE, + number=3, + message=Landmark, + ) + roll_angle = proto.Field( + proto.FLOAT, + number=4, + ) + pan_angle = proto.Field( + proto.FLOAT, + number=5, + ) + tilt_angle = proto.Field( + proto.FLOAT, + number=6, + ) + detection_confidence = proto.Field( + proto.FLOAT, + number=7, + ) + landmarking_confidence = proto.Field( + proto.FLOAT, + number=8, + ) + joy_likelihood = proto.Field( + proto.ENUM, + number=9, + enum="Likelihood", + ) + sorrow_likelihood = proto.Field( + proto.ENUM, + number=10, + enum="Likelihood", + ) + anger_likelihood = proto.Field( + proto.ENUM, + number=11, + enum="Likelihood", + ) + surprise_likelihood = proto.Field( + proto.ENUM, + number=12, + enum="Likelihood", + ) + under_exposed_likelihood = proto.Field( + proto.ENUM, + number=13, + enum="Likelihood", + ) + blurred_likelihood = proto.Field( + proto.ENUM, + number=14, + enum="Likelihood", + ) + headwear_likelihood = proto.Field( + proto.ENUM, + number=15, + enum="Likelihood", + ) class LocationInfo(proto.Message): @@ -325,7 +409,11 @@ class LocationInfo(proto.Message): lat/long location coordinates. """ - lat_lng = proto.Field(proto.MESSAGE, number=1, message=latlng_pb2.LatLng,) + lat_lng = proto.Field( + proto.MESSAGE, + number=1, + message=latlng_pb2.LatLng, + ) class Property(proto.Message): @@ -340,9 +428,18 @@ class Property(proto.Message): Value of numeric properties. """ - name = proto.Field(proto.STRING, number=1,) - value = proto.Field(proto.STRING, number=2,) - uint64_value = proto.Field(proto.UINT64, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + value = proto.Field( + proto.STRING, + number=2, + ) + uint64_value = proto.Field( + proto.UINT64, + number=3, + ) class EntityAnnotation(proto.Message): @@ -390,15 +487,45 @@ class EntityAnnotation(proto.Message): the entity. """ - mid = proto.Field(proto.STRING, number=1,) - locale = proto.Field(proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) - score = proto.Field(proto.FLOAT, number=4,) - confidence = proto.Field(proto.FLOAT, number=5,) - topicality = proto.Field(proto.FLOAT, number=6,) - bounding_poly = proto.Field(proto.MESSAGE, number=7, message=geometry.BoundingPoly,) - locations = proto.RepeatedField(proto.MESSAGE, number=8, message="LocationInfo",) - properties = proto.RepeatedField(proto.MESSAGE, number=9, message="Property",) + mid = proto.Field( + proto.STRING, + number=1, + ) + locale = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) + score = proto.Field( + proto.FLOAT, + number=4, + ) + confidence = proto.Field( + proto.FLOAT, + number=5, + ) + topicality = proto.Field( + proto.FLOAT, + number=6, + ) + bounding_poly = proto.Field( + proto.MESSAGE, + number=7, + message=geometry.BoundingPoly, + ) + locations = proto.RepeatedField( + proto.MESSAGE, + number=8, + message="LocationInfo", + ) + properties = proto.RepeatedField( + proto.MESSAGE, + number=9, + message="Property", + ) class LocalizedObjectAnnotation(proto.Message): @@ -421,11 +548,27 @@ class LocalizedObjectAnnotation(proto.Message): This must be populated. """ - mid = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) - name = proto.Field(proto.STRING, number=3,) - score = proto.Field(proto.FLOAT, number=4,) - bounding_poly = proto.Field(proto.MESSAGE, number=5, message=geometry.BoundingPoly,) + mid = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) + name = proto.Field( + proto.STRING, + number=3, + ) + score = proto.Field( + proto.FLOAT, + number=4, + ) + bounding_poly = proto.Field( + proto.MESSAGE, + number=5, + message=geometry.BoundingPoly, + ) class SafeSearchAnnotation(proto.Message): @@ -475,17 +618,55 @@ class SafeSearchAnnotation(proto.Message): confident, 1 means very confident. """ - adult = proto.Field(proto.ENUM, number=1, enum="Likelihood",) - spoof = proto.Field(proto.ENUM, number=2, enum="Likelihood",) - medical = proto.Field(proto.ENUM, number=3, enum="Likelihood",) - violence = proto.Field(proto.ENUM, number=4, enum="Likelihood",) - racy = proto.Field(proto.ENUM, number=9, enum="Likelihood",) - adult_confidence = proto.Field(proto.FLOAT, number=16,) - spoof_confidence = proto.Field(proto.FLOAT, number=18,) - medical_confidence = proto.Field(proto.FLOAT, number=20,) - violence_confidence = proto.Field(proto.FLOAT, number=22,) - racy_confidence = proto.Field(proto.FLOAT, number=24,) - nsfw_confidence = proto.Field(proto.FLOAT, number=26,) + adult = proto.Field( + proto.ENUM, + number=1, + enum="Likelihood", + ) + spoof = proto.Field( + proto.ENUM, + number=2, + enum="Likelihood", + ) + medical = proto.Field( + proto.ENUM, + number=3, + enum="Likelihood", + ) + violence = proto.Field( + proto.ENUM, + number=4, + enum="Likelihood", + ) + racy = proto.Field( + proto.ENUM, + number=9, + enum="Likelihood", + ) + adult_confidence = proto.Field( + proto.FLOAT, + number=16, + ) + spoof_confidence = proto.Field( + proto.FLOAT, + number=18, + ) + medical_confidence = proto.Field( + proto.FLOAT, + number=20, + ) + violence_confidence = proto.Field( + proto.FLOAT, + number=22, + ) + racy_confidence = proto.Field( + proto.FLOAT, + number=24, + ) + nsfw_confidence = proto.Field( + proto.FLOAT, + number=26, + ) class LatLongRect(proto.Message): @@ -498,8 +679,16 @@ class LatLongRect(proto.Message): Max lat/long pair. """ - min_lat_lng = proto.Field(proto.MESSAGE, number=1, message=latlng_pb2.LatLng,) - max_lat_lng = proto.Field(proto.MESSAGE, number=2, message=latlng_pb2.LatLng,) + min_lat_lng = proto.Field( + proto.MESSAGE, + number=1, + message=latlng_pb2.LatLng, + ) + max_lat_lng = proto.Field( + proto.MESSAGE, + number=2, + message=latlng_pb2.LatLng, + ) class ColorInfo(proto.Message): @@ -516,9 +705,19 @@ class ColorInfo(proto.Message): Value in range [0, 1]. """ - color = proto.Field(proto.MESSAGE, number=1, message=color_pb2.Color,) - score = proto.Field(proto.FLOAT, number=2,) - pixel_fraction = proto.Field(proto.FLOAT, number=3,) + color = proto.Field( + proto.MESSAGE, + number=1, + message=color_pb2.Color, + ) + score = proto.Field( + proto.FLOAT, + number=2, + ) + pixel_fraction = proto.Field( + proto.FLOAT, + number=3, + ) class DominantColorsAnnotation(proto.Message): @@ -530,7 +729,11 @@ class DominantColorsAnnotation(proto.Message): fraction. """ - colors = proto.RepeatedField(proto.MESSAGE, number=1, message="ColorInfo",) + colors = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="ColorInfo", + ) class ImageProperties(proto.Message): @@ -543,7 +746,9 @@ class ImageProperties(proto.Message): """ dominant_colors = proto.Field( - proto.MESSAGE, number=1, message="DominantColorsAnnotation", + proto.MESSAGE, + number=1, + message="DominantColorsAnnotation", ) @@ -563,9 +768,19 @@ class CropHint(proto.Message): with respect to the original image. """ - bounding_poly = proto.Field(proto.MESSAGE, number=1, message=geometry.BoundingPoly,) - confidence = proto.Field(proto.FLOAT, number=2,) - importance_fraction = proto.Field(proto.FLOAT, number=3,) + bounding_poly = proto.Field( + proto.MESSAGE, + number=1, + message=geometry.BoundingPoly, + ) + confidence = proto.Field( + proto.FLOAT, + number=2, + ) + importance_fraction = proto.Field( + proto.FLOAT, + number=3, + ) class CropHintsAnnotation(proto.Message): @@ -577,7 +792,11 @@ class CropHintsAnnotation(proto.Message): Crop hint results. """ - crop_hints = proto.RepeatedField(proto.MESSAGE, number=1, message="CropHint",) + crop_hints = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="CropHint", + ) class CropHintsParams(proto.Message): @@ -595,7 +814,10 @@ class CropHintsParams(proto.Message): provided after the 16th are ignored. """ - aspect_ratios = proto.RepeatedField(proto.FLOAT, number=1,) + aspect_ratios = proto.RepeatedField( + proto.FLOAT, + number=1, + ) class WebDetectionParams(proto.Message): @@ -607,7 +829,10 @@ class WebDetectionParams(proto.Message): geo information in the image. """ - include_geo_results = proto.Field(proto.BOOL, number=2,) + include_geo_results = proto.Field( + proto.BOOL, + number=2, + ) class TextDetectionParams(proto.Message): @@ -621,7 +846,10 @@ class TextDetectionParams(proto.Message): include confidence score for TEXT_DETECTION as well. """ - enable_text_detection_confidence_score = proto.Field(proto.BOOL, number=9,) + enable_text_detection_confidence_score = proto.Field( + proto.BOOL, + number=9, + ) class ImageContext(proto.Message): @@ -652,17 +880,34 @@ class ImageContext(proto.Message): text detection. """ - lat_long_rect = proto.Field(proto.MESSAGE, number=1, message="LatLongRect",) - language_hints = proto.RepeatedField(proto.STRING, number=2,) - crop_hints_params = proto.Field(proto.MESSAGE, number=4, message="CropHintsParams",) + lat_long_rect = proto.Field( + proto.MESSAGE, + number=1, + message="LatLongRect", + ) + language_hints = proto.RepeatedField( + proto.STRING, + number=2, + ) + crop_hints_params = proto.Field( + proto.MESSAGE, + number=4, + message="CropHintsParams", + ) product_search_params = proto.Field( - proto.MESSAGE, number=5, message=product_search.ProductSearchParams, + proto.MESSAGE, + number=5, + message=product_search.ProductSearchParams, ) web_detection_params = proto.Field( - proto.MESSAGE, number=6, message="WebDetectionParams", + proto.MESSAGE, + number=6, + message="WebDetectionParams", ) text_detection_params = proto.Field( - proto.MESSAGE, number=12, message="TextDetectionParams", + proto.MESSAGE, + number=12, + message="TextDetectionParams", ) @@ -681,9 +926,21 @@ class AnnotateImageRequest(proto.Message): image. """ - image = proto.Field(proto.MESSAGE, number=1, message="Image",) - features = proto.RepeatedField(proto.MESSAGE, number=2, message="Feature",) - image_context = proto.Field(proto.MESSAGE, number=3, message="ImageContext",) + image = proto.Field( + proto.MESSAGE, + number=1, + message="Image", + ) + features = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="Feature", + ) + image_context = proto.Field( + proto.MESSAGE, + number=3, + message="ImageContext", + ) class ImageAnnotationContext(proto.Message): @@ -700,8 +957,14 @@ class ImageAnnotationContext(proto.Message): produce the image. """ - uri = proto.Field(proto.STRING, number=1,) - page_number = proto.Field(proto.INT32, number=2,) + uri = proto.Field( + proto.STRING, + number=1, + ) + page_number = proto.Field( + proto.INT32, + number=2, + ) class AnnotateImageResponse(proto.Message): @@ -757,43 +1020,75 @@ class AnnotateImageResponse(proto.Message): """ face_annotations = proto.RepeatedField( - proto.MESSAGE, number=1, message="FaceAnnotation", + proto.MESSAGE, + number=1, + message="FaceAnnotation", ) landmark_annotations = proto.RepeatedField( - proto.MESSAGE, number=2, message="EntityAnnotation", + proto.MESSAGE, + number=2, + message="EntityAnnotation", ) logo_annotations = proto.RepeatedField( - proto.MESSAGE, number=3, message="EntityAnnotation", + proto.MESSAGE, + number=3, + message="EntityAnnotation", ) label_annotations = proto.RepeatedField( - proto.MESSAGE, number=4, message="EntityAnnotation", + proto.MESSAGE, + number=4, + message="EntityAnnotation", ) localized_object_annotations = proto.RepeatedField( - proto.MESSAGE, number=22, message="LocalizedObjectAnnotation", + proto.MESSAGE, + number=22, + message="LocalizedObjectAnnotation", ) text_annotations = proto.RepeatedField( - proto.MESSAGE, number=5, message="EntityAnnotation", + proto.MESSAGE, + number=5, + message="EntityAnnotation", ) full_text_annotation = proto.Field( - proto.MESSAGE, number=12, message=text_annotation.TextAnnotation, + proto.MESSAGE, + number=12, + message=text_annotation.TextAnnotation, ) safe_search_annotation = proto.Field( - proto.MESSAGE, number=6, message="SafeSearchAnnotation", + proto.MESSAGE, + number=6, + message="SafeSearchAnnotation", ) image_properties_annotation = proto.Field( - proto.MESSAGE, number=8, message="ImageProperties", + proto.MESSAGE, + number=8, + message="ImageProperties", ) crop_hints_annotation = proto.Field( - proto.MESSAGE, number=11, message="CropHintsAnnotation", + proto.MESSAGE, + number=11, + message="CropHintsAnnotation", ) web_detection = proto.Field( - proto.MESSAGE, number=13, message=gcv_web_detection.WebDetection, + proto.MESSAGE, + number=13, + message=gcv_web_detection.WebDetection, ) product_search_results = proto.Field( - proto.MESSAGE, number=14, message=product_search.ProductSearchResults, + proto.MESSAGE, + number=14, + message=product_search.ProductSearchResults, + ) + error = proto.Field( + proto.MESSAGE, + number=9, + message=status_pb2.Status, + ) + context = proto.Field( + proto.MESSAGE, + number=21, + message="ImageAnnotationContext", ) - error = proto.Field(proto.MESSAGE, number=9, message=status_pb2.Status,) - context = proto.Field(proto.MESSAGE, number=21, message="ImageAnnotationContext",) class BatchAnnotateImagesRequest(proto.Message): @@ -820,9 +1115,14 @@ class BatchAnnotateImagesRequest(proto.Message): """ requests = proto.RepeatedField( - proto.MESSAGE, number=1, message="AnnotateImageRequest", + proto.MESSAGE, + number=1, + message="AnnotateImageRequest", + ) + parent = proto.Field( + proto.STRING, + number=4, ) - parent = proto.Field(proto.STRING, number=4,) class BatchAnnotateImagesResponse(proto.Message): @@ -835,7 +1135,9 @@ class BatchAnnotateImagesResponse(proto.Message): """ responses = proto.RepeatedField( - proto.MESSAGE, number=1, message="AnnotateImageResponse", + proto.MESSAGE, + number=1, + message="AnnotateImageResponse", ) @@ -869,10 +1171,25 @@ class AnnotateFileRequest(proto.Message): of the file. """ - input_config = proto.Field(proto.MESSAGE, number=1, message="InputConfig",) - features = proto.RepeatedField(proto.MESSAGE, number=2, message="Feature",) - image_context = proto.Field(proto.MESSAGE, number=3, message="ImageContext",) - pages = proto.RepeatedField(proto.INT32, number=4,) + input_config = proto.Field( + proto.MESSAGE, + number=1, + message="InputConfig", + ) + features = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="Feature", + ) + image_context = proto.Field( + proto.MESSAGE, + number=3, + message="ImageContext", + ) + pages = proto.RepeatedField( + proto.INT32, + number=4, + ) class AnnotateFileResponse(proto.Message): @@ -895,12 +1212,25 @@ class AnnotateFileResponse(proto.Message): The ``responses`` field will not be set in this case. """ - input_config = proto.Field(proto.MESSAGE, number=1, message="InputConfig",) + input_config = proto.Field( + proto.MESSAGE, + number=1, + message="InputConfig", + ) responses = proto.RepeatedField( - proto.MESSAGE, number=2, message="AnnotateImageResponse", + proto.MESSAGE, + number=2, + message="AnnotateImageResponse", + ) + total_pages = proto.Field( + proto.INT32, + number=3, + ) + error = proto.Field( + proto.MESSAGE, + number=4, + message=status_pb2.Status, ) - total_pages = proto.Field(proto.INT32, number=3,) - error = proto.Field(proto.MESSAGE, number=4, message=status_pb2.Status,) class BatchAnnotateFilesRequest(proto.Message): @@ -929,9 +1259,14 @@ class BatchAnnotateFilesRequest(proto.Message): """ requests = proto.RepeatedField( - proto.MESSAGE, number=1, message="AnnotateFileRequest", + proto.MESSAGE, + number=1, + message="AnnotateFileRequest", + ) + parent = proto.Field( + proto.STRING, + number=3, ) - parent = proto.Field(proto.STRING, number=3,) class BatchAnnotateFilesResponse(proto.Message): @@ -946,7 +1281,9 @@ class BatchAnnotateFilesResponse(proto.Message): """ responses = proto.RepeatedField( - proto.MESSAGE, number=1, message="AnnotateFileResponse", + proto.MESSAGE, + number=1, + message="AnnotateFileResponse", ) @@ -966,10 +1303,26 @@ class AsyncAnnotateFileRequest(proto.Message): metadata (e.g. format). """ - input_config = proto.Field(proto.MESSAGE, number=1, message="InputConfig",) - features = proto.RepeatedField(proto.MESSAGE, number=2, message="Feature",) - image_context = proto.Field(proto.MESSAGE, number=3, message="ImageContext",) - output_config = proto.Field(proto.MESSAGE, number=4, message="OutputConfig",) + input_config = proto.Field( + proto.MESSAGE, + number=1, + message="InputConfig", + ) + features = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="Feature", + ) + image_context = proto.Field( + proto.MESSAGE, + number=3, + message="ImageContext", + ) + output_config = proto.Field( + proto.MESSAGE, + number=4, + message="OutputConfig", + ) class AsyncAnnotateFileResponse(proto.Message): @@ -981,7 +1334,11 @@ class AsyncAnnotateFileResponse(proto.Message): AsyncAnnotateFileRequest. """ - output_config = proto.Field(proto.MESSAGE, number=1, message="OutputConfig",) + output_config = proto.Field( + proto.MESSAGE, + number=1, + message="OutputConfig", + ) class AsyncBatchAnnotateImagesRequest(proto.Message): @@ -1010,10 +1367,19 @@ class AsyncBatchAnnotateImagesRequest(proto.Message): """ requests = proto.RepeatedField( - proto.MESSAGE, number=1, message="AnnotateImageRequest", + proto.MESSAGE, + number=1, + message="AnnotateImageRequest", + ) + output_config = proto.Field( + proto.MESSAGE, + number=2, + message="OutputConfig", + ) + parent = proto.Field( + proto.STRING, + number=4, ) - output_config = proto.Field(proto.MESSAGE, number=2, message="OutputConfig",) - parent = proto.Field(proto.STRING, number=4,) class AsyncBatchAnnotateImagesResponse(proto.Message): @@ -1025,7 +1391,11 @@ class AsyncBatchAnnotateImagesResponse(proto.Message): AsyncBatchAnnotateImagesRequest. """ - output_config = proto.Field(proto.MESSAGE, number=1, message="OutputConfig",) + output_config = proto.Field( + proto.MESSAGE, + number=1, + message="OutputConfig", + ) class AsyncBatchAnnotateFilesRequest(proto.Message): @@ -1052,9 +1422,14 @@ class AsyncBatchAnnotateFilesRequest(proto.Message): """ requests = proto.RepeatedField( - proto.MESSAGE, number=1, message="AsyncAnnotateFileRequest", + proto.MESSAGE, + number=1, + message="AsyncAnnotateFileRequest", + ) + parent = proto.Field( + proto.STRING, + number=4, ) - parent = proto.Field(proto.STRING, number=4,) class AsyncBatchAnnotateFilesResponse(proto.Message): @@ -1068,7 +1443,9 @@ class AsyncBatchAnnotateFilesResponse(proto.Message): """ responses = proto.RepeatedField( - proto.MESSAGE, number=1, message="AsyncAnnotateFileResponse", + proto.MESSAGE, + number=1, + message="AsyncAnnotateFileResponse", ) @@ -1093,9 +1470,19 @@ class InputConfig(proto.Message): are supported. Wildcards are not supported. """ - gcs_source = proto.Field(proto.MESSAGE, number=1, message="GcsSource",) - content = proto.Field(proto.BYTES, number=3,) - mime_type = proto.Field(proto.STRING, number=2,) + gcs_source = proto.Field( + proto.MESSAGE, + number=1, + message="GcsSource", + ) + content = proto.Field( + proto.BYTES, + number=3, + ) + mime_type = proto.Field( + proto.STRING, + number=2, + ) class OutputConfig(proto.Message): @@ -1119,8 +1506,15 @@ class OutputConfig(proto.Message): potential future support for other output configurations. """ - gcs_destination = proto.Field(proto.MESSAGE, number=1, message="GcsDestination",) - batch_size = proto.Field(proto.INT32, number=2,) + gcs_destination = proto.Field( + proto.MESSAGE, + number=1, + message="GcsDestination", + ) + batch_size = proto.Field( + proto.INT32, + number=2, + ) class GcsSource(proto.Message): @@ -1134,7 +1528,10 @@ class GcsSource(proto.Message): Wildcards are not currently supported. """ - uri = proto.Field(proto.STRING, number=1,) + uri = proto.Field( + proto.STRING, + number=1, + ) class GcsDestination(proto.Message): @@ -1171,7 +1568,10 @@ class GcsDestination(proto.Message): overflows into multiple sharded files. """ - uri = proto.Field(proto.STRING, number=1,) + uri = proto.Field( + proto.STRING, + number=1, + ) class OperationMetadata(proto.Message): @@ -1195,9 +1595,21 @@ class State(proto.Enum): DONE = 3 CANCELLED = 4 - state = proto.Field(proto.ENUM, number=1, enum=State,) - create_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,) + state = proto.Field( + proto.ENUM, + number=1, + enum=State, + ) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/vision_v1/types/product_search.py b/google/cloud/vision_v1/types/product_search.py index 64c0b02e..a2aa375b 100644 --- a/google/cloud/vision_v1/types/product_search.py +++ b/google/cloud/vision_v1/types/product_search.py @@ -22,7 +22,10 @@ __protobuf__ = proto.module( package="google.cloud.vision.v1", - manifest={"ProductSearchParams", "ProductSearchResults",}, + manifest={ + "ProductSearchParams", + "ProductSearchResults", + }, ) @@ -67,10 +70,23 @@ class ProductSearchParams(proto.Message): instead of an '='. """ - bounding_poly = proto.Field(proto.MESSAGE, number=9, message=geometry.BoundingPoly,) - product_set = proto.Field(proto.STRING, number=6,) - product_categories = proto.RepeatedField(proto.STRING, number=7,) - filter = proto.Field(proto.STRING, number=8,) + bounding_poly = proto.Field( + proto.MESSAGE, + number=9, + message=geometry.BoundingPoly, + ) + product_set = proto.Field( + proto.STRING, + number=6, + ) + product_categories = proto.RepeatedField( + proto.STRING, + number=7, + ) + filter = proto.Field( + proto.STRING, + number=8, + ) class ProductSearchResults(proto.Message): @@ -108,10 +124,18 @@ class Result(proto.Message): """ product = proto.Field( - proto.MESSAGE, number=1, message=product_search_service.Product, + proto.MESSAGE, + number=1, + message=product_search_service.Product, + ) + score = proto.Field( + proto.FLOAT, + number=2, + ) + image = proto.Field( + proto.STRING, + number=3, ) - score = proto.Field(proto.FLOAT, number=2,) - image = proto.Field(proto.STRING, number=3,) class ObjectAnnotation(proto.Message): r"""Prediction for what the object in the bounding box is. @@ -130,10 +154,22 @@ class ObjectAnnotation(proto.Message): Score of the result. Range [0, 1]. """ - mid = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) - name = proto.Field(proto.STRING, number=3,) - score = proto.Field(proto.FLOAT, number=4,) + mid = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) + name = proto.Field( + proto.STRING, + number=3, + ) + score = proto.Field( + proto.FLOAT, + number=4, + ) class GroupedResult(proto.Message): r"""Information about the products similar to a single product in @@ -151,19 +187,35 @@ class GroupedResult(proto.Message): """ bounding_poly = proto.Field( - proto.MESSAGE, number=1, message=geometry.BoundingPoly, + proto.MESSAGE, + number=1, + message=geometry.BoundingPoly, ) results = proto.RepeatedField( - proto.MESSAGE, number=2, message="ProductSearchResults.Result", + proto.MESSAGE, + number=2, + message="ProductSearchResults.Result", ) object_annotations = proto.RepeatedField( - proto.MESSAGE, number=3, message="ProductSearchResults.ObjectAnnotation", + proto.MESSAGE, + number=3, + message="ProductSearchResults.ObjectAnnotation", ) - index_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - results = proto.RepeatedField(proto.MESSAGE, number=5, message=Result,) + index_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + results = proto.RepeatedField( + proto.MESSAGE, + number=5, + message=Result, + ) product_grouped_results = proto.RepeatedField( - proto.MESSAGE, number=6, message=GroupedResult, + proto.MESSAGE, + number=6, + message=GroupedResult, ) diff --git a/google/cloud/vision_v1/types/product_search_service.py b/google/cloud/vision_v1/types/product_search_service.py index c458b590..3825f723 100644 --- a/google/cloud/vision_v1/types/product_search_service.py +++ b/google/cloud/vision_v1/types/product_search_service.py @@ -116,14 +116,36 @@ class KeyValue(proto.Message): bytes. """ - key = proto.Field(proto.STRING, number=1,) - value = proto.Field(proto.STRING, number=2,) - - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) - product_category = proto.Field(proto.STRING, number=4,) - product_labels = proto.RepeatedField(proto.MESSAGE, number=5, message=KeyValue,) + key = proto.Field( + proto.STRING, + number=1, + ) + value = proto.Field( + proto.STRING, + number=2, + ) + + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) + product_category = proto.Field( + proto.STRING, + number=4, + ) + product_labels = proto.RepeatedField( + proto.MESSAGE, + number=5, + message=KeyValue, + ) class ProductSet(proto.Message): @@ -161,10 +183,24 @@ class ProductSet(proto.Message): ProductSet. """ - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - index_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - index_error = proto.Field(proto.MESSAGE, number=4, message=status_pb2.Status,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + index_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + index_error = proto.Field( + proto.MESSAGE, + number=4, + message=status_pb2.Status, + ) class ReferenceImage(proto.Message): @@ -197,10 +233,18 @@ class ReferenceImage(proto.Message): 1:4 or less (i.e. 1:3 is ok; 1:5 is not). """ - name = proto.Field(proto.STRING, number=1,) - uri = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + uri = proto.Field( + proto.STRING, + number=2, + ) bounding_polys = proto.RepeatedField( - proto.MESSAGE, number=3, message=geometry.BoundingPoly, + proto.MESSAGE, + number=3, + message=geometry.BoundingPoly, ) @@ -223,9 +267,19 @@ class CreateProductRequest(proto.Message): cannot contain the character ``/``. """ - parent = proto.Field(proto.STRING, number=1,) - product = proto.Field(proto.MESSAGE, number=2, message="Product",) - product_id = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + product = proto.Field( + proto.MESSAGE, + number=2, + message="Product", + ) + product_id = proto.Field( + proto.STRING, + number=3, + ) class ListProductsRequest(proto.Message): @@ -245,9 +299,18 @@ class ListProductsRequest(proto.Message): if any. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListProductsResponse(proto.Message): @@ -266,8 +329,15 @@ class ListProductsResponse(proto.Message): def raw_page(self): return self - products = proto.RepeatedField(proto.MESSAGE, number=1, message="Product",) - next_page_token = proto.Field(proto.STRING, number=2,) + products = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Product", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetProductRequest(proto.Message): @@ -281,7 +351,10 @@ class GetProductRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdateProductRequest(proto.Message): @@ -299,9 +372,15 @@ class UpdateProductRequest(proto.Message): ``product_labels``, ``display_name``, and ``description``. """ - product = proto.Field(proto.MESSAGE, number=1, message="Product",) + product = proto.Field( + proto.MESSAGE, + number=1, + message="Product", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -316,7 +395,10 @@ class DeleteProductRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateProductSetRequest(proto.Message): @@ -338,9 +420,19 @@ class CreateProductSetRequest(proto.Message): cannot contain the character ``/``. """ - parent = proto.Field(proto.STRING, number=1,) - product_set = proto.Field(proto.MESSAGE, number=2, message="ProductSet",) - product_set_id = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + product_set = proto.Field( + proto.MESSAGE, + number=2, + message="ProductSet", + ) + product_set_id = proto.Field( + proto.STRING, + number=3, + ) class ListProductSetsRequest(proto.Message): @@ -360,9 +452,18 @@ class ListProductSetsRequest(proto.Message): if any. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListProductSetsResponse(proto.Message): @@ -381,8 +482,15 @@ class ListProductSetsResponse(proto.Message): def raw_page(self): return self - product_sets = proto.RepeatedField(proto.MESSAGE, number=1, message="ProductSet",) - next_page_token = proto.Field(proto.STRING, number=2,) + product_sets = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="ProductSet", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetProductSetRequest(proto.Message): @@ -396,7 +504,10 @@ class GetProductSetRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdateProductSetRequest(proto.Message): @@ -413,9 +524,15 @@ class UpdateProductSetRequest(proto.Message): ``display_name``. """ - product_set = proto.Field(proto.MESSAGE, number=1, message="ProductSet",) + product_set = proto.Field( + proto.MESSAGE, + number=1, + message="ProductSet", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -430,7 +547,10 @@ class DeleteProductSetRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateReferenceImageRequest(proto.Message): @@ -454,9 +574,19 @@ class CreateReferenceImageRequest(proto.Message): characters long. It cannot contain the character ``/``. """ - parent = proto.Field(proto.STRING, number=1,) - reference_image = proto.Field(proto.MESSAGE, number=2, message="ReferenceImage",) - reference_image_id = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + reference_image = proto.Field( + proto.MESSAGE, + number=2, + message="ReferenceImage", + ) + reference_image_id = proto.Field( + proto.STRING, + number=3, + ) class ListReferenceImagesRequest(proto.Message): @@ -480,9 +610,18 @@ class ListReferenceImagesRequest(proto.Message): Defaults to the first page if not specified. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListReferenceImagesResponse(proto.Message): @@ -504,10 +643,18 @@ def raw_page(self): return self reference_images = proto.RepeatedField( - proto.MESSAGE, number=1, message="ReferenceImage", + proto.MESSAGE, + number=1, + message="ReferenceImage", + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + next_page_token = proto.Field( + proto.STRING, + number=3, ) - page_size = proto.Field(proto.INT32, number=2,) - next_page_token = proto.Field(proto.STRING, number=3,) class GetReferenceImageRequest(proto.Message): @@ -521,7 +668,10 @@ class GetReferenceImageRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class DeleteReferenceImageRequest(proto.Message): @@ -536,7 +686,10 @@ class DeleteReferenceImageRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class AddProductToProductSetRequest(proto.Message): @@ -556,8 +709,14 @@ class AddProductToProductSetRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ - name = proto.Field(proto.STRING, number=1,) - product = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + product = proto.Field( + proto.STRING, + number=2, + ) class RemoveProductFromProductSetRequest(proto.Message): @@ -577,8 +736,14 @@ class RemoveProductFromProductSetRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ - name = proto.Field(proto.STRING, number=1,) - product = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + product = proto.Field( + proto.STRING, + number=2, + ) class ListProductsInProductSetRequest(proto.Message): @@ -599,9 +764,18 @@ class ListProductsInProductSetRequest(proto.Message): if any. """ - name = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListProductsInProductSetResponse(proto.Message): @@ -620,8 +794,15 @@ class ListProductsInProductSetResponse(proto.Message): def raw_page(self): return self - products = proto.RepeatedField(proto.MESSAGE, number=1, message="Product",) - next_page_token = proto.Field(proto.STRING, number=2,) + products = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Product", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class ImportProductSetsGcsSource(proto.Message): @@ -705,7 +886,10 @@ class ImportProductSetsGcsSource(proto.Message): too large to process (larger than 20MP). """ - csv_file_uri = proto.Field(proto.STRING, number=1,) + csv_file_uri = proto.Field( + proto.STRING, + number=1, + ) class ImportProductSetsInputConfig(proto.Message): @@ -723,7 +907,10 @@ class ImportProductSetsInputConfig(proto.Message): """ gcs_source = proto.Field( - proto.MESSAGE, number=1, oneof="source", message="ImportProductSetsGcsSource", + proto.MESSAGE, + number=1, + oneof="source", + message="ImportProductSetsGcsSource", ) @@ -741,9 +928,14 @@ class ImportProductSetsRequest(proto.Message): requests. """ - parent = proto.Field(proto.STRING, number=1,) + parent = proto.Field( + proto.STRING, + number=1, + ) input_config = proto.Field( - proto.MESSAGE, number=2, message="ImportProductSetsInputConfig", + proto.MESSAGE, + number=2, + message="ImportProductSetsInputConfig", ) @@ -770,9 +962,15 @@ class ImportProductSetsResponse(proto.Message): """ reference_images = proto.RepeatedField( - proto.MESSAGE, number=1, message="ReferenceImage", + proto.MESSAGE, + number=1, + message="ReferenceImage", + ) + statuses = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=status_pb2.Status, ) - statuses = proto.RepeatedField(proto.MESSAGE, number=2, message=status_pb2.Status,) class BatchOperationMetadata(proto.Message): @@ -804,9 +1002,21 @@ class State(proto.Enum): FAILED = 3 CANCELLED = 4 - state = proto.Field(proto.ENUM, number=1, enum=State,) - submit_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) + state = proto.Field( + proto.ENUM, + number=1, + enum=State, + ) + submit_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) class ProductSetPurgeConfig(proto.Message): @@ -820,7 +1030,10 @@ class ProductSetPurgeConfig(proto.Message): ProductSets, the Product will still be deleted. """ - product_set_id = proto.Field(proto.STRING, number=1,) + product_set_id = proto.Field( + proto.STRING, + number=1, + ) class PurgeProductsRequest(proto.Message): @@ -855,11 +1068,24 @@ class PurgeProductsRequest(proto.Message): """ product_set_purge_config = proto.Field( - proto.MESSAGE, number=2, oneof="target", message="ProductSetPurgeConfig", + proto.MESSAGE, + number=2, + oneof="target", + message="ProductSetPurgeConfig", + ) + delete_orphan_products = proto.Field( + proto.BOOL, + number=3, + oneof="target", + ) + parent = proto.Field( + proto.STRING, + number=1, + ) + force = proto.Field( + proto.BOOL, + number=4, ) - delete_orphan_products = proto.Field(proto.BOOL, number=3, oneof="target",) - parent = proto.Field(proto.STRING, number=1,) - force = proto.Field(proto.BOOL, number=4,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/vision_v1/types/text_annotation.py b/google/cloud/vision_v1/types/text_annotation.py index c3e80790..9d56f34d 100644 --- a/google/cloud/vision_v1/types/text_annotation.py +++ b/google/cloud/vision_v1/types/text_annotation.py @@ -20,7 +20,14 @@ __protobuf__ = proto.module( package="google.cloud.vision.v1", - manifest={"TextAnnotation", "Page", "Block", "Paragraph", "Word", "Symbol",}, + manifest={ + "TextAnnotation", + "Page", + "Block", + "Paragraph", + "Word", + "Symbol", + }, ) @@ -53,8 +60,14 @@ class DetectedLanguage(proto.Message): Confidence of detected language. Range [0, 1]. """ - language_code = proto.Field(proto.STRING, number=1,) - confidence = proto.Field(proto.FLOAT, number=2,) + language_code = proto.Field( + proto.STRING, + number=1, + ) + confidence = proto.Field( + proto.FLOAT, + number=2, + ) class DetectedBreak(proto.Message): r"""Detected start or end of a structural component. @@ -76,9 +89,14 @@ class BreakType(proto.Enum): LINE_BREAK = 5 type_ = proto.Field( - proto.ENUM, number=1, enum="TextAnnotation.DetectedBreak.BreakType", + proto.ENUM, + number=1, + enum="TextAnnotation.DetectedBreak.BreakType", + ) + is_prefix = proto.Field( + proto.BOOL, + number=2, ) - is_prefix = proto.Field(proto.BOOL, number=2,) class TextProperty(proto.Message): r"""Additional information detected on the structural component. @@ -92,14 +110,25 @@ class TextProperty(proto.Message): """ detected_languages = proto.RepeatedField( - proto.MESSAGE, number=1, message="TextAnnotation.DetectedLanguage", + proto.MESSAGE, + number=1, + message="TextAnnotation.DetectedLanguage", ) detected_break = proto.Field( - proto.MESSAGE, number=2, message="TextAnnotation.DetectedBreak", + proto.MESSAGE, + number=2, + message="TextAnnotation.DetectedBreak", ) - pages = proto.RepeatedField(proto.MESSAGE, number=1, message="Page",) - text = proto.Field(proto.STRING, number=2,) + pages = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Page", + ) + text = proto.Field( + proto.STRING, + number=2, + ) class Page(proto.Message): @@ -122,12 +151,27 @@ class Page(proto.Message): """ property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + width = proto.Field( + proto.INT32, + number=2, + ) + height = proto.Field( + proto.INT32, + number=3, + ) + blocks = proto.RepeatedField( + proto.MESSAGE, + number=4, + message="Block", + ) + confidence = proto.Field( + proto.FLOAT, + number=5, ) - width = proto.Field(proto.INT32, number=2,) - height = proto.Field(proto.INT32, number=3,) - blocks = proto.RepeatedField(proto.MESSAGE, number=4, message="Block",) - confidence = proto.Field(proto.FLOAT, number=5,) class Block(proto.Message): @@ -182,12 +226,29 @@ class BlockType(proto.Enum): BARCODE = 5 property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + bounding_box = proto.Field( + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + paragraphs = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="Paragraph", + ) + block_type = proto.Field( + proto.ENUM, + number=4, + enum=BlockType, + ) + confidence = proto.Field( + proto.FLOAT, + number=5, ) - bounding_box = proto.Field(proto.MESSAGE, number=2, message=geometry.BoundingPoly,) - paragraphs = proto.RepeatedField(proto.MESSAGE, number=3, message="Paragraph",) - block_type = proto.Field(proto.ENUM, number=4, enum=BlockType,) - confidence = proto.Field(proto.FLOAT, number=5,) class Paragraph(proto.Message): @@ -218,11 +279,24 @@ class Paragraph(proto.Message): """ property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + bounding_box = proto.Field( + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + words = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="Word", + ) + confidence = proto.Field( + proto.FLOAT, + number=4, ) - bounding_box = proto.Field(proto.MESSAGE, number=2, message=geometry.BoundingPoly,) - words = proto.RepeatedField(proto.MESSAGE, number=3, message="Word",) - confidence = proto.Field(proto.FLOAT, number=4,) class Word(proto.Message): @@ -252,11 +326,24 @@ class Word(proto.Message): """ property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + bounding_box = proto.Field( + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + symbols = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="Symbol", + ) + confidence = proto.Field( + proto.FLOAT, + number=4, ) - bounding_box = proto.Field(proto.MESSAGE, number=2, message=geometry.BoundingPoly,) - symbols = proto.RepeatedField(proto.MESSAGE, number=3, message="Symbol",) - confidence = proto.Field(proto.FLOAT, number=4,) class Symbol(proto.Message): @@ -286,11 +373,23 @@ class Symbol(proto.Message): """ property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + bounding_box = proto.Field( + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + text = proto.Field( + proto.STRING, + number=3, + ) + confidence = proto.Field( + proto.FLOAT, + number=4, ) - bounding_box = proto.Field(proto.MESSAGE, number=2, message=geometry.BoundingPoly,) - text = proto.Field(proto.STRING, number=3,) - confidence = proto.Field(proto.FLOAT, number=4,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/vision_v1/types/web_detection.py b/google/cloud/vision_v1/types/web_detection.py index de03fe7a..0c8acb91 100644 --- a/google/cloud/vision_v1/types/web_detection.py +++ b/google/cloud/vision_v1/types/web_detection.py @@ -17,7 +17,10 @@ __protobuf__ = proto.module( - package="google.cloud.vision.v1", manifest={"WebDetection",}, + package="google.cloud.vision.v1", + manifest={ + "WebDetection", + }, ) @@ -63,9 +66,18 @@ class WebEntity(proto.Message): English. """ - entity_id = proto.Field(proto.STRING, number=1,) - score = proto.Field(proto.FLOAT, number=2,) - description = proto.Field(proto.STRING, number=3,) + entity_id = proto.Field( + proto.STRING, + number=1, + ) + score = proto.Field( + proto.FLOAT, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) class WebImage(proto.Message): r"""Metadata for online images. @@ -78,8 +90,14 @@ class WebImage(proto.Message): image. """ - url = proto.Field(proto.STRING, number=1,) - score = proto.Field(proto.FLOAT, number=2,) + url = proto.Field( + proto.STRING, + number=1, + ) + score = proto.Field( + proto.FLOAT, + number=2, + ) class WebPage(proto.Message): r"""Metadata for web pages. @@ -104,14 +122,27 @@ class WebPage(proto.Message): crops. """ - url = proto.Field(proto.STRING, number=1,) - score = proto.Field(proto.FLOAT, number=2,) - page_title = proto.Field(proto.STRING, number=3,) + url = proto.Field( + proto.STRING, + number=1, + ) + score = proto.Field( + proto.FLOAT, + number=2, + ) + page_title = proto.Field( + proto.STRING, + number=3, + ) full_matching_images = proto.RepeatedField( - proto.MESSAGE, number=4, message="WebDetection.WebImage", + proto.MESSAGE, + number=4, + message="WebDetection.WebImage", ) partial_matching_images = proto.RepeatedField( - proto.MESSAGE, number=5, message="WebDetection.WebImage", + proto.MESSAGE, + number=5, + message="WebDetection.WebImage", ) class WebLabel(proto.Message): @@ -126,23 +157,45 @@ class WebLabel(proto.Message): http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. """ - label = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) + label = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) - web_entities = proto.RepeatedField(proto.MESSAGE, number=1, message=WebEntity,) + web_entities = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=WebEntity, + ) full_matching_images = proto.RepeatedField( - proto.MESSAGE, number=2, message=WebImage, + proto.MESSAGE, + number=2, + message=WebImage, ) partial_matching_images = proto.RepeatedField( - proto.MESSAGE, number=3, message=WebImage, + proto.MESSAGE, + number=3, + message=WebImage, ) pages_with_matching_images = proto.RepeatedField( - proto.MESSAGE, number=4, message=WebPage, + proto.MESSAGE, + number=4, + message=WebPage, ) visually_similar_images = proto.RepeatedField( - proto.MESSAGE, number=6, message=WebImage, + proto.MESSAGE, + number=6, + message=WebImage, + ) + best_guess_labels = proto.RepeatedField( + proto.MESSAGE, + number=8, + message=WebLabel, ) - best_guess_labels = proto.RepeatedField(proto.MESSAGE, number=8, message=WebLabel,) __all__ = tuple(sorted(__protobuf__.manifest)) 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 8f7ec1b6..3ec3aa07 100644 --- a/google/cloud/vision_v1p1beta1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1p1beta1/services/image_annotator/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -215,21 +215,20 @@ async def batch_annotate_images( r"""Run image detection and annotation for a batch of images. - .. code-block:: python from google.cloud import vision_v1p1beta1 - def sample_batch_annotate_images(): + async def sample_batch_annotate_images(): # Create a client - client = vision_v1p1beta1.ImageAnnotatorClient() + client = vision_v1p1beta1.ImageAnnotatorAsyncClient() # Initialize request argument(s) request = vision_v1p1beta1.BatchAnnotateImagesRequest( ) # Make the request - response = client.batch_annotate_images(request=request) + response = await client.batch_annotate_images(request=request) # Handle the response print(response) @@ -293,7 +292,12 @@ def sample_batch_annotate_images(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -307,7 +311,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/vision_v1p1beta1/services/image_annotator/client.py b/google/cloud/vision_v1p1beta1/services/image_annotator/client.py index d71ae614..72e494c3 100644 --- a/google/cloud/vision_v1p1beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p1beta1/services/image_annotator/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -54,7 +54,10 @@ class ImageAnnotatorClientMeta(type): _transport_registry["grpc"] = ImageAnnotatorGrpcTransport _transport_registry["grpc_asyncio"] = ImageAnnotatorGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[ImageAnnotatorTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ImageAnnotatorTransport]: """Returns an appropriate transport class. Args: @@ -163,7 +166,9 @@ def transport(self) -> ImageAnnotatorTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -176,9 +181,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -187,9 +196,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -198,9 +211,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -209,10 +226,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -398,7 +419,6 @@ def batch_annotate_images( r"""Run image detection and annotation for a batch of images. - .. code-block:: python from google.cloud import vision_v1p1beta1 @@ -469,7 +489,12 @@ def sample_batch_annotate_images(): rpc = self._transport._wrapped_methods[self._transport.batch_annotate_images] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -490,7 +515,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() 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 f4ab113b..df56e427 100644 --- a/google/cloud/vision_v1p1beta1/services/image_annotator/transports/base.py +++ b/google/cloud/vision_v1p1beta1/services/image_annotator/transports/base.py @@ -29,7 +29,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -81,6 +83,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -141,9 +144,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -159,5 +162,9 @@ def batch_annotate_images( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("ImageAnnotatorTransport",) 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 d6f61ca4..b78095b1 100644 --- a/google/cloud/vision_v1p1beta1/services/image_annotator/transports/grpc.py +++ b/google/cloud/vision_v1p1beta1/services/image_annotator/transports/grpc.py @@ -227,8 +227,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -264,5 +263,9 @@ def batch_annotate_images( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("ImageAnnotatorGrpcTransport",) diff --git a/google/cloud/vision_v1p1beta1/types/__init__.py b/google/cloud/vision_v1p1beta1/types/__init__.py index 1e5dc745..7c63be83 100644 --- a/google/cloud/vision_v1p1beta1/types/__init__.py +++ b/google/cloud/vision_v1p1beta1/types/__init__.py @@ -51,7 +51,9 @@ TextAnnotation, Word, ) -from .web_detection import WebDetection +from .web_detection import ( + WebDetection, +) __all__ = ( "BoundingPoly", diff --git a/google/cloud/vision_v1p1beta1/types/geometry.py b/google/cloud/vision_v1p1beta1/types/geometry.py index ac313433..ecb4d164 100644 --- a/google/cloud/vision_v1p1beta1/types/geometry.py +++ b/google/cloud/vision_v1p1beta1/types/geometry.py @@ -18,7 +18,11 @@ __protobuf__ = proto.module( package="google.cloud.vision.v1p1beta1", - manifest={"Vertex", "BoundingPoly", "Position",}, + manifest={ + "Vertex", + "BoundingPoly", + "Position", + }, ) @@ -34,8 +38,14 @@ class Vertex(proto.Message): Y coordinate. """ - x = proto.Field(proto.INT32, number=1,) - y = proto.Field(proto.INT32, number=2,) + x = proto.Field( + proto.INT32, + number=1, + ) + y = proto.Field( + proto.INT32, + number=2, + ) class BoundingPoly(proto.Message): @@ -46,7 +56,11 @@ class BoundingPoly(proto.Message): The bounding polygon vertices. """ - vertices = proto.RepeatedField(proto.MESSAGE, number=1, message="Vertex",) + vertices = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Vertex", + ) class Position(proto.Message): @@ -64,9 +78,18 @@ class Position(proto.Message): Z coordinate (or depth). """ - x = proto.Field(proto.FLOAT, number=1,) - y = proto.Field(proto.FLOAT, number=2,) - z = proto.Field(proto.FLOAT, number=3,) + x = proto.Field( + proto.FLOAT, + number=1, + ) + y = proto.Field( + proto.FLOAT, + number=2, + ) + z = proto.Field( + proto.FLOAT, + number=3, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/vision_v1p1beta1/types/image_annotator.py b/google/cloud/vision_v1p1beta1/types/image_annotator.py index a929119a..7904f634 100644 --- a/google/cloud/vision_v1p1beta1/types/image_annotator.py +++ b/google/cloud/vision_v1p1beta1/types/image_annotator.py @@ -97,9 +97,19 @@ class Type(proto.Enum): CROP_HINTS = 9 WEB_DETECTION = 10 - type_ = proto.Field(proto.ENUM, number=1, enum=Type,) - max_results = proto.Field(proto.INT32, number=2,) - model = proto.Field(proto.STRING, number=3,) + type_ = proto.Field( + proto.ENUM, + number=1, + enum=Type, + ) + max_results = proto.Field( + proto.INT32, + number=2, + ) + model = proto.Field( + proto.STRING, + number=3, + ) class ImageSource(proto.Message): @@ -127,8 +137,14 @@ class ImageSource(proto.Message): ``image_uri`` takes precedence. """ - gcs_image_uri = proto.Field(proto.STRING, number=1,) - image_uri = proto.Field(proto.STRING, number=2,) + gcs_image_uri = proto.Field( + proto.STRING, + number=1, + ) + image_uri = proto.Field( + proto.STRING, + number=2, + ) class Image(proto.Message): @@ -146,8 +162,15 @@ class Image(proto.Message): request. """ - content = proto.Field(proto.BYTES, number=1,) - source = proto.Field(proto.MESSAGE, number=2, message="ImageSource",) + content = proto.Field( + proto.BYTES, + number=1, + ) + source = proto.Field( + proto.MESSAGE, + number=2, + message="ImageSource", + ) class FaceAnnotation(proto.Message): @@ -259,26 +282,87 @@ class Type(proto.Enum): CHIN_LEFT_GONION = 33 CHIN_RIGHT_GONION = 34 - type_ = proto.Field(proto.ENUM, number=3, enum="FaceAnnotation.Landmark.Type",) - position = proto.Field(proto.MESSAGE, number=4, message=geometry.Position,) - - bounding_poly = proto.Field(proto.MESSAGE, number=1, message=geometry.BoundingPoly,) + type_ = proto.Field( + proto.ENUM, + number=3, + enum="FaceAnnotation.Landmark.Type", + ) + position = proto.Field( + proto.MESSAGE, + number=4, + message=geometry.Position, + ) + + bounding_poly = proto.Field( + proto.MESSAGE, + number=1, + message=geometry.BoundingPoly, + ) fd_bounding_poly = proto.Field( - proto.MESSAGE, number=2, message=geometry.BoundingPoly, - ) - landmarks = proto.RepeatedField(proto.MESSAGE, number=3, message=Landmark,) - roll_angle = proto.Field(proto.FLOAT, number=4,) - pan_angle = proto.Field(proto.FLOAT, number=5,) - tilt_angle = proto.Field(proto.FLOAT, number=6,) - detection_confidence = proto.Field(proto.FLOAT, number=7,) - landmarking_confidence = proto.Field(proto.FLOAT, number=8,) - joy_likelihood = proto.Field(proto.ENUM, number=9, enum="Likelihood",) - sorrow_likelihood = proto.Field(proto.ENUM, number=10, enum="Likelihood",) - anger_likelihood = proto.Field(proto.ENUM, number=11, enum="Likelihood",) - surprise_likelihood = proto.Field(proto.ENUM, number=12, enum="Likelihood",) - under_exposed_likelihood = proto.Field(proto.ENUM, number=13, enum="Likelihood",) - blurred_likelihood = proto.Field(proto.ENUM, number=14, enum="Likelihood",) - headwear_likelihood = proto.Field(proto.ENUM, number=15, enum="Likelihood",) + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + landmarks = proto.RepeatedField( + proto.MESSAGE, + number=3, + message=Landmark, + ) + roll_angle = proto.Field( + proto.FLOAT, + number=4, + ) + pan_angle = proto.Field( + proto.FLOAT, + number=5, + ) + tilt_angle = proto.Field( + proto.FLOAT, + number=6, + ) + detection_confidence = proto.Field( + proto.FLOAT, + number=7, + ) + landmarking_confidence = proto.Field( + proto.FLOAT, + number=8, + ) + joy_likelihood = proto.Field( + proto.ENUM, + number=9, + enum="Likelihood", + ) + sorrow_likelihood = proto.Field( + proto.ENUM, + number=10, + enum="Likelihood", + ) + anger_likelihood = proto.Field( + proto.ENUM, + number=11, + enum="Likelihood", + ) + surprise_likelihood = proto.Field( + proto.ENUM, + number=12, + enum="Likelihood", + ) + under_exposed_likelihood = proto.Field( + proto.ENUM, + number=13, + enum="Likelihood", + ) + blurred_likelihood = proto.Field( + proto.ENUM, + number=14, + enum="Likelihood", + ) + headwear_likelihood = proto.Field( + proto.ENUM, + number=15, + enum="Likelihood", + ) class LocationInfo(proto.Message): @@ -289,7 +373,11 @@ class LocationInfo(proto.Message): lat/long location coordinates. """ - lat_lng = proto.Field(proto.MESSAGE, number=1, message=latlng_pb2.LatLng,) + lat_lng = proto.Field( + proto.MESSAGE, + number=1, + message=latlng_pb2.LatLng, + ) class Property(proto.Message): @@ -304,9 +392,18 @@ class Property(proto.Message): Value of numeric properties. """ - name = proto.Field(proto.STRING, number=1,) - value = proto.Field(proto.STRING, number=2,) - uint64_value = proto.Field(proto.UINT64, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + value = proto.Field( + proto.STRING, + number=2, + ) + uint64_value = proto.Field( + proto.UINT64, + number=3, + ) class EntityAnnotation(proto.Message): @@ -353,15 +450,45 @@ class EntityAnnotation(proto.Message): the entity. """ - mid = proto.Field(proto.STRING, number=1,) - locale = proto.Field(proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) - score = proto.Field(proto.FLOAT, number=4,) - confidence = proto.Field(proto.FLOAT, number=5,) - topicality = proto.Field(proto.FLOAT, number=6,) - bounding_poly = proto.Field(proto.MESSAGE, number=7, message=geometry.BoundingPoly,) - locations = proto.RepeatedField(proto.MESSAGE, number=8, message="LocationInfo",) - properties = proto.RepeatedField(proto.MESSAGE, number=9, message="Property",) + mid = proto.Field( + proto.STRING, + number=1, + ) + locale = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) + score = proto.Field( + proto.FLOAT, + number=4, + ) + confidence = proto.Field( + proto.FLOAT, + number=5, + ) + topicality = proto.Field( + proto.FLOAT, + number=6, + ) + bounding_poly = proto.Field( + proto.MESSAGE, + number=7, + message=geometry.BoundingPoly, + ) + locations = proto.RepeatedField( + proto.MESSAGE, + number=8, + message="LocationInfo", + ) + properties = proto.RepeatedField( + proto.MESSAGE, + number=9, + message="Property", + ) class SafeSearchAnnotation(proto.Message): @@ -393,11 +520,31 @@ class SafeSearchAnnotation(proto.Message): body areas. """ - adult = proto.Field(proto.ENUM, number=1, enum="Likelihood",) - spoof = proto.Field(proto.ENUM, number=2, enum="Likelihood",) - medical = proto.Field(proto.ENUM, number=3, enum="Likelihood",) - violence = proto.Field(proto.ENUM, number=4, enum="Likelihood",) - racy = proto.Field(proto.ENUM, number=9, enum="Likelihood",) + adult = proto.Field( + proto.ENUM, + number=1, + enum="Likelihood", + ) + spoof = proto.Field( + proto.ENUM, + number=2, + enum="Likelihood", + ) + medical = proto.Field( + proto.ENUM, + number=3, + enum="Likelihood", + ) + violence = proto.Field( + proto.ENUM, + number=4, + enum="Likelihood", + ) + racy = proto.Field( + proto.ENUM, + number=9, + enum="Likelihood", + ) class LatLongRect(proto.Message): @@ -410,8 +557,16 @@ class LatLongRect(proto.Message): Max lat/long pair. """ - min_lat_lng = proto.Field(proto.MESSAGE, number=1, message=latlng_pb2.LatLng,) - max_lat_lng = proto.Field(proto.MESSAGE, number=2, message=latlng_pb2.LatLng,) + min_lat_lng = proto.Field( + proto.MESSAGE, + number=1, + message=latlng_pb2.LatLng, + ) + max_lat_lng = proto.Field( + proto.MESSAGE, + number=2, + message=latlng_pb2.LatLng, + ) class ColorInfo(proto.Message): @@ -428,9 +583,19 @@ class ColorInfo(proto.Message): Value in range [0, 1]. """ - color = proto.Field(proto.MESSAGE, number=1, message=color_pb2.Color,) - score = proto.Field(proto.FLOAT, number=2,) - pixel_fraction = proto.Field(proto.FLOAT, number=3,) + color = proto.Field( + proto.MESSAGE, + number=1, + message=color_pb2.Color, + ) + score = proto.Field( + proto.FLOAT, + number=2, + ) + pixel_fraction = proto.Field( + proto.FLOAT, + number=3, + ) class DominantColorsAnnotation(proto.Message): @@ -442,7 +607,11 @@ class DominantColorsAnnotation(proto.Message): fraction. """ - colors = proto.RepeatedField(proto.MESSAGE, number=1, message="ColorInfo",) + colors = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="ColorInfo", + ) class ImageProperties(proto.Message): @@ -455,7 +624,9 @@ class ImageProperties(proto.Message): """ dominant_colors = proto.Field( - proto.MESSAGE, number=1, message="DominantColorsAnnotation", + proto.MESSAGE, + number=1, + message="DominantColorsAnnotation", ) @@ -475,9 +646,19 @@ class CropHint(proto.Message): with respect to the original image. """ - bounding_poly = proto.Field(proto.MESSAGE, number=1, message=geometry.BoundingPoly,) - confidence = proto.Field(proto.FLOAT, number=2,) - importance_fraction = proto.Field(proto.FLOAT, number=3,) + bounding_poly = proto.Field( + proto.MESSAGE, + number=1, + message=geometry.BoundingPoly, + ) + confidence = proto.Field( + proto.FLOAT, + number=2, + ) + importance_fraction = proto.Field( + proto.FLOAT, + number=3, + ) class CropHintsAnnotation(proto.Message): @@ -489,7 +670,11 @@ class CropHintsAnnotation(proto.Message): Crop hint results. """ - crop_hints = proto.RepeatedField(proto.MESSAGE, number=1, message="CropHint",) + crop_hints = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="CropHint", + ) class CropHintsParams(proto.Message): @@ -507,7 +692,10 @@ class CropHintsParams(proto.Message): provided after the 16th are ignored. """ - aspect_ratios = proto.RepeatedField(proto.FLOAT, number=1,) + aspect_ratios = proto.RepeatedField( + proto.FLOAT, + number=1, + ) class WebDetectionParams(proto.Message): @@ -519,7 +707,10 @@ class WebDetectionParams(proto.Message): geo information in the image. """ - include_geo_results = proto.Field(proto.BOOL, number=2,) + include_geo_results = proto.Field( + proto.BOOL, + number=2, + ) class TextDetectionParams(proto.Message): @@ -533,7 +724,10 @@ class TextDetectionParams(proto.Message): include confidence score for TEXT_DETECTION as well. """ - enable_text_detection_confidence_score = proto.Field(proto.BOOL, number=9,) + enable_text_detection_confidence_score = proto.Field( + proto.BOOL, + number=9, + ) class ImageContext(proto.Message): @@ -563,14 +757,29 @@ class ImageContext(proto.Message): text detection. """ - lat_long_rect = proto.Field(proto.MESSAGE, number=1, message="LatLongRect",) - language_hints = proto.RepeatedField(proto.STRING, number=2,) - crop_hints_params = proto.Field(proto.MESSAGE, number=4, message="CropHintsParams",) + lat_long_rect = proto.Field( + proto.MESSAGE, + number=1, + message="LatLongRect", + ) + language_hints = proto.RepeatedField( + proto.STRING, + number=2, + ) + crop_hints_params = proto.Field( + proto.MESSAGE, + number=4, + message="CropHintsParams", + ) web_detection_params = proto.Field( - proto.MESSAGE, number=6, message="WebDetectionParams", + proto.MESSAGE, + number=6, + message="WebDetectionParams", ) text_detection_params = proto.Field( - proto.MESSAGE, number=12, message="TextDetectionParams", + proto.MESSAGE, + number=12, + message="TextDetectionParams", ) @@ -588,9 +797,21 @@ class AnnotateImageRequest(proto.Message): image. """ - image = proto.Field(proto.MESSAGE, number=1, message="Image",) - features = proto.RepeatedField(proto.MESSAGE, number=2, message="Feature",) - image_context = proto.Field(proto.MESSAGE, number=3, message="ImageContext",) + image = proto.Field( + proto.MESSAGE, + number=1, + message="Image", + ) + features = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="Feature", + ) + image_context = proto.Field( + proto.MESSAGE, + number=3, + message="ImageContext", + ) class AnnotateImageResponse(proto.Message): @@ -636,36 +857,60 @@ class AnnotateImageResponse(proto.Message): """ face_annotations = proto.RepeatedField( - proto.MESSAGE, number=1, message="FaceAnnotation", + proto.MESSAGE, + number=1, + message="FaceAnnotation", ) landmark_annotations = proto.RepeatedField( - proto.MESSAGE, number=2, message="EntityAnnotation", + proto.MESSAGE, + number=2, + message="EntityAnnotation", ) logo_annotations = proto.RepeatedField( - proto.MESSAGE, number=3, message="EntityAnnotation", + proto.MESSAGE, + number=3, + message="EntityAnnotation", ) label_annotations = proto.RepeatedField( - proto.MESSAGE, number=4, message="EntityAnnotation", + proto.MESSAGE, + number=4, + message="EntityAnnotation", ) text_annotations = proto.RepeatedField( - proto.MESSAGE, number=5, message="EntityAnnotation", + proto.MESSAGE, + number=5, + message="EntityAnnotation", ) full_text_annotation = proto.Field( - proto.MESSAGE, number=12, message=text_annotation.TextAnnotation, + proto.MESSAGE, + number=12, + message=text_annotation.TextAnnotation, ) safe_search_annotation = proto.Field( - proto.MESSAGE, number=6, message="SafeSearchAnnotation", + proto.MESSAGE, + number=6, + message="SafeSearchAnnotation", ) image_properties_annotation = proto.Field( - proto.MESSAGE, number=8, message="ImageProperties", + proto.MESSAGE, + number=8, + message="ImageProperties", ) crop_hints_annotation = proto.Field( - proto.MESSAGE, number=11, message="CropHintsAnnotation", + proto.MESSAGE, + number=11, + message="CropHintsAnnotation", ) web_detection = proto.Field( - proto.MESSAGE, number=13, message=gcv_web_detection.WebDetection, + proto.MESSAGE, + number=13, + message=gcv_web_detection.WebDetection, + ) + error = proto.Field( + proto.MESSAGE, + number=9, + message=status_pb2.Status, ) - error = proto.Field(proto.MESSAGE, number=9, message=status_pb2.Status,) class BatchAnnotateImagesRequest(proto.Message): @@ -679,7 +924,9 @@ class BatchAnnotateImagesRequest(proto.Message): """ requests = proto.RepeatedField( - proto.MESSAGE, number=1, message="AnnotateImageRequest", + proto.MESSAGE, + number=1, + message="AnnotateImageRequest", ) @@ -693,7 +940,9 @@ class BatchAnnotateImagesResponse(proto.Message): """ responses = proto.RepeatedField( - proto.MESSAGE, number=1, message="AnnotateImageResponse", + proto.MESSAGE, + number=1, + message="AnnotateImageResponse", ) diff --git a/google/cloud/vision_v1p1beta1/types/text_annotation.py b/google/cloud/vision_v1p1beta1/types/text_annotation.py index 330ee749..2680638a 100644 --- a/google/cloud/vision_v1p1beta1/types/text_annotation.py +++ b/google/cloud/vision_v1p1beta1/types/text_annotation.py @@ -20,7 +20,14 @@ __protobuf__ = proto.module( package="google.cloud.vision.v1p1beta1", - manifest={"TextAnnotation", "Page", "Block", "Paragraph", "Word", "Symbol",}, + manifest={ + "TextAnnotation", + "Page", + "Block", + "Paragraph", + "Word", + "Symbol", + }, ) @@ -53,8 +60,14 @@ class DetectedLanguage(proto.Message): Confidence of detected language. Range [0, 1]. """ - language_code = proto.Field(proto.STRING, number=1,) - confidence = proto.Field(proto.FLOAT, number=2,) + language_code = proto.Field( + proto.STRING, + number=1, + ) + confidence = proto.Field( + proto.FLOAT, + number=2, + ) class DetectedBreak(proto.Message): r"""Detected start or end of a structural component. @@ -76,9 +89,14 @@ class BreakType(proto.Enum): LINE_BREAK = 5 type_ = proto.Field( - proto.ENUM, number=1, enum="TextAnnotation.DetectedBreak.BreakType", + proto.ENUM, + number=1, + enum="TextAnnotation.DetectedBreak.BreakType", + ) + is_prefix = proto.Field( + proto.BOOL, + number=2, ) - is_prefix = proto.Field(proto.BOOL, number=2,) class TextProperty(proto.Message): r"""Additional information detected on the structural component. @@ -92,14 +110,25 @@ class TextProperty(proto.Message): """ detected_languages = proto.RepeatedField( - proto.MESSAGE, number=1, message="TextAnnotation.DetectedLanguage", + proto.MESSAGE, + number=1, + message="TextAnnotation.DetectedLanguage", ) detected_break = proto.Field( - proto.MESSAGE, number=2, message="TextAnnotation.DetectedBreak", + proto.MESSAGE, + number=2, + message="TextAnnotation.DetectedBreak", ) - pages = proto.RepeatedField(proto.MESSAGE, number=1, message="Page",) - text = proto.Field(proto.STRING, number=2,) + pages = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Page", + ) + text = proto.Field( + proto.STRING, + number=2, + ) class Page(proto.Message): @@ -120,12 +149,27 @@ class Page(proto.Message): """ property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + width = proto.Field( + proto.INT32, + number=2, + ) + height = proto.Field( + proto.INT32, + number=3, + ) + blocks = proto.RepeatedField( + proto.MESSAGE, + number=4, + message="Block", + ) + confidence = proto.Field( + proto.FLOAT, + number=5, ) - width = proto.Field(proto.INT32, number=2,) - height = proto.Field(proto.INT32, number=3,) - blocks = proto.RepeatedField(proto.MESSAGE, number=4, message="Block",) - confidence = proto.Field(proto.FLOAT, number=5,) class Block(proto.Message): @@ -167,12 +211,29 @@ class BlockType(proto.Enum): BARCODE = 5 property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + bounding_box = proto.Field( + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + paragraphs = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="Paragraph", + ) + block_type = proto.Field( + proto.ENUM, + number=4, + enum=BlockType, + ) + confidence = proto.Field( + proto.FLOAT, + number=5, ) - bounding_box = proto.Field(proto.MESSAGE, number=2, message=geometry.BoundingPoly,) - paragraphs = proto.RepeatedField(proto.MESSAGE, number=3, message="Paragraph",) - block_type = proto.Field(proto.ENUM, number=4, enum=BlockType,) - confidence = proto.Field(proto.FLOAT, number=5,) class Paragraph(proto.Message): @@ -203,11 +264,24 @@ class Paragraph(proto.Message): """ property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + bounding_box = proto.Field( + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + words = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="Word", + ) + confidence = proto.Field( + proto.FLOAT, + number=4, ) - bounding_box = proto.Field(proto.MESSAGE, number=2, message=geometry.BoundingPoly,) - words = proto.RepeatedField(proto.MESSAGE, number=3, message="Word",) - confidence = proto.Field(proto.FLOAT, number=4,) class Word(proto.Message): @@ -237,11 +311,24 @@ class Word(proto.Message): """ property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + bounding_box = proto.Field( + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + symbols = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="Symbol", + ) + confidence = proto.Field( + proto.FLOAT, + number=4, ) - bounding_box = proto.Field(proto.MESSAGE, number=2, message=geometry.BoundingPoly,) - symbols = proto.RepeatedField(proto.MESSAGE, number=3, message="Symbol",) - confidence = proto.Field(proto.FLOAT, number=4,) class Symbol(proto.Message): @@ -271,11 +358,23 @@ class Symbol(proto.Message): """ property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + bounding_box = proto.Field( + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + text = proto.Field( + proto.STRING, + number=3, + ) + confidence = proto.Field( + proto.FLOAT, + number=4, ) - bounding_box = proto.Field(proto.MESSAGE, number=2, message=geometry.BoundingPoly,) - text = proto.Field(proto.STRING, number=3,) - confidence = proto.Field(proto.FLOAT, number=4,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/vision_v1p1beta1/types/web_detection.py b/google/cloud/vision_v1p1beta1/types/web_detection.py index 80353b81..c07b563a 100644 --- a/google/cloud/vision_v1p1beta1/types/web_detection.py +++ b/google/cloud/vision_v1p1beta1/types/web_detection.py @@ -17,7 +17,10 @@ __protobuf__ = proto.module( - package="google.cloud.vision.v1p1beta1", manifest={"WebDetection",}, + package="google.cloud.vision.v1p1beta1", + manifest={ + "WebDetection", + }, ) @@ -61,9 +64,18 @@ class WebEntity(proto.Message): English. """ - entity_id = proto.Field(proto.STRING, number=1,) - score = proto.Field(proto.FLOAT, number=2,) - description = proto.Field(proto.STRING, number=3,) + entity_id = proto.Field( + proto.STRING, + number=1, + ) + score = proto.Field( + proto.FLOAT, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) class WebImage(proto.Message): r"""Metadata for online images. @@ -76,8 +88,14 @@ class WebImage(proto.Message): image. """ - url = proto.Field(proto.STRING, number=1,) - score = proto.Field(proto.FLOAT, number=2,) + url = proto.Field( + proto.STRING, + number=1, + ) + score = proto.Field( + proto.FLOAT, + number=2, + ) class WebPage(proto.Message): r"""Metadata for web pages. @@ -102,14 +120,27 @@ class WebPage(proto.Message): crops. """ - url = proto.Field(proto.STRING, number=1,) - score = proto.Field(proto.FLOAT, number=2,) - page_title = proto.Field(proto.STRING, number=3,) + url = proto.Field( + proto.STRING, + number=1, + ) + score = proto.Field( + proto.FLOAT, + number=2, + ) + page_title = proto.Field( + proto.STRING, + number=3, + ) full_matching_images = proto.RepeatedField( - proto.MESSAGE, number=4, message="WebDetection.WebImage", + proto.MESSAGE, + number=4, + message="WebDetection.WebImage", ) partial_matching_images = proto.RepeatedField( - proto.MESSAGE, number=5, message="WebDetection.WebImage", + proto.MESSAGE, + number=5, + message="WebDetection.WebImage", ) class WebLabel(proto.Message): @@ -124,23 +155,45 @@ class WebLabel(proto.Message): http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. """ - label = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) + label = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) - web_entities = proto.RepeatedField(proto.MESSAGE, number=1, message=WebEntity,) + web_entities = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=WebEntity, + ) full_matching_images = proto.RepeatedField( - proto.MESSAGE, number=2, message=WebImage, + proto.MESSAGE, + number=2, + message=WebImage, ) partial_matching_images = proto.RepeatedField( - proto.MESSAGE, number=3, message=WebImage, + proto.MESSAGE, + number=3, + message=WebImage, ) pages_with_matching_images = proto.RepeatedField( - proto.MESSAGE, number=4, message=WebPage, + proto.MESSAGE, + number=4, + message=WebPage, ) visually_similar_images = proto.RepeatedField( - proto.MESSAGE, number=6, message=WebImage, + proto.MESSAGE, + number=6, + message=WebImage, + ) + best_guess_labels = proto.RepeatedField( + proto.MESSAGE, + number=8, + message=WebLabel, ) - best_guess_labels = proto.RepeatedField(proto.MESSAGE, number=8, message=WebLabel,) __all__ = tuple(sorted(__protobuf__.manifest)) 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 2f4bfba5..2c9685ee 100644 --- a/google/cloud/vision_v1p2beta1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1p2beta1/services/image_annotator/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -217,21 +217,20 @@ async def batch_annotate_images( r"""Run image detection and annotation for a batch of images. - .. code-block:: python from google.cloud import vision_v1p2beta1 - def sample_batch_annotate_images(): + async def sample_batch_annotate_images(): # Create a client - client = vision_v1p2beta1.ImageAnnotatorClient() + client = vision_v1p2beta1.ImageAnnotatorAsyncClient() # Initialize request argument(s) request = vision_v1p2beta1.BatchAnnotateImagesRequest( ) # Make the request - response = client.batch_annotate_images(request=request) + response = await client.batch_annotate_images(request=request) # Handle the response print(response) @@ -295,7 +294,12 @@ def sample_batch_annotate_images(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -317,14 +321,13 @@ async def async_batch_annotate_files( (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` (results). - .. code-block:: python from google.cloud import vision_v1p2beta1 - def sample_async_batch_annotate_files(): + async def sample_async_batch_annotate_files(): # Create a client - client = vision_v1p2beta1.ImageAnnotatorClient() + client = vision_v1p2beta1.ImageAnnotatorAsyncClient() # Initialize request argument(s) request = vision_v1p2beta1.AsyncBatchAnnotateFilesRequest( @@ -335,7 +338,7 @@ def sample_async_batch_annotate_files(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -402,7 +405,12 @@ def sample_async_batch_annotate_files(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -424,7 +432,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/vision_v1p2beta1/services/image_annotator/client.py b/google/cloud/vision_v1p2beta1/services/image_annotator/client.py index aab08015..9632242a 100644 --- a/google/cloud/vision_v1p2beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p2beta1/services/image_annotator/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -56,7 +56,10 @@ class ImageAnnotatorClientMeta(type): _transport_registry["grpc"] = ImageAnnotatorGrpcTransport _transport_registry["grpc_asyncio"] = ImageAnnotatorGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[ImageAnnotatorTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ImageAnnotatorTransport]: """Returns an appropriate transport class. Args: @@ -165,7 +168,9 @@ def transport(self) -> ImageAnnotatorTransport: return self._transport @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -178,9 +183,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -189,9 +198,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -200,9 +213,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -211,10 +228,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -400,7 +421,6 @@ def batch_annotate_images( r"""Run image detection and annotation for a batch of images. - .. code-block:: python from google.cloud import vision_v1p2beta1 @@ -471,7 +491,12 @@ def sample_batch_annotate_images(): rpc = self._transport._wrapped_methods[self._transport.batch_annotate_images] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -493,7 +518,6 @@ def async_batch_annotate_files( (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` (results). - .. code-block:: python from google.cloud import vision_v1p2beta1 @@ -573,7 +597,12 @@ def sample_async_batch_annotate_files(): ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -602,7 +631,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() 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 ea0aaf20..47b9bff8 100644 --- a/google/cloud/vision_v1p2beta1/services/image_annotator/transports/base.py +++ b/google/cloud/vision_v1p2beta1/services/image_annotator/transports/base.py @@ -31,7 +31,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -83,6 +85,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -158,9 +161,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -190,5 +193,9 @@ def async_batch_annotate_files( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("ImageAnnotatorTransport",) 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 5d439352..0287c6b1 100644 --- a/google/cloud/vision_v1p2beta1/services/image_annotator/transports/grpc.py +++ b/google/cloud/vision_v1p2beta1/services/image_annotator/transports/grpc.py @@ -230,8 +230,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -315,5 +314,9 @@ def async_batch_annotate_files( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("ImageAnnotatorGrpcTransport",) diff --git a/google/cloud/vision_v1p2beta1/types/__init__.py b/google/cloud/vision_v1p2beta1/types/__init__.py index a250a877..491bd408 100644 --- a/google/cloud/vision_v1p2beta1/types/__init__.py +++ b/google/cloud/vision_v1p2beta1/types/__init__.py @@ -63,7 +63,9 @@ TextAnnotation, Word, ) -from .web_detection import WebDetection +from .web_detection import ( + WebDetection, +) __all__ = ( "BoundingPoly", diff --git a/google/cloud/vision_v1p2beta1/types/geometry.py b/google/cloud/vision_v1p2beta1/types/geometry.py index 229dd576..494de04e 100644 --- a/google/cloud/vision_v1p2beta1/types/geometry.py +++ b/google/cloud/vision_v1p2beta1/types/geometry.py @@ -18,7 +18,12 @@ __protobuf__ = proto.module( package="google.cloud.vision.v1p2beta1", - manifest={"Vertex", "NormalizedVertex", "BoundingPoly", "Position",}, + manifest={ + "Vertex", + "NormalizedVertex", + "BoundingPoly", + "Position", + }, ) @@ -34,8 +39,14 @@ class Vertex(proto.Message): Y coordinate. """ - x = proto.Field(proto.INT32, number=1,) - y = proto.Field(proto.INT32, number=2,) + x = proto.Field( + proto.INT32, + number=1, + ) + y = proto.Field( + proto.INT32, + number=2, + ) class NormalizedVertex(proto.Message): @@ -50,8 +61,14 @@ class NormalizedVertex(proto.Message): Y coordinate. """ - x = proto.Field(proto.FLOAT, number=1,) - y = proto.Field(proto.FLOAT, number=2,) + x = proto.Field( + proto.FLOAT, + number=1, + ) + y = proto.Field( + proto.FLOAT, + number=2, + ) class BoundingPoly(proto.Message): @@ -64,9 +81,15 @@ class BoundingPoly(proto.Message): The bounding polygon normalized vertices. """ - vertices = proto.RepeatedField(proto.MESSAGE, number=1, message="Vertex",) + vertices = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Vertex", + ) normalized_vertices = proto.RepeatedField( - proto.MESSAGE, number=2, message="NormalizedVertex", + proto.MESSAGE, + number=2, + message="NormalizedVertex", ) @@ -85,9 +108,18 @@ class Position(proto.Message): Z coordinate (or depth). """ - x = proto.Field(proto.FLOAT, number=1,) - y = proto.Field(proto.FLOAT, number=2,) - z = proto.Field(proto.FLOAT, number=3,) + x = proto.Field( + proto.FLOAT, + number=1, + ) + y = proto.Field( + proto.FLOAT, + number=2, + ) + z = proto.Field( + proto.FLOAT, + number=3, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/vision_v1p2beta1/types/image_annotator.py b/google/cloud/vision_v1p2beta1/types/image_annotator.py index 3e366baf..d058badb 100644 --- a/google/cloud/vision_v1p2beta1/types/image_annotator.py +++ b/google/cloud/vision_v1p2beta1/types/image_annotator.py @@ -109,9 +109,19 @@ class Type(proto.Enum): CROP_HINTS = 9 WEB_DETECTION = 10 - type_ = proto.Field(proto.ENUM, number=1, enum=Type,) - max_results = proto.Field(proto.INT32, number=2,) - model = proto.Field(proto.STRING, number=3,) + type_ = proto.Field( + proto.ENUM, + number=1, + enum=Type, + ) + max_results = proto.Field( + proto.INT32, + number=2, + ) + model = proto.Field( + proto.STRING, + number=3, + ) class ImageSource(proto.Message): @@ -149,8 +159,14 @@ class ImageSource(proto.Message): ``image_uri`` takes precedence. """ - gcs_image_uri = proto.Field(proto.STRING, number=1,) - image_uri = proto.Field(proto.STRING, number=2,) + gcs_image_uri = proto.Field( + proto.STRING, + number=1, + ) + image_uri = proto.Field( + proto.STRING, + number=2, + ) class Image(proto.Message): @@ -168,8 +184,15 @@ class Image(proto.Message): perform the image annotation request. """ - content = proto.Field(proto.BYTES, number=1,) - source = proto.Field(proto.MESSAGE, number=2, message="ImageSource",) + content = proto.Field( + proto.BYTES, + number=1, + ) + source = proto.Field( + proto.MESSAGE, + number=2, + message="ImageSource", + ) class FaceAnnotation(proto.Message): @@ -281,26 +304,87 @@ class Type(proto.Enum): CHIN_LEFT_GONION = 33 CHIN_RIGHT_GONION = 34 - type_ = proto.Field(proto.ENUM, number=3, enum="FaceAnnotation.Landmark.Type",) - position = proto.Field(proto.MESSAGE, number=4, message=geometry.Position,) - - bounding_poly = proto.Field(proto.MESSAGE, number=1, message=geometry.BoundingPoly,) + type_ = proto.Field( + proto.ENUM, + number=3, + enum="FaceAnnotation.Landmark.Type", + ) + position = proto.Field( + proto.MESSAGE, + number=4, + message=geometry.Position, + ) + + bounding_poly = proto.Field( + proto.MESSAGE, + number=1, + message=geometry.BoundingPoly, + ) fd_bounding_poly = proto.Field( - proto.MESSAGE, number=2, message=geometry.BoundingPoly, - ) - landmarks = proto.RepeatedField(proto.MESSAGE, number=3, message=Landmark,) - roll_angle = proto.Field(proto.FLOAT, number=4,) - pan_angle = proto.Field(proto.FLOAT, number=5,) - tilt_angle = proto.Field(proto.FLOAT, number=6,) - detection_confidence = proto.Field(proto.FLOAT, number=7,) - landmarking_confidence = proto.Field(proto.FLOAT, number=8,) - joy_likelihood = proto.Field(proto.ENUM, number=9, enum="Likelihood",) - sorrow_likelihood = proto.Field(proto.ENUM, number=10, enum="Likelihood",) - anger_likelihood = proto.Field(proto.ENUM, number=11, enum="Likelihood",) - surprise_likelihood = proto.Field(proto.ENUM, number=12, enum="Likelihood",) - under_exposed_likelihood = proto.Field(proto.ENUM, number=13, enum="Likelihood",) - blurred_likelihood = proto.Field(proto.ENUM, number=14, enum="Likelihood",) - headwear_likelihood = proto.Field(proto.ENUM, number=15, enum="Likelihood",) + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + landmarks = proto.RepeatedField( + proto.MESSAGE, + number=3, + message=Landmark, + ) + roll_angle = proto.Field( + proto.FLOAT, + number=4, + ) + pan_angle = proto.Field( + proto.FLOAT, + number=5, + ) + tilt_angle = proto.Field( + proto.FLOAT, + number=6, + ) + detection_confidence = proto.Field( + proto.FLOAT, + number=7, + ) + landmarking_confidence = proto.Field( + proto.FLOAT, + number=8, + ) + joy_likelihood = proto.Field( + proto.ENUM, + number=9, + enum="Likelihood", + ) + sorrow_likelihood = proto.Field( + proto.ENUM, + number=10, + enum="Likelihood", + ) + anger_likelihood = proto.Field( + proto.ENUM, + number=11, + enum="Likelihood", + ) + surprise_likelihood = proto.Field( + proto.ENUM, + number=12, + enum="Likelihood", + ) + under_exposed_likelihood = proto.Field( + proto.ENUM, + number=13, + enum="Likelihood", + ) + blurred_likelihood = proto.Field( + proto.ENUM, + number=14, + enum="Likelihood", + ) + headwear_likelihood = proto.Field( + proto.ENUM, + number=15, + enum="Likelihood", + ) class LocationInfo(proto.Message): @@ -311,7 +395,11 @@ class LocationInfo(proto.Message): lat/long location coordinates. """ - lat_lng = proto.Field(proto.MESSAGE, number=1, message=latlng_pb2.LatLng,) + lat_lng = proto.Field( + proto.MESSAGE, + number=1, + message=latlng_pb2.LatLng, + ) class Property(proto.Message): @@ -326,9 +414,18 @@ class Property(proto.Message): Value of numeric properties. """ - name = proto.Field(proto.STRING, number=1,) - value = proto.Field(proto.STRING, number=2,) - uint64_value = proto.Field(proto.UINT64, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + value = proto.Field( + proto.STRING, + number=2, + ) + uint64_value = proto.Field( + proto.UINT64, + number=3, + ) class EntityAnnotation(proto.Message): @@ -376,15 +473,45 @@ class EntityAnnotation(proto.Message): the entity. """ - mid = proto.Field(proto.STRING, number=1,) - locale = proto.Field(proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) - score = proto.Field(proto.FLOAT, number=4,) - confidence = proto.Field(proto.FLOAT, number=5,) - topicality = proto.Field(proto.FLOAT, number=6,) - bounding_poly = proto.Field(proto.MESSAGE, number=7, message=geometry.BoundingPoly,) - locations = proto.RepeatedField(proto.MESSAGE, number=8, message="LocationInfo",) - properties = proto.RepeatedField(proto.MESSAGE, number=9, message="Property",) + mid = proto.Field( + proto.STRING, + number=1, + ) + locale = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) + score = proto.Field( + proto.FLOAT, + number=4, + ) + confidence = proto.Field( + proto.FLOAT, + number=5, + ) + topicality = proto.Field( + proto.FLOAT, + number=6, + ) + bounding_poly = proto.Field( + proto.MESSAGE, + number=7, + message=geometry.BoundingPoly, + ) + locations = proto.RepeatedField( + proto.MESSAGE, + number=8, + message="LocationInfo", + ) + properties = proto.RepeatedField( + proto.MESSAGE, + number=9, + message="Property", + ) class SafeSearchAnnotation(proto.Message): @@ -416,11 +543,31 @@ class SafeSearchAnnotation(proto.Message): body areas. """ - adult = proto.Field(proto.ENUM, number=1, enum="Likelihood",) - spoof = proto.Field(proto.ENUM, number=2, enum="Likelihood",) - medical = proto.Field(proto.ENUM, number=3, enum="Likelihood",) - violence = proto.Field(proto.ENUM, number=4, enum="Likelihood",) - racy = proto.Field(proto.ENUM, number=9, enum="Likelihood",) + adult = proto.Field( + proto.ENUM, + number=1, + enum="Likelihood", + ) + spoof = proto.Field( + proto.ENUM, + number=2, + enum="Likelihood", + ) + medical = proto.Field( + proto.ENUM, + number=3, + enum="Likelihood", + ) + violence = proto.Field( + proto.ENUM, + number=4, + enum="Likelihood", + ) + racy = proto.Field( + proto.ENUM, + number=9, + enum="Likelihood", + ) class LatLongRect(proto.Message): @@ -433,8 +580,16 @@ class LatLongRect(proto.Message): Max lat/long pair. """ - min_lat_lng = proto.Field(proto.MESSAGE, number=1, message=latlng_pb2.LatLng,) - max_lat_lng = proto.Field(proto.MESSAGE, number=2, message=latlng_pb2.LatLng,) + min_lat_lng = proto.Field( + proto.MESSAGE, + number=1, + message=latlng_pb2.LatLng, + ) + max_lat_lng = proto.Field( + proto.MESSAGE, + number=2, + message=latlng_pb2.LatLng, + ) class ColorInfo(proto.Message): @@ -451,9 +606,19 @@ class ColorInfo(proto.Message): Value in range [0, 1]. """ - color = proto.Field(proto.MESSAGE, number=1, message=color_pb2.Color,) - score = proto.Field(proto.FLOAT, number=2,) - pixel_fraction = proto.Field(proto.FLOAT, number=3,) + color = proto.Field( + proto.MESSAGE, + number=1, + message=color_pb2.Color, + ) + score = proto.Field( + proto.FLOAT, + number=2, + ) + pixel_fraction = proto.Field( + proto.FLOAT, + number=3, + ) class DominantColorsAnnotation(proto.Message): @@ -465,7 +630,11 @@ class DominantColorsAnnotation(proto.Message): fraction. """ - colors = proto.RepeatedField(proto.MESSAGE, number=1, message="ColorInfo",) + colors = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="ColorInfo", + ) class ImageProperties(proto.Message): @@ -478,7 +647,9 @@ class ImageProperties(proto.Message): """ dominant_colors = proto.Field( - proto.MESSAGE, number=1, message="DominantColorsAnnotation", + proto.MESSAGE, + number=1, + message="DominantColorsAnnotation", ) @@ -498,9 +669,19 @@ class CropHint(proto.Message): with respect to the original image. """ - bounding_poly = proto.Field(proto.MESSAGE, number=1, message=geometry.BoundingPoly,) - confidence = proto.Field(proto.FLOAT, number=2,) - importance_fraction = proto.Field(proto.FLOAT, number=3,) + bounding_poly = proto.Field( + proto.MESSAGE, + number=1, + message=geometry.BoundingPoly, + ) + confidence = proto.Field( + proto.FLOAT, + number=2, + ) + importance_fraction = proto.Field( + proto.FLOAT, + number=3, + ) class CropHintsAnnotation(proto.Message): @@ -512,7 +693,11 @@ class CropHintsAnnotation(proto.Message): Crop hint results. """ - crop_hints = proto.RepeatedField(proto.MESSAGE, number=1, message="CropHint",) + crop_hints = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="CropHint", + ) class CropHintsParams(proto.Message): @@ -530,7 +715,10 @@ class CropHintsParams(proto.Message): provided after the 16th are ignored. """ - aspect_ratios = proto.RepeatedField(proto.FLOAT, number=1,) + aspect_ratios = proto.RepeatedField( + proto.FLOAT, + number=1, + ) class WebDetectionParams(proto.Message): @@ -542,7 +730,10 @@ class WebDetectionParams(proto.Message): geo information in the image. """ - include_geo_results = proto.Field(proto.BOOL, number=2,) + include_geo_results = proto.Field( + proto.BOOL, + number=2, + ) class TextDetectionParams(proto.Message): @@ -556,7 +747,10 @@ class TextDetectionParams(proto.Message): include confidence score for TEXT_DETECTION as well. """ - enable_text_detection_confidence_score = proto.Field(proto.BOOL, number=9,) + enable_text_detection_confidence_score = proto.Field( + proto.BOOL, + number=9, + ) class ImageContext(proto.Message): @@ -585,14 +779,29 @@ class ImageContext(proto.Message): text detection. """ - lat_long_rect = proto.Field(proto.MESSAGE, number=1, message="LatLongRect",) - language_hints = proto.RepeatedField(proto.STRING, number=2,) - crop_hints_params = proto.Field(proto.MESSAGE, number=4, message="CropHintsParams",) + lat_long_rect = proto.Field( + proto.MESSAGE, + number=1, + message="LatLongRect", + ) + language_hints = proto.RepeatedField( + proto.STRING, + number=2, + ) + crop_hints_params = proto.Field( + proto.MESSAGE, + number=4, + message="CropHintsParams", + ) web_detection_params = proto.Field( - proto.MESSAGE, number=6, message="WebDetectionParams", + proto.MESSAGE, + number=6, + message="WebDetectionParams", ) text_detection_params = proto.Field( - proto.MESSAGE, number=12, message="TextDetectionParams", + proto.MESSAGE, + number=12, + message="TextDetectionParams", ) @@ -610,9 +819,21 @@ class AnnotateImageRequest(proto.Message): image. """ - image = proto.Field(proto.MESSAGE, number=1, message="Image",) - features = proto.RepeatedField(proto.MESSAGE, number=2, message="Feature",) - image_context = proto.Field(proto.MESSAGE, number=3, message="ImageContext",) + image = proto.Field( + proto.MESSAGE, + number=1, + message="Image", + ) + features = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="Feature", + ) + image_context = proto.Field( + proto.MESSAGE, + number=3, + message="ImageContext", + ) class ImageAnnotationContext(proto.Message): @@ -629,8 +850,14 @@ class ImageAnnotationContext(proto.Message): produce the image. """ - uri = proto.Field(proto.STRING, number=1,) - page_number = proto.Field(proto.INT32, number=2,) + uri = proto.Field( + proto.STRING, + number=1, + ) + page_number = proto.Field( + proto.INT32, + number=2, + ) class AnnotateImageResponse(proto.Message): @@ -679,37 +906,65 @@ class AnnotateImageResponse(proto.Message): """ face_annotations = proto.RepeatedField( - proto.MESSAGE, number=1, message="FaceAnnotation", + proto.MESSAGE, + number=1, + message="FaceAnnotation", ) landmark_annotations = proto.RepeatedField( - proto.MESSAGE, number=2, message="EntityAnnotation", + proto.MESSAGE, + number=2, + message="EntityAnnotation", ) logo_annotations = proto.RepeatedField( - proto.MESSAGE, number=3, message="EntityAnnotation", + proto.MESSAGE, + number=3, + message="EntityAnnotation", ) label_annotations = proto.RepeatedField( - proto.MESSAGE, number=4, message="EntityAnnotation", + proto.MESSAGE, + number=4, + message="EntityAnnotation", ) text_annotations = proto.RepeatedField( - proto.MESSAGE, number=5, message="EntityAnnotation", + proto.MESSAGE, + number=5, + message="EntityAnnotation", ) full_text_annotation = proto.Field( - proto.MESSAGE, number=12, message=text_annotation.TextAnnotation, + proto.MESSAGE, + number=12, + message=text_annotation.TextAnnotation, ) safe_search_annotation = proto.Field( - proto.MESSAGE, number=6, message="SafeSearchAnnotation", + proto.MESSAGE, + number=6, + message="SafeSearchAnnotation", ) image_properties_annotation = proto.Field( - proto.MESSAGE, number=8, message="ImageProperties", + proto.MESSAGE, + number=8, + message="ImageProperties", ) crop_hints_annotation = proto.Field( - proto.MESSAGE, number=11, message="CropHintsAnnotation", + proto.MESSAGE, + number=11, + message="CropHintsAnnotation", ) web_detection = proto.Field( - proto.MESSAGE, number=13, message=gcv_web_detection.WebDetection, + proto.MESSAGE, + number=13, + message=gcv_web_detection.WebDetection, + ) + error = proto.Field( + proto.MESSAGE, + number=9, + message=status_pb2.Status, + ) + context = proto.Field( + proto.MESSAGE, + number=21, + message="ImageAnnotationContext", ) - error = proto.Field(proto.MESSAGE, number=9, message=status_pb2.Status,) - context = proto.Field(proto.MESSAGE, number=21, message="ImageAnnotationContext",) class AnnotateFileResponse(proto.Message): @@ -726,9 +981,15 @@ class AnnotateFileResponse(proto.Message): the file. """ - input_config = proto.Field(proto.MESSAGE, number=1, message="InputConfig",) + input_config = proto.Field( + proto.MESSAGE, + number=1, + message="InputConfig", + ) responses = proto.RepeatedField( - proto.MESSAGE, number=2, message="AnnotateImageResponse", + proto.MESSAGE, + number=2, + message="AnnotateImageResponse", ) @@ -743,7 +1004,9 @@ class BatchAnnotateImagesRequest(proto.Message): """ requests = proto.RepeatedField( - proto.MESSAGE, number=1, message="AnnotateImageRequest", + proto.MESSAGE, + number=1, + message="AnnotateImageRequest", ) @@ -757,7 +1020,9 @@ class BatchAnnotateImagesResponse(proto.Message): """ responses = proto.RepeatedField( - proto.MESSAGE, number=1, message="AnnotateImageResponse", + proto.MESSAGE, + number=1, + message="AnnotateImageResponse", ) @@ -777,10 +1042,26 @@ class AsyncAnnotateFileRequest(proto.Message): metadata (e.g. format). """ - input_config = proto.Field(proto.MESSAGE, number=1, message="InputConfig",) - features = proto.RepeatedField(proto.MESSAGE, number=2, message="Feature",) - image_context = proto.Field(proto.MESSAGE, number=3, message="ImageContext",) - output_config = proto.Field(proto.MESSAGE, number=4, message="OutputConfig",) + input_config = proto.Field( + proto.MESSAGE, + number=1, + message="InputConfig", + ) + features = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="Feature", + ) + image_context = proto.Field( + proto.MESSAGE, + number=3, + message="ImageContext", + ) + output_config = proto.Field( + proto.MESSAGE, + number=4, + message="OutputConfig", + ) class AsyncAnnotateFileResponse(proto.Message): @@ -792,7 +1073,11 @@ class AsyncAnnotateFileResponse(proto.Message): AsyncAnnotateFileRequest. """ - output_config = proto.Field(proto.MESSAGE, number=1, message="OutputConfig",) + output_config = proto.Field( + proto.MESSAGE, + number=1, + message="OutputConfig", + ) class AsyncBatchAnnotateFilesRequest(proto.Message): @@ -806,7 +1091,9 @@ class AsyncBatchAnnotateFilesRequest(proto.Message): """ requests = proto.RepeatedField( - proto.MESSAGE, number=1, message="AsyncAnnotateFileRequest", + proto.MESSAGE, + number=1, + message="AsyncAnnotateFileRequest", ) @@ -821,7 +1108,9 @@ class AsyncBatchAnnotateFilesResponse(proto.Message): """ responses = proto.RepeatedField( - proto.MESSAGE, number=1, message="AsyncAnnotateFileResponse", + proto.MESSAGE, + number=1, + message="AsyncAnnotateFileResponse", ) @@ -838,8 +1127,15 @@ class InputConfig(proto.Message): supported. Wildcards are not supported. """ - gcs_source = proto.Field(proto.MESSAGE, number=1, message="GcsSource",) - mime_type = proto.Field(proto.STRING, number=2,) + gcs_source = proto.Field( + proto.MESSAGE, + number=1, + message="GcsSource", + ) + mime_type = proto.Field( + proto.STRING, + number=2, + ) class OutputConfig(proto.Message): @@ -863,8 +1159,15 @@ class OutputConfig(proto.Message): potential future support for other output configurations. """ - gcs_destination = proto.Field(proto.MESSAGE, number=1, message="GcsDestination",) - batch_size = proto.Field(proto.INT32, number=2,) + gcs_destination = proto.Field( + proto.MESSAGE, + number=1, + message="GcsDestination", + ) + batch_size = proto.Field( + proto.INT32, + number=2, + ) class GcsSource(proto.Message): @@ -878,7 +1181,10 @@ class GcsSource(proto.Message): not currently supported. """ - uri = proto.Field(proto.STRING, number=1,) + uri = proto.Field( + proto.STRING, + number=1, + ) class GcsDestination(proto.Message): @@ -906,7 +1212,10 @@ class GcsDestination(proto.Message): overflows into multiple sharded files. """ - uri = proto.Field(proto.STRING, number=1,) + uri = proto.Field( + proto.STRING, + number=1, + ) class OperationMetadata(proto.Message): @@ -930,9 +1239,21 @@ class State(proto.Enum): DONE = 3 CANCELLED = 4 - state = proto.Field(proto.ENUM, number=1, enum=State,) - create_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,) + state = proto.Field( + proto.ENUM, + number=1, + enum=State, + ) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/vision_v1p2beta1/types/text_annotation.py b/google/cloud/vision_v1p2beta1/types/text_annotation.py index 7ca0670d..636e6e01 100644 --- a/google/cloud/vision_v1p2beta1/types/text_annotation.py +++ b/google/cloud/vision_v1p2beta1/types/text_annotation.py @@ -20,7 +20,14 @@ __protobuf__ = proto.module( package="google.cloud.vision.v1p2beta1", - manifest={"TextAnnotation", "Page", "Block", "Paragraph", "Word", "Symbol",}, + manifest={ + "TextAnnotation", + "Page", + "Block", + "Paragraph", + "Word", + "Symbol", + }, ) @@ -53,8 +60,14 @@ class DetectedLanguage(proto.Message): Confidence of detected language. Range [0, 1]. """ - language_code = proto.Field(proto.STRING, number=1,) - confidence = proto.Field(proto.FLOAT, number=2,) + language_code = proto.Field( + proto.STRING, + number=1, + ) + confidence = proto.Field( + proto.FLOAT, + number=2, + ) class DetectedBreak(proto.Message): r"""Detected start or end of a structural component. @@ -76,9 +89,14 @@ class BreakType(proto.Enum): LINE_BREAK = 5 type_ = proto.Field( - proto.ENUM, number=1, enum="TextAnnotation.DetectedBreak.BreakType", + proto.ENUM, + number=1, + enum="TextAnnotation.DetectedBreak.BreakType", + ) + is_prefix = proto.Field( + proto.BOOL, + number=2, ) - is_prefix = proto.Field(proto.BOOL, number=2,) class TextProperty(proto.Message): r"""Additional information detected on the structural component. @@ -92,14 +110,25 @@ class TextProperty(proto.Message): """ detected_languages = proto.RepeatedField( - proto.MESSAGE, number=1, message="TextAnnotation.DetectedLanguage", + proto.MESSAGE, + number=1, + message="TextAnnotation.DetectedLanguage", ) detected_break = proto.Field( - proto.MESSAGE, number=2, message="TextAnnotation.DetectedBreak", + proto.MESSAGE, + number=2, + message="TextAnnotation.DetectedBreak", ) - pages = proto.RepeatedField(proto.MESSAGE, number=1, message="Page",) - text = proto.Field(proto.STRING, number=2,) + pages = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Page", + ) + text = proto.Field( + proto.STRING, + number=2, + ) class Page(proto.Message): @@ -122,12 +151,27 @@ class Page(proto.Message): """ property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + width = proto.Field( + proto.INT32, + number=2, + ) + height = proto.Field( + proto.INT32, + number=3, + ) + blocks = proto.RepeatedField( + proto.MESSAGE, + number=4, + message="Block", + ) + confidence = proto.Field( + proto.FLOAT, + number=5, ) - width = proto.Field(proto.INT32, number=2,) - height = proto.Field(proto.INT32, number=3,) - blocks = proto.RepeatedField(proto.MESSAGE, number=4, message="Block",) - confidence = proto.Field(proto.FLOAT, number=5,) class Block(proto.Message): @@ -182,12 +226,29 @@ class BlockType(proto.Enum): BARCODE = 5 property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + bounding_box = proto.Field( + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + paragraphs = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="Paragraph", + ) + block_type = proto.Field( + proto.ENUM, + number=4, + enum=BlockType, + ) + confidence = proto.Field( + proto.FLOAT, + number=5, ) - bounding_box = proto.Field(proto.MESSAGE, number=2, message=geometry.BoundingPoly,) - paragraphs = proto.RepeatedField(proto.MESSAGE, number=3, message="Paragraph",) - block_type = proto.Field(proto.ENUM, number=4, enum=BlockType,) - confidence = proto.Field(proto.FLOAT, number=5,) class Paragraph(proto.Message): @@ -218,11 +279,24 @@ class Paragraph(proto.Message): """ property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + bounding_box = proto.Field( + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + words = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="Word", + ) + confidence = proto.Field( + proto.FLOAT, + number=4, ) - bounding_box = proto.Field(proto.MESSAGE, number=2, message=geometry.BoundingPoly,) - words = proto.RepeatedField(proto.MESSAGE, number=3, message="Word",) - confidence = proto.Field(proto.FLOAT, number=4,) class Word(proto.Message): @@ -252,11 +326,24 @@ class Word(proto.Message): """ property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + bounding_box = proto.Field( + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + symbols = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="Symbol", + ) + confidence = proto.Field( + proto.FLOAT, + number=4, ) - bounding_box = proto.Field(proto.MESSAGE, number=2, message=geometry.BoundingPoly,) - symbols = proto.RepeatedField(proto.MESSAGE, number=3, message="Symbol",) - confidence = proto.Field(proto.FLOAT, number=4,) class Symbol(proto.Message): @@ -286,11 +373,23 @@ class Symbol(proto.Message): """ property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + bounding_box = proto.Field( + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + text = proto.Field( + proto.STRING, + number=3, + ) + confidence = proto.Field( + proto.FLOAT, + number=4, ) - bounding_box = proto.Field(proto.MESSAGE, number=2, message=geometry.BoundingPoly,) - text = proto.Field(proto.STRING, number=3,) - confidence = proto.Field(proto.FLOAT, number=4,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/vision_v1p2beta1/types/web_detection.py b/google/cloud/vision_v1p2beta1/types/web_detection.py index 1decb343..4fca0f68 100644 --- a/google/cloud/vision_v1p2beta1/types/web_detection.py +++ b/google/cloud/vision_v1p2beta1/types/web_detection.py @@ -17,7 +17,10 @@ __protobuf__ = proto.module( - package="google.cloud.vision.v1p2beta1", manifest={"WebDetection",}, + package="google.cloud.vision.v1p2beta1", + manifest={ + "WebDetection", + }, ) @@ -61,9 +64,18 @@ class WebEntity(proto.Message): English. """ - entity_id = proto.Field(proto.STRING, number=1,) - score = proto.Field(proto.FLOAT, number=2,) - description = proto.Field(proto.STRING, number=3,) + entity_id = proto.Field( + proto.STRING, + number=1, + ) + score = proto.Field( + proto.FLOAT, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) class WebImage(proto.Message): r"""Metadata for online images. @@ -76,8 +88,14 @@ class WebImage(proto.Message): image. """ - url = proto.Field(proto.STRING, number=1,) - score = proto.Field(proto.FLOAT, number=2,) + url = proto.Field( + proto.STRING, + number=1, + ) + score = proto.Field( + proto.FLOAT, + number=2, + ) class WebPage(proto.Message): r"""Metadata for web pages. @@ -102,14 +120,27 @@ class WebPage(proto.Message): crops. """ - url = proto.Field(proto.STRING, number=1,) - score = proto.Field(proto.FLOAT, number=2,) - page_title = proto.Field(proto.STRING, number=3,) + url = proto.Field( + proto.STRING, + number=1, + ) + score = proto.Field( + proto.FLOAT, + number=2, + ) + page_title = proto.Field( + proto.STRING, + number=3, + ) full_matching_images = proto.RepeatedField( - proto.MESSAGE, number=4, message="WebDetection.WebImage", + proto.MESSAGE, + number=4, + message="WebDetection.WebImage", ) partial_matching_images = proto.RepeatedField( - proto.MESSAGE, number=5, message="WebDetection.WebImage", + proto.MESSAGE, + number=5, + message="WebDetection.WebImage", ) class WebLabel(proto.Message): @@ -124,23 +155,45 @@ class WebLabel(proto.Message): http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. """ - label = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) + label = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) - web_entities = proto.RepeatedField(proto.MESSAGE, number=1, message=WebEntity,) + web_entities = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=WebEntity, + ) full_matching_images = proto.RepeatedField( - proto.MESSAGE, number=2, message=WebImage, + proto.MESSAGE, + number=2, + message=WebImage, ) partial_matching_images = proto.RepeatedField( - proto.MESSAGE, number=3, message=WebImage, + proto.MESSAGE, + number=3, + message=WebImage, ) pages_with_matching_images = proto.RepeatedField( - proto.MESSAGE, number=4, message=WebPage, + proto.MESSAGE, + number=4, + message=WebPage, ) visually_similar_images = proto.RepeatedField( - proto.MESSAGE, number=6, message=WebImage, + proto.MESSAGE, + number=6, + message=WebImage, + ) + best_guess_labels = proto.RepeatedField( + proto.MESSAGE, + number=8, + message=WebLabel, ) - best_guess_labels = proto.RepeatedField(proto.MESSAGE, number=8, message=WebLabel,) __all__ = tuple(sorted(__protobuf__.manifest)) 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 cebc83e0..d34557f1 100644 --- a/google/cloud/vision_v1p3beta1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1p3beta1/services/image_annotator/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -221,21 +221,20 @@ async def batch_annotate_images( r"""Run image detection and annotation for a batch of images. - .. code-block:: python from google.cloud import vision_v1p3beta1 - def sample_batch_annotate_images(): + async def sample_batch_annotate_images(): # Create a client - client = vision_v1p3beta1.ImageAnnotatorClient() + client = vision_v1p3beta1.ImageAnnotatorAsyncClient() # Initialize request argument(s) request = vision_v1p3beta1.BatchAnnotateImagesRequest( ) # Make the request - response = client.batch_annotate_images(request=request) + response = await client.batch_annotate_images(request=request) # Handle the response print(response) @@ -299,7 +298,12 @@ def sample_batch_annotate_images(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -321,14 +325,13 @@ async def async_batch_annotate_files( (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` (results). - .. code-block:: python from google.cloud import vision_v1p3beta1 - def sample_async_batch_annotate_files(): + async def sample_async_batch_annotate_files(): # Create a client - client = vision_v1p3beta1.ImageAnnotatorClient() + client = vision_v1p3beta1.ImageAnnotatorAsyncClient() # Initialize request argument(s) request = vision_v1p3beta1.AsyncBatchAnnotateFilesRequest( @@ -339,7 +342,7 @@ def sample_async_batch_annotate_files(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -403,7 +406,12 @@ def sample_async_batch_annotate_files(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -425,7 +433,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/vision_v1p3beta1/services/image_annotator/client.py b/google/cloud/vision_v1p3beta1/services/image_annotator/client.py index 634f2f5d..c1dd3121 100644 --- a/google/cloud/vision_v1p3beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p3beta1/services/image_annotator/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -56,7 +56,10 @@ class ImageAnnotatorClientMeta(type): _transport_registry["grpc"] = ImageAnnotatorGrpcTransport _transport_registry["grpc_asyncio"] = ImageAnnotatorGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[ImageAnnotatorTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ImageAnnotatorTransport]: """Returns an appropriate transport class. Args: @@ -165,10 +168,16 @@ def transport(self) -> ImageAnnotatorTransport: return self._transport @staticmethod - def product_path(project: str, location: str, product: str,) -> str: + def product_path( + project: str, + location: str, + product: str, + ) -> str: """Returns a fully-qualified product string.""" return "projects/{project}/locations/{location}/products/{product}".format( - project=project, location=location, product=product, + project=project, + location=location, + product=product, ) @staticmethod @@ -181,10 +190,18 @@ def parse_product_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def product_set_path(project: str, location: str, product_set: str,) -> str: + def product_set_path( + project: str, + location: str, + product_set: str, + ) -> str: """Returns a fully-qualified product_set string.""" - return "projects/{project}/locations/{location}/productSets/{product_set}".format( - project=project, location=location, product_set=product_set, + return ( + "projects/{project}/locations/{location}/productSets/{product_set}".format( + project=project, + location=location, + product_set=product_set, + ) ) @staticmethod @@ -197,7 +214,9 @@ def parse_product_set_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -210,9 +229,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -221,9 +244,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -232,9 +259,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -243,10 +274,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -432,7 +467,6 @@ def batch_annotate_images( r"""Run image detection and annotation for a batch of images. - .. code-block:: python from google.cloud import vision_v1p3beta1 @@ -503,7 +537,12 @@ def sample_batch_annotate_images(): rpc = self._transport._wrapped_methods[self._transport.batch_annotate_images] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -525,7 +564,6 @@ def async_batch_annotate_files( (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` (results). - .. code-block:: python from google.cloud import vision_v1p3beta1 @@ -605,7 +643,12 @@ def sample_async_batch_annotate_files(): ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -634,7 +677,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() 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 968ae564..bead6953 100644 --- a/google/cloud/vision_v1p3beta1/services/image_annotator/transports/base.py +++ b/google/cloud/vision_v1p3beta1/services/image_annotator/transports/base.py @@ -31,7 +31,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -83,6 +85,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -155,9 +158,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -187,5 +190,9 @@ def async_batch_annotate_files( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("ImageAnnotatorTransport",) 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 af8ce36f..3ad0d698 100644 --- a/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc.py +++ b/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc.py @@ -230,8 +230,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -315,5 +314,9 @@ def async_batch_annotate_files( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("ImageAnnotatorGrpcTransport",) 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 6dfc93e3..c3775221 100644 --- a/google/cloud/vision_v1p3beta1/services/product_search/async_client.py +++ b/google/cloud/vision_v1p3beta1/services/product_search/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -252,14 +252,13 @@ async def create_product_set( - Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters. - .. code-block:: python from google.cloud import vision_v1p3beta1 - def sample_create_product_set(): + async def sample_create_product_set(): # Create a client - client = vision_v1p3beta1.ProductSearchClient() + client = vision_v1p3beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p3beta1.CreateProductSetRequest( @@ -267,7 +266,7 @@ def sample_create_product_set(): ) # Make the request - response = client.create_product_set(request=request) + response = await client.create_product_set(request=request) # Handle the response print(response) @@ -358,7 +357,12 @@ def sample_create_product_set(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -379,14 +383,13 @@ async def list_product_sets( - Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1. - .. code-block:: python from google.cloud import vision_v1p3beta1 - def sample_list_product_sets(): + async def sample_list_product_sets(): # Create a client - client = vision_v1p3beta1.ProductSearchClient() + client = vision_v1p3beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p3beta1.ListProductSetsRequest( @@ -397,7 +400,7 @@ def sample_list_product_sets(): page_result = client.list_product_sets(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -469,12 +472,20 @@ def sample_list_product_sets(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListProductSetsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -495,14 +506,13 @@ async def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. - .. code-block:: python from google.cloud import vision_v1p3beta1 - def sample_get_product_set(): + async def sample_get_product_set(): # Create a client - client = vision_v1p3beta1.ProductSearchClient() + client = vision_v1p3beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p3beta1.GetProductSetRequest( @@ -510,7 +520,7 @@ def sample_get_product_set(): ) # Make the request - response = client.get_product_set(request=request) + response = await client.get_product_set(request=request) # Handle the response print(response) @@ -585,7 +595,12 @@ def sample_get_product_set(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -610,21 +625,20 @@ async def update_product_set( update_mask but missing from the request or longer than 4096 characters. - .. code-block:: python from google.cloud import vision_v1p3beta1 - def sample_update_product_set(): + async def sample_update_product_set(): # Create a client - client = vision_v1p3beta1.ProductSearchClient() + client = vision_v1p3beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p3beta1.UpdateProductSetRequest( ) # Make the request - response = client.update_product_set(request=request) + response = await client.update_product_set(request=request) # Handle the response print(response) @@ -707,7 +721,12 @@ def sample_update_product_set(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -731,14 +750,13 @@ async def delete_product_set( - Returns NOT_FOUND if the ProductSet does not exist. - .. code-block:: python from google.cloud import vision_v1p3beta1 - def sample_delete_product_set(): + async def sample_delete_product_set(): # Create a client - client = vision_v1p3beta1.ProductSearchClient() + client = vision_v1p3beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p3beta1.DeleteProductSetRequest( @@ -746,7 +764,7 @@ def sample_delete_product_set(): ) # Make the request - client.delete_product_set(request=request) + await client.delete_product_set(request=request) Args: request (Union[google.cloud.vision_v1p3beta1.types.DeleteProductSetRequest, dict]): @@ -810,7 +828,10 @@ def sample_delete_product_set(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def create_product( @@ -835,14 +856,13 @@ async def create_product( - Returns INVALID_ARGUMENT if product_category is missing or invalid. - .. code-block:: python from google.cloud import vision_v1p3beta1 - def sample_create_product(): + async def sample_create_product(): # Create a client - client = vision_v1p3beta1.ProductSearchClient() + client = vision_v1p3beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p3beta1.CreateProductRequest( @@ -850,7 +870,7 @@ def sample_create_product(): ) # Make the request - response = client.create_product(request=request) + response = await client.create_product(request=request) # Handle the response print(response) @@ -936,7 +956,12 @@ def sample_create_product(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -957,14 +982,13 @@ async def list_products( - Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. - .. code-block:: python from google.cloud import vision_v1p3beta1 - def sample_list_products(): + async def sample_list_products(): # Create a client - client = vision_v1p3beta1.ProductSearchClient() + client = vision_v1p3beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p3beta1.ListProductsRequest( @@ -975,7 +999,7 @@ def sample_list_products(): page_result = client.list_products(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -1047,12 +1071,20 @@ def sample_list_products(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListProductsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1073,14 +1105,13 @@ async def get_product( - Returns NOT_FOUND if the Product does not exist. - .. code-block:: python from google.cloud import vision_v1p3beta1 - def sample_get_product(): + async def sample_get_product(): # Create a client - client = vision_v1p3beta1.ProductSearchClient() + client = vision_v1p3beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p3beta1.GetProductRequest( @@ -1088,7 +1119,7 @@ def sample_get_product(): ) # Make the request - response = client.get_product(request=request) + response = await client.get_product(request=request) # Handle the response print(response) @@ -1158,7 +1189,12 @@ def sample_get_product(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1190,21 +1226,20 @@ async def update_product( - Returns INVALID_ARGUMENT if product_category is present in update_mask. - .. code-block:: python from google.cloud import vision_v1p3beta1 - def sample_update_product(): + async def sample_update_product(): # Create a client - client = vision_v1p3beta1.ProductSearchClient() + client = vision_v1p3beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p3beta1.UpdateProductRequest( ) # Make the request - response = client.update_product(request=request) + response = await client.update_product(request=request) # Handle the response print(response) @@ -1284,7 +1319,12 @@ def sample_update_product(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1308,14 +1348,13 @@ async def delete_product( - Returns NOT_FOUND if the product does not exist. - .. code-block:: python from google.cloud import vision_v1p3beta1 - def sample_delete_product(): + async def sample_delete_product(): # Create a client - client = vision_v1p3beta1.ProductSearchClient() + client = vision_v1p3beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p3beta1.DeleteProductRequest( @@ -1323,7 +1362,7 @@ def sample_delete_product(): ) # Make the request - client.delete_product(request=request) + await client.delete_product(request=request) Args: request (Union[google.cloud.vision_v1p3beta1.types.DeleteProductRequest, dict]): @@ -1387,7 +1426,10 @@ def sample_delete_product(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def create_reference_image( @@ -1424,14 +1466,13 @@ async def create_reference_image( - Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. - .. code-block:: python from google.cloud import vision_v1p3beta1 - def sample_create_reference_image(): + async def sample_create_reference_image(): # Create a client - client = vision_v1p3beta1.ProductSearchClient() + client = vision_v1p3beta1.ProductSearchAsyncClient() # Initialize request argument(s) reference_image = vision_v1p3beta1.ReferenceImage() @@ -1443,7 +1484,7 @@ def sample_create_reference_image(): ) # Make the request - response = client.create_reference_image(request=request) + response = await client.create_reference_image(request=request) # Handle the response print(response) @@ -1535,7 +1576,12 @@ def sample_create_reference_image(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1562,14 +1608,13 @@ async def delete_reference_image( - Returns NOT_FOUND if the reference image does not exist. - .. code-block:: python from google.cloud import vision_v1p3beta1 - def sample_delete_reference_image(): + async def sample_delete_reference_image(): # Create a client - client = vision_v1p3beta1.ProductSearchClient() + client = vision_v1p3beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p3beta1.DeleteReferenceImageRequest( @@ -1577,7 +1622,7 @@ def sample_delete_reference_image(): ) # Make the request - client.delete_reference_image(request=request) + await client.delete_reference_image(request=request) Args: request (Union[google.cloud.vision_v1p3beta1.types.DeleteReferenceImageRequest, dict]): @@ -1643,7 +1688,10 @@ def sample_delete_reference_image(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def list_reference_images( @@ -1663,14 +1711,13 @@ async def list_reference_images( - Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1. - .. code-block:: python from google.cloud import vision_v1p3beta1 - def sample_list_reference_images(): + async def sample_list_reference_images(): # Create a client - client = vision_v1p3beta1.ProductSearchClient() + client = vision_v1p3beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p3beta1.ListReferenceImagesRequest( @@ -1681,7 +1728,7 @@ def sample_list_reference_images(): page_result = client.list_reference_images(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -1754,12 +1801,20 @@ def sample_list_reference_images(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListReferenceImagesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1780,14 +1835,13 @@ async def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. - .. code-block:: python from google.cloud import vision_v1p3beta1 - def sample_get_reference_image(): + async def sample_get_reference_image(): # Create a client - client = vision_v1p3beta1.ProductSearchClient() + client = vision_v1p3beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p3beta1.GetReferenceImageRequest( @@ -1795,7 +1849,7 @@ def sample_get_reference_image(): ) # Make the request - response = client.get_reference_image(request=request) + response = await client.get_reference_image(request=request) # Handle the response print(response) @@ -1869,7 +1923,12 @@ def sample_get_reference_image(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1896,14 +1955,13 @@ async def add_product_to_product_set( - Returns NOT_FOUND if the Product or the ProductSet doesn't exist. - .. code-block:: python from google.cloud import vision_v1p3beta1 - def sample_add_product_to_product_set(): + async def sample_add_product_to_product_set(): # Create a client - client = vision_v1p3beta1.ProductSearchClient() + client = vision_v1p3beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p3beta1.AddProductToProductSetRequest( @@ -1912,7 +1970,7 @@ def sample_add_product_to_product_set(): ) # Make the request - client.add_product_to_product_set(request=request) + await client.add_product_to_product_set(request=request) Args: request (Union[google.cloud.vision_v1p3beta1.types.AddProductToProductSetRequest, dict]): @@ -1986,7 +2044,10 @@ def sample_add_product_to_product_set(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def remove_product_from_product_set( @@ -2008,14 +2069,13 @@ async def remove_product_from_product_set( - Returns NOT_FOUND If the Product is not found under the ProductSet. - .. code-block:: python from google.cloud import vision_v1p3beta1 - def sample_remove_product_from_product_set(): + async def sample_remove_product_from_product_set(): # Create a client - client = vision_v1p3beta1.ProductSearchClient() + client = vision_v1p3beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p3beta1.RemoveProductFromProductSetRequest( @@ -2024,7 +2084,7 @@ def sample_remove_product_from_product_set(): ) # Make the request - client.remove_product_from_product_set(request=request) + await client.remove_product_from_product_set(request=request) Args: request (Union[google.cloud.vision_v1p3beta1.types.RemoveProductFromProductSetRequest, dict]): @@ -2098,7 +2158,10 @@ def sample_remove_product_from_product_set(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def list_products_in_product_set( @@ -2121,14 +2184,13 @@ async def list_products_in_product_set( - Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. - .. code-block:: python from google.cloud import vision_v1p3beta1 - def sample_list_products_in_product_set(): + async def sample_list_products_in_product_set(): # Create a client - client = vision_v1p3beta1.ProductSearchClient() + client = vision_v1p3beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p3beta1.ListProductsInProductSetRequest( @@ -2139,7 +2201,7 @@ def sample_list_products_in_product_set(): page_result = client.list_products_in_product_set(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -2213,12 +2275,20 @@ def sample_list_products_in_product_set(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListProductsInProductSetAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -2247,14 +2317,13 @@ async def import_product_sets( Storage. For the format of the csv file please see [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource.csv_file_uri]. - .. code-block:: python from google.cloud import vision_v1p3beta1 - def sample_import_product_sets(): + async def sample_import_product_sets(): # Create a client - client = vision_v1p3beta1.ProductSearchClient() + client = vision_v1p3beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p3beta1.ImportProductSetsRequest( @@ -2266,7 +2335,7 @@ def sample_import_product_sets(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -2353,7 +2422,12 @@ def sample_import_product_sets(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -2375,7 +2449,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/vision_v1p3beta1/services/product_search/client.py b/google/cloud/vision_v1p3beta1/services/product_search/client.py index 1b33b034..3871d130 100644 --- a/google/cloud/vision_v1p3beta1/services/product_search/client.py +++ b/google/cloud/vision_v1p3beta1/services/product_search/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -59,7 +59,10 @@ class ProductSearchClientMeta(type): _transport_registry["grpc"] = ProductSearchGrpcTransport _transport_registry["grpc_asyncio"] = ProductSearchGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[ProductSearchTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ProductSearchTransport]: """Returns an appropriate transport class. Args: @@ -184,10 +187,16 @@ def transport(self) -> ProductSearchTransport: return self._transport @staticmethod - def product_path(project: str, location: str, product: str,) -> str: + def product_path( + project: str, + location: str, + product: str, + ) -> str: """Returns a fully-qualified product string.""" return "projects/{project}/locations/{location}/products/{product}".format( - project=project, location=location, product=product, + project=project, + location=location, + product=product, ) @staticmethod @@ -200,10 +209,18 @@ def parse_product_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def product_set_path(project: str, location: str, product_set: str,) -> str: + def product_set_path( + project: str, + location: str, + product_set: str, + ) -> str: """Returns a fully-qualified product_set string.""" - return "projects/{project}/locations/{location}/productSets/{product_set}".format( - project=project, location=location, product_set=product_set, + return ( + "projects/{project}/locations/{location}/productSets/{product_set}".format( + project=project, + location=location, + product_set=product_set, + ) ) @staticmethod @@ -217,7 +234,10 @@ def parse_product_set_path(path: str) -> Dict[str, str]: @staticmethod def reference_image_path( - project: str, location: str, product: str, reference_image: str, + project: str, + location: str, + product: str, + reference_image: str, ) -> str: """Returns a fully-qualified reference_image string.""" return "projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}".format( @@ -237,7 +257,9 @@ def parse_reference_image_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -250,9 +272,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -261,9 +287,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -272,9 +302,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -283,10 +317,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -478,7 +516,6 @@ def create_product_set( - Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters. - .. code-block:: python from google.cloud import vision_v1p3beta1 @@ -577,7 +614,12 @@ def sample_create_product_set(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -598,7 +640,6 @@ def list_product_sets( - Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1. - .. code-block:: python from google.cloud import vision_v1p3beta1 @@ -678,12 +719,20 @@ def sample_list_product_sets(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListProductSetsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -704,7 +753,6 @@ def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. - .. code-block:: python from google.cloud import vision_v1p3beta1 @@ -784,7 +832,12 @@ def sample_get_product_set(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -809,7 +862,6 @@ def update_product_set( update_mask but missing from the request or longer than 4096 characters. - .. code-block:: python from google.cloud import vision_v1p3beta1 @@ -899,7 +951,12 @@ def sample_update_product_set(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -923,7 +980,6 @@ def delete_product_set( - Returns NOT_FOUND if the ProductSet does not exist. - .. code-block:: python from google.cloud import vision_v1p3beta1 @@ -992,7 +1048,10 @@ def sample_delete_product_set(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def create_product( @@ -1017,7 +1076,6 @@ def create_product( - Returns INVALID_ARGUMENT if product_category is missing or invalid. - .. code-block:: python from google.cloud import vision_v1p3beta1 @@ -1111,7 +1169,12 @@ def sample_create_product(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1132,7 +1195,6 @@ def list_products( - Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. - .. code-block:: python from google.cloud import vision_v1p3beta1 @@ -1212,12 +1274,20 @@ def sample_list_products(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListProductsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1238,7 +1308,6 @@ def get_product( - Returns NOT_FOUND if the Product does not exist. - .. code-block:: python from google.cloud import vision_v1p3beta1 @@ -1313,7 +1382,12 @@ def sample_get_product(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1345,7 +1419,6 @@ def update_product( - Returns INVALID_ARGUMENT if product_category is present in update_mask. - .. code-block:: python from google.cloud import vision_v1p3beta1 @@ -1432,7 +1505,12 @@ def sample_update_product(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1456,7 +1534,6 @@ def delete_product( - Returns NOT_FOUND if the product does not exist. - .. code-block:: python from google.cloud import vision_v1p3beta1 @@ -1525,7 +1602,10 @@ def sample_delete_product(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def create_reference_image( @@ -1562,7 +1642,6 @@ def create_reference_image( - Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. - .. code-block:: python from google.cloud import vision_v1p3beta1 @@ -1666,7 +1745,12 @@ def sample_create_reference_image(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1693,7 +1777,6 @@ def delete_reference_image( - Returns NOT_FOUND if the reference image does not exist. - .. code-block:: python from google.cloud import vision_v1p3beta1 @@ -1764,7 +1847,10 @@ def sample_delete_reference_image(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def list_reference_images( @@ -1784,7 +1870,6 @@ def list_reference_images( - Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1. - .. code-block:: python from google.cloud import vision_v1p3beta1 @@ -1865,12 +1950,20 @@ def sample_list_reference_images(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListReferenceImagesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1891,7 +1984,6 @@ def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. - .. code-block:: python from google.cloud import vision_v1p3beta1 @@ -1970,7 +2062,12 @@ def sample_get_reference_image(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1997,7 +2094,6 @@ def add_product_to_product_set( - Returns NOT_FOUND if the Product or the ProductSet doesn't exist. - .. code-block:: python from google.cloud import vision_v1p3beta1 @@ -2084,7 +2180,10 @@ def sample_add_product_to_product_set(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def remove_product_from_product_set( @@ -2106,7 +2205,6 @@ def remove_product_from_product_set( - Returns NOT_FOUND If the Product is not found under the ProductSet. - .. code-block:: python from google.cloud import vision_v1p3beta1 @@ -2193,7 +2291,10 @@ def sample_remove_product_from_product_set(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def list_products_in_product_set( @@ -2216,7 +2317,6 @@ def list_products_in_product_set( - Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. - .. code-block:: python from google.cloud import vision_v1p3beta1 @@ -2302,12 +2402,20 @@ def sample_list_products_in_product_set(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListProductsInProductSetPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -2336,7 +2444,6 @@ def import_product_sets( Storage. For the format of the csv file please see [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource.csv_file_uri]. - .. code-block:: python from google.cloud import vision_v1p3beta1 @@ -2435,7 +2542,12 @@ def sample_import_product_sets(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -2464,7 +2576,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() 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 975f97ec..1564c88a 100644 --- a/google/cloud/vision_v1p3beta1/services/product_search/transports/base.py +++ b/google/cloud/vision_v1p3beta1/services/product_search/transports/base.py @@ -32,7 +32,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -84,6 +86,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -375,9 +378,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -581,5 +584,9 @@ def import_product_sets( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("ProductSearchTransport",) 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 0b97f9d2..d8a7b4b2 100644 --- a/google/cloud/vision_v1p3beta1/services/product_search/transports/grpc.py +++ b/google/cloud/vision_v1p3beta1/services/product_search/transports/grpc.py @@ -247,8 +247,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -923,5 +922,9 @@ def import_product_sets( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("ProductSearchGrpcTransport",) diff --git a/google/cloud/vision_v1p3beta1/types/__init__.py b/google/cloud/vision_v1p3beta1/types/__init__.py index f03a4751..87d6678c 100644 --- a/google/cloud/vision_v1p3beta1/types/__init__.py +++ b/google/cloud/vision_v1p3beta1/types/__init__.py @@ -102,7 +102,9 @@ TextAnnotation, Word, ) -from .web_detection import WebDetection +from .web_detection import ( + WebDetection, +) __all__ = ( "BoundingPoly", diff --git a/google/cloud/vision_v1p3beta1/types/geometry.py b/google/cloud/vision_v1p3beta1/types/geometry.py index b6db5111..2939e0d5 100644 --- a/google/cloud/vision_v1p3beta1/types/geometry.py +++ b/google/cloud/vision_v1p3beta1/types/geometry.py @@ -40,8 +40,14 @@ class Vertex(proto.Message): Y coordinate. """ - x = proto.Field(proto.INT32, number=1,) - y = proto.Field(proto.INT32, number=2,) + x = proto.Field( + proto.INT32, + number=1, + ) + y = proto.Field( + proto.INT32, + number=2, + ) class NormalizedVertex(proto.Message): @@ -56,8 +62,14 @@ class NormalizedVertex(proto.Message): Y coordinate. """ - x = proto.Field(proto.FLOAT, number=1,) - y = proto.Field(proto.FLOAT, number=2,) + x = proto.Field( + proto.FLOAT, + number=1, + ) + y = proto.Field( + proto.FLOAT, + number=2, + ) class BoundingPoly(proto.Message): @@ -70,9 +82,15 @@ class BoundingPoly(proto.Message): The bounding polygon normalized vertices. """ - vertices = proto.RepeatedField(proto.MESSAGE, number=1, message="Vertex",) + vertices = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Vertex", + ) normalized_vertices = proto.RepeatedField( - proto.MESSAGE, number=2, message="NormalizedVertex", + proto.MESSAGE, + number=2, + message="NormalizedVertex", ) @@ -84,7 +102,11 @@ class NormalizedBoundingPoly(proto.Message): Normalized vertices of the bounding polygon. """ - vertices = proto.RepeatedField(proto.MESSAGE, number=1, message="NormalizedVertex",) + vertices = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="NormalizedVertex", + ) class Position(proto.Message): @@ -102,9 +124,18 @@ class Position(proto.Message): Z coordinate (or depth). """ - x = proto.Field(proto.FLOAT, number=1,) - y = proto.Field(proto.FLOAT, number=2,) - z = proto.Field(proto.FLOAT, number=3,) + x = proto.Field( + proto.FLOAT, + number=1, + ) + y = proto.Field( + proto.FLOAT, + number=2, + ) + z = proto.Field( + proto.FLOAT, + number=3, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/vision_v1p3beta1/types/image_annotator.py b/google/cloud/vision_v1p3beta1/types/image_annotator.py index ec0ee40b..bddec8bb 100644 --- a/google/cloud/vision_v1p3beta1/types/image_annotator.py +++ b/google/cloud/vision_v1p3beta1/types/image_annotator.py @@ -113,9 +113,19 @@ class Type(proto.Enum): PRODUCT_SEARCH = 12 OBJECT_LOCALIZATION = 19 - type_ = proto.Field(proto.ENUM, number=1, enum=Type,) - max_results = proto.Field(proto.INT32, number=2,) - model = proto.Field(proto.STRING, number=3,) + type_ = proto.Field( + proto.ENUM, + number=1, + enum=Type, + ) + max_results = proto.Field( + proto.INT32, + number=2, + ) + model = proto.Field( + proto.STRING, + number=3, + ) class ImageSource(proto.Message): @@ -153,8 +163,14 @@ class ImageSource(proto.Message): ``image_uri`` takes precedence. """ - gcs_image_uri = proto.Field(proto.STRING, number=1,) - image_uri = proto.Field(proto.STRING, number=2,) + gcs_image_uri = proto.Field( + proto.STRING, + number=1, + ) + image_uri = proto.Field( + proto.STRING, + number=2, + ) class Image(proto.Message): @@ -172,8 +188,15 @@ class Image(proto.Message): perform the image annotation request. """ - content = proto.Field(proto.BYTES, number=1,) - source = proto.Field(proto.MESSAGE, number=2, message="ImageSource",) + content = proto.Field( + proto.BYTES, + number=1, + ) + source = proto.Field( + proto.MESSAGE, + number=2, + message="ImageSource", + ) class FaceAnnotation(proto.Message): @@ -285,26 +308,87 @@ class Type(proto.Enum): CHIN_LEFT_GONION = 33 CHIN_RIGHT_GONION = 34 - type_ = proto.Field(proto.ENUM, number=3, enum="FaceAnnotation.Landmark.Type",) - position = proto.Field(proto.MESSAGE, number=4, message=geometry.Position,) - - bounding_poly = proto.Field(proto.MESSAGE, number=1, message=geometry.BoundingPoly,) + type_ = proto.Field( + proto.ENUM, + number=3, + enum="FaceAnnotation.Landmark.Type", + ) + position = proto.Field( + proto.MESSAGE, + number=4, + message=geometry.Position, + ) + + bounding_poly = proto.Field( + proto.MESSAGE, + number=1, + message=geometry.BoundingPoly, + ) fd_bounding_poly = proto.Field( - proto.MESSAGE, number=2, message=geometry.BoundingPoly, - ) - landmarks = proto.RepeatedField(proto.MESSAGE, number=3, message=Landmark,) - roll_angle = proto.Field(proto.FLOAT, number=4,) - pan_angle = proto.Field(proto.FLOAT, number=5,) - tilt_angle = proto.Field(proto.FLOAT, number=6,) - detection_confidence = proto.Field(proto.FLOAT, number=7,) - landmarking_confidence = proto.Field(proto.FLOAT, number=8,) - joy_likelihood = proto.Field(proto.ENUM, number=9, enum="Likelihood",) - sorrow_likelihood = proto.Field(proto.ENUM, number=10, enum="Likelihood",) - anger_likelihood = proto.Field(proto.ENUM, number=11, enum="Likelihood",) - surprise_likelihood = proto.Field(proto.ENUM, number=12, enum="Likelihood",) - under_exposed_likelihood = proto.Field(proto.ENUM, number=13, enum="Likelihood",) - blurred_likelihood = proto.Field(proto.ENUM, number=14, enum="Likelihood",) - headwear_likelihood = proto.Field(proto.ENUM, number=15, enum="Likelihood",) + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + landmarks = proto.RepeatedField( + proto.MESSAGE, + number=3, + message=Landmark, + ) + roll_angle = proto.Field( + proto.FLOAT, + number=4, + ) + pan_angle = proto.Field( + proto.FLOAT, + number=5, + ) + tilt_angle = proto.Field( + proto.FLOAT, + number=6, + ) + detection_confidence = proto.Field( + proto.FLOAT, + number=7, + ) + landmarking_confidence = proto.Field( + proto.FLOAT, + number=8, + ) + joy_likelihood = proto.Field( + proto.ENUM, + number=9, + enum="Likelihood", + ) + sorrow_likelihood = proto.Field( + proto.ENUM, + number=10, + enum="Likelihood", + ) + anger_likelihood = proto.Field( + proto.ENUM, + number=11, + enum="Likelihood", + ) + surprise_likelihood = proto.Field( + proto.ENUM, + number=12, + enum="Likelihood", + ) + under_exposed_likelihood = proto.Field( + proto.ENUM, + number=13, + enum="Likelihood", + ) + blurred_likelihood = proto.Field( + proto.ENUM, + number=14, + enum="Likelihood", + ) + headwear_likelihood = proto.Field( + proto.ENUM, + number=15, + enum="Likelihood", + ) class LocationInfo(proto.Message): @@ -315,7 +399,11 @@ class LocationInfo(proto.Message): lat/long location coordinates. """ - lat_lng = proto.Field(proto.MESSAGE, number=1, message=latlng_pb2.LatLng,) + lat_lng = proto.Field( + proto.MESSAGE, + number=1, + message=latlng_pb2.LatLng, + ) class Property(proto.Message): @@ -330,9 +418,18 @@ class Property(proto.Message): Value of numeric properties. """ - name = proto.Field(proto.STRING, number=1,) - value = proto.Field(proto.STRING, number=2,) - uint64_value = proto.Field(proto.UINT64, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + value = proto.Field( + proto.STRING, + number=2, + ) + uint64_value = proto.Field( + proto.UINT64, + number=3, + ) class EntityAnnotation(proto.Message): @@ -380,15 +477,45 @@ class EntityAnnotation(proto.Message): the entity. """ - mid = proto.Field(proto.STRING, number=1,) - locale = proto.Field(proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) - score = proto.Field(proto.FLOAT, number=4,) - confidence = proto.Field(proto.FLOAT, number=5,) - topicality = proto.Field(proto.FLOAT, number=6,) - bounding_poly = proto.Field(proto.MESSAGE, number=7, message=geometry.BoundingPoly,) - locations = proto.RepeatedField(proto.MESSAGE, number=8, message="LocationInfo",) - properties = proto.RepeatedField(proto.MESSAGE, number=9, message="Property",) + mid = proto.Field( + proto.STRING, + number=1, + ) + locale = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) + score = proto.Field( + proto.FLOAT, + number=4, + ) + confidence = proto.Field( + proto.FLOAT, + number=5, + ) + topicality = proto.Field( + proto.FLOAT, + number=6, + ) + bounding_poly = proto.Field( + proto.MESSAGE, + number=7, + message=geometry.BoundingPoly, + ) + locations = proto.RepeatedField( + proto.MESSAGE, + number=8, + message="LocationInfo", + ) + properties = proto.RepeatedField( + proto.MESSAGE, + number=9, + message="Property", + ) class LocalizedObjectAnnotation(proto.Message): @@ -411,11 +538,27 @@ class LocalizedObjectAnnotation(proto.Message): This must be populated. """ - mid = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) - name = proto.Field(proto.STRING, number=3,) - score = proto.Field(proto.FLOAT, number=4,) - bounding_poly = proto.Field(proto.MESSAGE, number=5, message=geometry.BoundingPoly,) + mid = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) + name = proto.Field( + proto.STRING, + number=3, + ) + score = proto.Field( + proto.FLOAT, + number=4, + ) + bounding_poly = proto.Field( + proto.MESSAGE, + number=5, + message=geometry.BoundingPoly, + ) class SafeSearchAnnotation(proto.Message): @@ -447,11 +590,31 @@ class SafeSearchAnnotation(proto.Message): body areas. """ - adult = proto.Field(proto.ENUM, number=1, enum="Likelihood",) - spoof = proto.Field(proto.ENUM, number=2, enum="Likelihood",) - medical = proto.Field(proto.ENUM, number=3, enum="Likelihood",) - violence = proto.Field(proto.ENUM, number=4, enum="Likelihood",) - racy = proto.Field(proto.ENUM, number=9, enum="Likelihood",) + adult = proto.Field( + proto.ENUM, + number=1, + enum="Likelihood", + ) + spoof = proto.Field( + proto.ENUM, + number=2, + enum="Likelihood", + ) + medical = proto.Field( + proto.ENUM, + number=3, + enum="Likelihood", + ) + violence = proto.Field( + proto.ENUM, + number=4, + enum="Likelihood", + ) + racy = proto.Field( + proto.ENUM, + number=9, + enum="Likelihood", + ) class LatLongRect(proto.Message): @@ -464,8 +627,16 @@ class LatLongRect(proto.Message): Max lat/long pair. """ - min_lat_lng = proto.Field(proto.MESSAGE, number=1, message=latlng_pb2.LatLng,) - max_lat_lng = proto.Field(proto.MESSAGE, number=2, message=latlng_pb2.LatLng,) + min_lat_lng = proto.Field( + proto.MESSAGE, + number=1, + message=latlng_pb2.LatLng, + ) + max_lat_lng = proto.Field( + proto.MESSAGE, + number=2, + message=latlng_pb2.LatLng, + ) class ColorInfo(proto.Message): @@ -482,9 +653,19 @@ class ColorInfo(proto.Message): Value in range [0, 1]. """ - color = proto.Field(proto.MESSAGE, number=1, message=color_pb2.Color,) - score = proto.Field(proto.FLOAT, number=2,) - pixel_fraction = proto.Field(proto.FLOAT, number=3,) + color = proto.Field( + proto.MESSAGE, + number=1, + message=color_pb2.Color, + ) + score = proto.Field( + proto.FLOAT, + number=2, + ) + pixel_fraction = proto.Field( + proto.FLOAT, + number=3, + ) class DominantColorsAnnotation(proto.Message): @@ -496,7 +677,11 @@ class DominantColorsAnnotation(proto.Message): fraction. """ - colors = proto.RepeatedField(proto.MESSAGE, number=1, message="ColorInfo",) + colors = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="ColorInfo", + ) class ImageProperties(proto.Message): @@ -509,7 +694,9 @@ class ImageProperties(proto.Message): """ dominant_colors = proto.Field( - proto.MESSAGE, number=1, message="DominantColorsAnnotation", + proto.MESSAGE, + number=1, + message="DominantColorsAnnotation", ) @@ -529,9 +716,19 @@ class CropHint(proto.Message): with respect to the original image. """ - bounding_poly = proto.Field(proto.MESSAGE, number=1, message=geometry.BoundingPoly,) - confidence = proto.Field(proto.FLOAT, number=2,) - importance_fraction = proto.Field(proto.FLOAT, number=3,) + bounding_poly = proto.Field( + proto.MESSAGE, + number=1, + message=geometry.BoundingPoly, + ) + confidence = proto.Field( + proto.FLOAT, + number=2, + ) + importance_fraction = proto.Field( + proto.FLOAT, + number=3, + ) class CropHintsAnnotation(proto.Message): @@ -543,7 +740,11 @@ class CropHintsAnnotation(proto.Message): Crop hint results. """ - crop_hints = proto.RepeatedField(proto.MESSAGE, number=1, message="CropHint",) + crop_hints = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="CropHint", + ) class CropHintsParams(proto.Message): @@ -561,7 +762,10 @@ class CropHintsParams(proto.Message): provided after the 16th are ignored. """ - aspect_ratios = proto.RepeatedField(proto.FLOAT, number=1,) + aspect_ratios = proto.RepeatedField( + proto.FLOAT, + number=1, + ) class WebDetectionParams(proto.Message): @@ -573,7 +777,10 @@ class WebDetectionParams(proto.Message): geo information in the image. """ - include_geo_results = proto.Field(proto.BOOL, number=2,) + include_geo_results = proto.Field( + proto.BOOL, + number=2, + ) class TextDetectionParams(proto.Message): @@ -587,7 +794,10 @@ class TextDetectionParams(proto.Message): include confidence score for TEXT_DETECTION as well. """ - enable_text_detection_confidence_score = proto.Field(proto.BOOL, number=9,) + enable_text_detection_confidence_score = proto.Field( + proto.BOOL, + number=9, + ) class ImageContext(proto.Message): @@ -618,17 +828,34 @@ class ImageContext(proto.Message): text detection. """ - lat_long_rect = proto.Field(proto.MESSAGE, number=1, message="LatLongRect",) - language_hints = proto.RepeatedField(proto.STRING, number=2,) - crop_hints_params = proto.Field(proto.MESSAGE, number=4, message="CropHintsParams",) + lat_long_rect = proto.Field( + proto.MESSAGE, + number=1, + message="LatLongRect", + ) + language_hints = proto.RepeatedField( + proto.STRING, + number=2, + ) + crop_hints_params = proto.Field( + proto.MESSAGE, + number=4, + message="CropHintsParams", + ) product_search_params = proto.Field( - proto.MESSAGE, number=5, message=product_search.ProductSearchParams, + proto.MESSAGE, + number=5, + message=product_search.ProductSearchParams, ) web_detection_params = proto.Field( - proto.MESSAGE, number=6, message="WebDetectionParams", + proto.MESSAGE, + number=6, + message="WebDetectionParams", ) text_detection_params = proto.Field( - proto.MESSAGE, number=12, message="TextDetectionParams", + proto.MESSAGE, + number=12, + message="TextDetectionParams", ) @@ -646,9 +873,21 @@ class AnnotateImageRequest(proto.Message): image. """ - image = proto.Field(proto.MESSAGE, number=1, message="Image",) - features = proto.RepeatedField(proto.MESSAGE, number=2, message="Feature",) - image_context = proto.Field(proto.MESSAGE, number=3, message="ImageContext",) + image = proto.Field( + proto.MESSAGE, + number=1, + message="Image", + ) + features = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="Feature", + ) + image_context = proto.Field( + proto.MESSAGE, + number=3, + message="ImageContext", + ) class ImageAnnotationContext(proto.Message): @@ -665,8 +904,14 @@ class ImageAnnotationContext(proto.Message): produce the image. """ - uri = proto.Field(proto.STRING, number=1,) - page_number = proto.Field(proto.INT32, number=2,) + uri = proto.Field( + proto.STRING, + number=1, + ) + page_number = proto.Field( + proto.INT32, + number=2, + ) class AnnotateImageResponse(proto.Message): @@ -722,43 +967,75 @@ class AnnotateImageResponse(proto.Message): """ face_annotations = proto.RepeatedField( - proto.MESSAGE, number=1, message="FaceAnnotation", + proto.MESSAGE, + number=1, + message="FaceAnnotation", ) landmark_annotations = proto.RepeatedField( - proto.MESSAGE, number=2, message="EntityAnnotation", + proto.MESSAGE, + number=2, + message="EntityAnnotation", ) logo_annotations = proto.RepeatedField( - proto.MESSAGE, number=3, message="EntityAnnotation", + proto.MESSAGE, + number=3, + message="EntityAnnotation", ) label_annotations = proto.RepeatedField( - proto.MESSAGE, number=4, message="EntityAnnotation", + proto.MESSAGE, + number=4, + message="EntityAnnotation", ) localized_object_annotations = proto.RepeatedField( - proto.MESSAGE, number=22, message="LocalizedObjectAnnotation", + proto.MESSAGE, + number=22, + message="LocalizedObjectAnnotation", ) text_annotations = proto.RepeatedField( - proto.MESSAGE, number=5, message="EntityAnnotation", + proto.MESSAGE, + number=5, + message="EntityAnnotation", ) full_text_annotation = proto.Field( - proto.MESSAGE, number=12, message=text_annotation.TextAnnotation, + proto.MESSAGE, + number=12, + message=text_annotation.TextAnnotation, ) safe_search_annotation = proto.Field( - proto.MESSAGE, number=6, message="SafeSearchAnnotation", + proto.MESSAGE, + number=6, + message="SafeSearchAnnotation", ) image_properties_annotation = proto.Field( - proto.MESSAGE, number=8, message="ImageProperties", + proto.MESSAGE, + number=8, + message="ImageProperties", ) crop_hints_annotation = proto.Field( - proto.MESSAGE, number=11, message="CropHintsAnnotation", + proto.MESSAGE, + number=11, + message="CropHintsAnnotation", ) web_detection = proto.Field( - proto.MESSAGE, number=13, message=gcv_web_detection.WebDetection, + proto.MESSAGE, + number=13, + message=gcv_web_detection.WebDetection, ) product_search_results = proto.Field( - proto.MESSAGE, number=14, message=product_search.ProductSearchResults, + proto.MESSAGE, + number=14, + message=product_search.ProductSearchResults, + ) + error = proto.Field( + proto.MESSAGE, + number=9, + message=status_pb2.Status, + ) + context = proto.Field( + proto.MESSAGE, + number=21, + message="ImageAnnotationContext", ) - error = proto.Field(proto.MESSAGE, number=9, message=status_pb2.Status,) - context = proto.Field(proto.MESSAGE, number=21, message="ImageAnnotationContext",) class AnnotateFileResponse(proto.Message): @@ -775,9 +1052,15 @@ class AnnotateFileResponse(proto.Message): the file. """ - input_config = proto.Field(proto.MESSAGE, number=1, message="InputConfig",) + input_config = proto.Field( + proto.MESSAGE, + number=1, + message="InputConfig", + ) responses = proto.RepeatedField( - proto.MESSAGE, number=2, message="AnnotateImageResponse", + proto.MESSAGE, + number=2, + message="AnnotateImageResponse", ) @@ -792,7 +1075,9 @@ class BatchAnnotateImagesRequest(proto.Message): """ requests = proto.RepeatedField( - proto.MESSAGE, number=1, message="AnnotateImageRequest", + proto.MESSAGE, + number=1, + message="AnnotateImageRequest", ) @@ -806,7 +1091,9 @@ class BatchAnnotateImagesResponse(proto.Message): """ responses = proto.RepeatedField( - proto.MESSAGE, number=1, message="AnnotateImageResponse", + proto.MESSAGE, + number=1, + message="AnnotateImageResponse", ) @@ -826,10 +1113,26 @@ class AsyncAnnotateFileRequest(proto.Message): metadata (e.g. format). """ - input_config = proto.Field(proto.MESSAGE, number=1, message="InputConfig",) - features = proto.RepeatedField(proto.MESSAGE, number=2, message="Feature",) - image_context = proto.Field(proto.MESSAGE, number=3, message="ImageContext",) - output_config = proto.Field(proto.MESSAGE, number=4, message="OutputConfig",) + input_config = proto.Field( + proto.MESSAGE, + number=1, + message="InputConfig", + ) + features = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="Feature", + ) + image_context = proto.Field( + proto.MESSAGE, + number=3, + message="ImageContext", + ) + output_config = proto.Field( + proto.MESSAGE, + number=4, + message="OutputConfig", + ) class AsyncAnnotateFileResponse(proto.Message): @@ -841,7 +1144,11 @@ class AsyncAnnotateFileResponse(proto.Message): AsyncAnnotateFileRequest. """ - output_config = proto.Field(proto.MESSAGE, number=1, message="OutputConfig",) + output_config = proto.Field( + proto.MESSAGE, + number=1, + message="OutputConfig", + ) class AsyncBatchAnnotateFilesRequest(proto.Message): @@ -855,7 +1162,9 @@ class AsyncBatchAnnotateFilesRequest(proto.Message): """ requests = proto.RepeatedField( - proto.MESSAGE, number=1, message="AsyncAnnotateFileRequest", + proto.MESSAGE, + number=1, + message="AsyncAnnotateFileRequest", ) @@ -870,7 +1179,9 @@ class AsyncBatchAnnotateFilesResponse(proto.Message): """ responses = proto.RepeatedField( - proto.MESSAGE, number=1, message="AsyncAnnotateFileResponse", + proto.MESSAGE, + number=1, + message="AsyncAnnotateFileResponse", ) @@ -887,8 +1198,15 @@ class InputConfig(proto.Message): supported. Wildcards are not supported. """ - gcs_source = proto.Field(proto.MESSAGE, number=1, message="GcsSource",) - mime_type = proto.Field(proto.STRING, number=2,) + gcs_source = proto.Field( + proto.MESSAGE, + number=1, + message="GcsSource", + ) + mime_type = proto.Field( + proto.STRING, + number=2, + ) class OutputConfig(proto.Message): @@ -912,8 +1230,15 @@ class OutputConfig(proto.Message): potential future support for other output configurations. """ - gcs_destination = proto.Field(proto.MESSAGE, number=1, message="GcsDestination",) - batch_size = proto.Field(proto.INT32, number=2,) + gcs_destination = proto.Field( + proto.MESSAGE, + number=1, + message="GcsDestination", + ) + batch_size = proto.Field( + proto.INT32, + number=2, + ) class GcsSource(proto.Message): @@ -927,7 +1252,10 @@ class GcsSource(proto.Message): Wildcards are not currently supported. """ - uri = proto.Field(proto.STRING, number=1,) + uri = proto.Field( + proto.STRING, + number=1, + ) class GcsDestination(proto.Message): @@ -955,7 +1283,10 @@ class GcsDestination(proto.Message): overflows into multiple sharded files. """ - uri = proto.Field(proto.STRING, number=1,) + uri = proto.Field( + proto.STRING, + number=1, + ) class OperationMetadata(proto.Message): @@ -979,9 +1310,21 @@ class State(proto.Enum): DONE = 3 CANCELLED = 4 - state = proto.Field(proto.ENUM, number=1, enum=State,) - create_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,) + state = proto.Field( + proto.ENUM, + number=1, + enum=State, + ) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/vision_v1p3beta1/types/product_search.py b/google/cloud/vision_v1p3beta1/types/product_search.py index 0b79813f..8401ba8c 100644 --- a/google/cloud/vision_v1p3beta1/types/product_search.py +++ b/google/cloud/vision_v1p3beta1/types/product_search.py @@ -95,17 +95,46 @@ class ProductSearchParams(proto.Message): red OR brand = Google)" or "color: red". """ - catalog_name = proto.Field(proto.STRING, number=1,) - category = proto.Field(proto.ENUM, number=2, enum="ProductSearchCategory",) - product_category = proto.Field(proto.STRING, number=5,) + catalog_name = proto.Field( + proto.STRING, + number=1, + ) + category = proto.Field( + proto.ENUM, + number=2, + enum="ProductSearchCategory", + ) + product_category = proto.Field( + proto.STRING, + number=5, + ) normalized_bounding_poly = proto.Field( - proto.MESSAGE, number=3, message=geometry.NormalizedBoundingPoly, + proto.MESSAGE, + number=3, + message=geometry.NormalizedBoundingPoly, + ) + bounding_poly = proto.Field( + proto.MESSAGE, + number=9, + message=geometry.BoundingPoly, + ) + view = proto.Field( + proto.ENUM, + number=4, + enum="ProductSearchResultsView", + ) + product_set = proto.Field( + proto.STRING, + number=6, + ) + product_categories = proto.RepeatedField( + proto.STRING, + number=7, + ) + filter = proto.Field( + proto.STRING, + number=8, ) - bounding_poly = proto.Field(proto.MESSAGE, number=9, message=geometry.BoundingPoly,) - view = proto.Field(proto.ENUM, number=4, enum="ProductSearchResultsView",) - product_set = proto.Field(proto.STRING, number=6,) - product_categories = proto.RepeatedField(proto.STRING, number=7,) - filter = proto.Field(proto.STRING, number=8,) class ProductSearchResults(proto.Message): @@ -147,9 +176,18 @@ class ProductInfo(proto.Message): in the request. """ - product_id = proto.Field(proto.STRING, number=1,) - image_uri = proto.Field(proto.STRING, number=2,) - score = proto.Field(proto.FLOAT, number=3,) + product_id = proto.Field( + proto.STRING, + number=1, + ) + image_uri = proto.Field( + proto.STRING, + number=2, + ) + score = proto.Field( + proto.FLOAT, + number=3, + ) class Result(proto.Message): r"""Information about a product. @@ -169,16 +207,43 @@ class Result(proto.Message): """ product = proto.Field( - proto.MESSAGE, number=1, message=product_search_service.Product, + proto.MESSAGE, + number=1, + message=product_search_service.Product, + ) + score = proto.Field( + proto.FLOAT, + number=2, + ) + image = proto.Field( + proto.STRING, + number=3, ) - score = proto.Field(proto.FLOAT, number=2,) - image = proto.Field(proto.STRING, number=3,) - - category = proto.Field(proto.ENUM, number=1, enum="ProductSearchCategory",) - product_category = proto.Field(proto.STRING, number=4,) - index_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - products = proto.RepeatedField(proto.MESSAGE, number=3, message=ProductInfo,) - results = proto.RepeatedField(proto.MESSAGE, number=5, message=Result,) + + category = proto.Field( + proto.ENUM, + number=1, + enum="ProductSearchCategory", + ) + product_category = proto.Field( + proto.STRING, + number=4, + ) + index_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + products = proto.RepeatedField( + proto.MESSAGE, + number=3, + message=ProductInfo, + ) + results = proto.RepeatedField( + proto.MESSAGE, + number=5, + message=Result, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/vision_v1p3beta1/types/product_search_service.py b/google/cloud/vision_v1p3beta1/types/product_search_service.py index 579e53fe..3be3dbef 100644 --- a/google/cloud/vision_v1p3beta1/types/product_search_service.py +++ b/google/cloud/vision_v1p3beta1/types/product_search_service.py @@ -108,14 +108,36 @@ class KeyValue(proto.Message): bytes. """ - key = proto.Field(proto.STRING, number=1,) - value = proto.Field(proto.STRING, number=2,) - - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) - product_category = proto.Field(proto.STRING, number=4,) - product_labels = proto.RepeatedField(proto.MESSAGE, number=5, message=KeyValue,) + key = proto.Field( + proto.STRING, + number=1, + ) + value = proto.Field( + proto.STRING, + number=2, + ) + + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) + product_category = proto.Field( + proto.STRING, + number=4, + ) + product_labels = proto.RepeatedField( + proto.MESSAGE, + number=5, + message=KeyValue, + ) class ProductSet(proto.Message): @@ -152,10 +174,24 @@ class ProductSet(proto.Message): ProductSet. """ - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - index_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - index_error = proto.Field(proto.MESSAGE, number=4, message=status_pb2.Status,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + index_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + index_error = proto.Field( + proto.MESSAGE, + number=4, + message=status_pb2.Status, + ) class ReferenceImage(proto.Message): @@ -189,10 +225,18 @@ class ReferenceImage(proto.Message): 1:4 or less (i.e. 1:3 is ok; 1:5 is not). """ - name = proto.Field(proto.STRING, number=1,) - uri = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + uri = proto.Field( + proto.STRING, + number=2, + ) bounding_polys = proto.RepeatedField( - proto.MESSAGE, number=3, message=geometry.BoundingPoly, + proto.MESSAGE, + number=3, + message=geometry.BoundingPoly, ) @@ -215,9 +259,19 @@ class CreateProductRequest(proto.Message): cannot contain the character ``/``. """ - parent = proto.Field(proto.STRING, number=1,) - product = proto.Field(proto.MESSAGE, number=2, message="Product",) - product_id = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + product = proto.Field( + proto.MESSAGE, + number=2, + message="Product", + ) + product_id = proto.Field( + proto.STRING, + number=3, + ) class ListProductsRequest(proto.Message): @@ -237,9 +291,18 @@ class ListProductsRequest(proto.Message): if any. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListProductsResponse(proto.Message): @@ -258,8 +321,15 @@ class ListProductsResponse(proto.Message): def raw_page(self): return self - products = proto.RepeatedField(proto.MESSAGE, number=1, message="Product",) - next_page_token = proto.Field(proto.STRING, number=2,) + products = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Product", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetProductRequest(proto.Message): @@ -273,7 +343,10 @@ class GetProductRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdateProductRequest(proto.Message): @@ -291,9 +364,15 @@ class UpdateProductRequest(proto.Message): ``product_labels``, ``display_name``, and ``description``. """ - product = proto.Field(proto.MESSAGE, number=1, message="Product",) + product = proto.Field( + proto.MESSAGE, + number=1, + message="Product", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -308,7 +387,10 @@ class DeleteProductRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateProductSetRequest(proto.Message): @@ -330,9 +412,19 @@ class CreateProductSetRequest(proto.Message): cannot contain the character ``/``. """ - parent = proto.Field(proto.STRING, number=1,) - product_set = proto.Field(proto.MESSAGE, number=2, message="ProductSet",) - product_set_id = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + product_set = proto.Field( + proto.MESSAGE, + number=2, + message="ProductSet", + ) + product_set_id = proto.Field( + proto.STRING, + number=3, + ) class ListProductSetsRequest(proto.Message): @@ -352,9 +444,18 @@ class ListProductSetsRequest(proto.Message): if any. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListProductSetsResponse(proto.Message): @@ -373,8 +474,15 @@ class ListProductSetsResponse(proto.Message): def raw_page(self): return self - product_sets = proto.RepeatedField(proto.MESSAGE, number=1, message="ProductSet",) - next_page_token = proto.Field(proto.STRING, number=2,) + product_sets = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="ProductSet", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetProductSetRequest(proto.Message): @@ -388,7 +496,10 @@ class GetProductSetRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdateProductSetRequest(proto.Message): @@ -405,9 +516,15 @@ class UpdateProductSetRequest(proto.Message): ``display_name``. """ - product_set = proto.Field(proto.MESSAGE, number=1, message="ProductSet",) + product_set = proto.Field( + proto.MESSAGE, + number=1, + message="ProductSet", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -422,7 +539,10 @@ class DeleteProductSetRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateReferenceImageRequest(proto.Message): @@ -446,9 +566,19 @@ class CreateReferenceImageRequest(proto.Message): characters long. It cannot contain the character ``/``. """ - parent = proto.Field(proto.STRING, number=1,) - reference_image = proto.Field(proto.MESSAGE, number=2, message="ReferenceImage",) - reference_image_id = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + reference_image = proto.Field( + proto.MESSAGE, + number=2, + message="ReferenceImage", + ) + reference_image_id = proto.Field( + proto.STRING, + number=3, + ) class ListReferenceImagesRequest(proto.Message): @@ -472,9 +602,18 @@ class ListReferenceImagesRequest(proto.Message): Defaults to the first page if not specified. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListReferenceImagesResponse(proto.Message): @@ -496,10 +635,18 @@ def raw_page(self): return self reference_images = proto.RepeatedField( - proto.MESSAGE, number=1, message="ReferenceImage", + proto.MESSAGE, + number=1, + message="ReferenceImage", + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + next_page_token = proto.Field( + proto.STRING, + number=3, ) - page_size = proto.Field(proto.INT32, number=2,) - next_page_token = proto.Field(proto.STRING, number=3,) class GetReferenceImageRequest(proto.Message): @@ -514,7 +661,10 @@ class GetReferenceImageRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class DeleteReferenceImageRequest(proto.Message): @@ -530,7 +680,10 @@ class DeleteReferenceImageRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class AddProductToProductSetRequest(proto.Message): @@ -550,8 +703,14 @@ class AddProductToProductSetRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ - name = proto.Field(proto.STRING, number=1,) - product = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + product = proto.Field( + proto.STRING, + number=2, + ) class RemoveProductFromProductSetRequest(proto.Message): @@ -571,8 +730,14 @@ class RemoveProductFromProductSetRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ - name = proto.Field(proto.STRING, number=1,) - product = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + product = proto.Field( + proto.STRING, + number=2, + ) class ListProductsInProductSetRequest(proto.Message): @@ -593,9 +758,18 @@ class ListProductsInProductSetRequest(proto.Message): if any. """ - name = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListProductsInProductSetResponse(proto.Message): @@ -614,8 +788,15 @@ class ListProductsInProductSetResponse(proto.Message): def raw_page(self): return self - products = proto.RepeatedField(proto.MESSAGE, number=1, message="Product",) - next_page_token = proto.Field(proto.STRING, number=2,) + products = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Product", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class ImportProductSetsGcsSource(proto.Message): @@ -686,7 +867,10 @@ class ImportProductSetsGcsSource(proto.Message): polygons. """ - csv_file_uri = proto.Field(proto.STRING, number=1,) + csv_file_uri = proto.Field( + proto.STRING, + number=1, + ) class ImportProductSetsInputConfig(proto.Message): @@ -704,7 +888,10 @@ class ImportProductSetsInputConfig(proto.Message): """ gcs_source = proto.Field( - proto.MESSAGE, number=1, oneof="source", message="ImportProductSetsGcsSource", + proto.MESSAGE, + number=1, + oneof="source", + message="ImportProductSetsGcsSource", ) @@ -722,9 +909,14 @@ class ImportProductSetsRequest(proto.Message): requests. """ - parent = proto.Field(proto.STRING, number=1,) + parent = proto.Field( + proto.STRING, + number=1, + ) input_config = proto.Field( - proto.MESSAGE, number=2, message="ImportProductSetsInputConfig", + proto.MESSAGE, + number=2, + message="ImportProductSetsInputConfig", ) @@ -751,9 +943,15 @@ class ImportProductSetsResponse(proto.Message): """ reference_images = proto.RepeatedField( - proto.MESSAGE, number=1, message="ReferenceImage", + proto.MESSAGE, + number=1, + message="ReferenceImage", + ) + statuses = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=status_pb2.Status, ) - statuses = proto.RepeatedField(proto.MESSAGE, number=2, message=status_pb2.Status,) class BatchOperationMetadata(proto.Message): @@ -785,9 +983,21 @@ class State(proto.Enum): FAILED = 3 CANCELLED = 4 - state = proto.Field(proto.ENUM, number=1, enum=State,) - submit_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) + state = proto.Field( + proto.ENUM, + number=1, + enum=State, + ) + submit_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/vision_v1p3beta1/types/text_annotation.py b/google/cloud/vision_v1p3beta1/types/text_annotation.py index 5348ecd7..16c168a8 100644 --- a/google/cloud/vision_v1p3beta1/types/text_annotation.py +++ b/google/cloud/vision_v1p3beta1/types/text_annotation.py @@ -20,7 +20,14 @@ __protobuf__ = proto.module( package="google.cloud.vision.v1p3beta1", - manifest={"TextAnnotation", "Page", "Block", "Paragraph", "Word", "Symbol",}, + manifest={ + "TextAnnotation", + "Page", + "Block", + "Paragraph", + "Word", + "Symbol", + }, ) @@ -53,8 +60,14 @@ class DetectedLanguage(proto.Message): Confidence of detected language. Range [0, 1]. """ - language_code = proto.Field(proto.STRING, number=1,) - confidence = proto.Field(proto.FLOAT, number=2,) + language_code = proto.Field( + proto.STRING, + number=1, + ) + confidence = proto.Field( + proto.FLOAT, + number=2, + ) class DetectedBreak(proto.Message): r"""Detected start or end of a structural component. @@ -76,9 +89,14 @@ class BreakType(proto.Enum): LINE_BREAK = 5 type_ = proto.Field( - proto.ENUM, number=1, enum="TextAnnotation.DetectedBreak.BreakType", + proto.ENUM, + number=1, + enum="TextAnnotation.DetectedBreak.BreakType", + ) + is_prefix = proto.Field( + proto.BOOL, + number=2, ) - is_prefix = proto.Field(proto.BOOL, number=2,) class TextProperty(proto.Message): r"""Additional information detected on the structural component. @@ -92,14 +110,25 @@ class TextProperty(proto.Message): """ detected_languages = proto.RepeatedField( - proto.MESSAGE, number=1, message="TextAnnotation.DetectedLanguage", + proto.MESSAGE, + number=1, + message="TextAnnotation.DetectedLanguage", ) detected_break = proto.Field( - proto.MESSAGE, number=2, message="TextAnnotation.DetectedBreak", + proto.MESSAGE, + number=2, + message="TextAnnotation.DetectedBreak", ) - pages = proto.RepeatedField(proto.MESSAGE, number=1, message="Page",) - text = proto.Field(proto.STRING, number=2,) + pages = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Page", + ) + text = proto.Field( + proto.STRING, + number=2, + ) class Page(proto.Message): @@ -122,12 +151,27 @@ class Page(proto.Message): """ property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + width = proto.Field( + proto.INT32, + number=2, + ) + height = proto.Field( + proto.INT32, + number=3, + ) + blocks = proto.RepeatedField( + proto.MESSAGE, + number=4, + message="Block", + ) + confidence = proto.Field( + proto.FLOAT, + number=5, ) - width = proto.Field(proto.INT32, number=2,) - height = proto.Field(proto.INT32, number=3,) - blocks = proto.RepeatedField(proto.MESSAGE, number=4, message="Block",) - confidence = proto.Field(proto.FLOAT, number=5,) class Block(proto.Message): @@ -182,12 +226,29 @@ class BlockType(proto.Enum): BARCODE = 5 property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + bounding_box = proto.Field( + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + paragraphs = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="Paragraph", + ) + block_type = proto.Field( + proto.ENUM, + number=4, + enum=BlockType, + ) + confidence = proto.Field( + proto.FLOAT, + number=5, ) - bounding_box = proto.Field(proto.MESSAGE, number=2, message=geometry.BoundingPoly,) - paragraphs = proto.RepeatedField(proto.MESSAGE, number=3, message="Paragraph",) - block_type = proto.Field(proto.ENUM, number=4, enum=BlockType,) - confidence = proto.Field(proto.FLOAT, number=5,) class Paragraph(proto.Message): @@ -218,11 +279,24 @@ class Paragraph(proto.Message): """ property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + bounding_box = proto.Field( + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + words = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="Word", + ) + confidence = proto.Field( + proto.FLOAT, + number=4, ) - bounding_box = proto.Field(proto.MESSAGE, number=2, message=geometry.BoundingPoly,) - words = proto.RepeatedField(proto.MESSAGE, number=3, message="Word",) - confidence = proto.Field(proto.FLOAT, number=4,) class Word(proto.Message): @@ -252,11 +326,24 @@ class Word(proto.Message): """ property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + bounding_box = proto.Field( + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + symbols = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="Symbol", + ) + confidence = proto.Field( + proto.FLOAT, + number=4, ) - bounding_box = proto.Field(proto.MESSAGE, number=2, message=geometry.BoundingPoly,) - symbols = proto.RepeatedField(proto.MESSAGE, number=3, message="Symbol",) - confidence = proto.Field(proto.FLOAT, number=4,) class Symbol(proto.Message): @@ -286,11 +373,23 @@ class Symbol(proto.Message): """ property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + bounding_box = proto.Field( + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + text = proto.Field( + proto.STRING, + number=3, + ) + confidence = proto.Field( + proto.FLOAT, + number=4, ) - bounding_box = proto.Field(proto.MESSAGE, number=2, message=geometry.BoundingPoly,) - text = proto.Field(proto.STRING, number=3,) - confidence = proto.Field(proto.FLOAT, number=4,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/vision_v1p3beta1/types/web_detection.py b/google/cloud/vision_v1p3beta1/types/web_detection.py index 5b2b667c..0f68e4a7 100644 --- a/google/cloud/vision_v1p3beta1/types/web_detection.py +++ b/google/cloud/vision_v1p3beta1/types/web_detection.py @@ -17,7 +17,10 @@ __protobuf__ = proto.module( - package="google.cloud.vision.v1p3beta1", manifest={"WebDetection",}, + package="google.cloud.vision.v1p3beta1", + manifest={ + "WebDetection", + }, ) @@ -61,9 +64,18 @@ class WebEntity(proto.Message): English. """ - entity_id = proto.Field(proto.STRING, number=1,) - score = proto.Field(proto.FLOAT, number=2,) - description = proto.Field(proto.STRING, number=3,) + entity_id = proto.Field( + proto.STRING, + number=1, + ) + score = proto.Field( + proto.FLOAT, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) class WebImage(proto.Message): r"""Metadata for online images. @@ -76,8 +88,14 @@ class WebImage(proto.Message): image. """ - url = proto.Field(proto.STRING, number=1,) - score = proto.Field(proto.FLOAT, number=2,) + url = proto.Field( + proto.STRING, + number=1, + ) + score = proto.Field( + proto.FLOAT, + number=2, + ) class WebPage(proto.Message): r"""Metadata for web pages. @@ -102,14 +120,27 @@ class WebPage(proto.Message): crops. """ - url = proto.Field(proto.STRING, number=1,) - score = proto.Field(proto.FLOAT, number=2,) - page_title = proto.Field(proto.STRING, number=3,) + url = proto.Field( + proto.STRING, + number=1, + ) + score = proto.Field( + proto.FLOAT, + number=2, + ) + page_title = proto.Field( + proto.STRING, + number=3, + ) full_matching_images = proto.RepeatedField( - proto.MESSAGE, number=4, message="WebDetection.WebImage", + proto.MESSAGE, + number=4, + message="WebDetection.WebImage", ) partial_matching_images = proto.RepeatedField( - proto.MESSAGE, number=5, message="WebDetection.WebImage", + proto.MESSAGE, + number=5, + message="WebDetection.WebImage", ) class WebLabel(proto.Message): @@ -124,23 +155,45 @@ class WebLabel(proto.Message): http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. """ - label = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) + label = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) - web_entities = proto.RepeatedField(proto.MESSAGE, number=1, message=WebEntity,) + web_entities = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=WebEntity, + ) full_matching_images = proto.RepeatedField( - proto.MESSAGE, number=2, message=WebImage, + proto.MESSAGE, + number=2, + message=WebImage, ) partial_matching_images = proto.RepeatedField( - proto.MESSAGE, number=3, message=WebImage, + proto.MESSAGE, + number=3, + message=WebImage, ) pages_with_matching_images = proto.RepeatedField( - proto.MESSAGE, number=4, message=WebPage, + proto.MESSAGE, + number=4, + message=WebPage, ) visually_similar_images = proto.RepeatedField( - proto.MESSAGE, number=6, message=WebImage, + proto.MESSAGE, + number=6, + message=WebImage, + ) + best_guess_labels = proto.RepeatedField( + proto.MESSAGE, + number=8, + message=WebLabel, ) - best_guess_labels = proto.RepeatedField(proto.MESSAGE, number=8, message=WebLabel,) __all__ = tuple(sorted(__protobuf__.manifest)) 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 7805401a..e0b37c5e 100644 --- a/google/cloud/vision_v1p4beta1/services/image_annotator/async_client.py +++ b/google/cloud/vision_v1p4beta1/services/image_annotator/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -221,21 +221,20 @@ async def batch_annotate_images( r"""Run image detection and annotation for a batch of images. - .. code-block:: python from google.cloud import vision_v1p4beta1 - def sample_batch_annotate_images(): + async def sample_batch_annotate_images(): # Create a client - client = vision_v1p4beta1.ImageAnnotatorClient() + client = vision_v1p4beta1.ImageAnnotatorAsyncClient() # Initialize request argument(s) request = vision_v1p4beta1.BatchAnnotateImagesRequest( ) # Make the request - response = client.batch_annotate_images(request=request) + response = await client.batch_annotate_images(request=request) # Handle the response print(response) @@ -296,7 +295,12 @@ def sample_batch_annotate_images(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -319,21 +323,20 @@ async def batch_annotate_files( perform detection and annotation for each image extracted. - .. code-block:: python from google.cloud import vision_v1p4beta1 - def sample_batch_annotate_files(): + async def sample_batch_annotate_files(): # Create a client - client = vision_v1p4beta1.ImageAnnotatorClient() + client = vision_v1p4beta1.ImageAnnotatorAsyncClient() # Initialize request argument(s) request = vision_v1p4beta1.BatchAnnotateFilesRequest( ) # Make the request - response = client.batch_annotate_files(request=request) + response = await client.batch_annotate_files(request=request) # Handle the response print(response) @@ -394,7 +397,12 @@ def sample_batch_annotate_files(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -422,14 +430,13 @@ async def async_batch_annotate_images( in customer GCS bucket, each json file containing BatchAnnotateImagesResponse proto. - .. code-block:: python from google.cloud import vision_v1p4beta1 - def sample_async_batch_annotate_images(): + async def sample_async_batch_annotate_images(): # Create a client - client = vision_v1p4beta1.ImageAnnotatorClient() + client = vision_v1p4beta1.ImageAnnotatorAsyncClient() # Initialize request argument(s) request = vision_v1p4beta1.AsyncBatchAnnotateImagesRequest( @@ -440,7 +447,7 @@ def sample_async_batch_annotate_images(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -513,7 +520,12 @@ def sample_async_batch_annotate_images(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -543,14 +555,13 @@ async def async_batch_annotate_files( (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` (results). - .. code-block:: python from google.cloud import vision_v1p4beta1 - def sample_async_batch_annotate_files(): + async def sample_async_batch_annotate_files(): # Create a client - client = vision_v1p4beta1.ImageAnnotatorClient() + client = vision_v1p4beta1.ImageAnnotatorAsyncClient() # Initialize request argument(s) request = vision_v1p4beta1.AsyncBatchAnnotateFilesRequest( @@ -561,7 +572,7 @@ def sample_async_batch_annotate_files(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -625,7 +636,12 @@ def sample_async_batch_annotate_files(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -647,7 +663,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/vision_v1p4beta1/services/image_annotator/client.py b/google/cloud/vision_v1p4beta1/services/image_annotator/client.py index 88fa6023..95fc9928 100644 --- a/google/cloud/vision_v1p4beta1/services/image_annotator/client.py +++ b/google/cloud/vision_v1p4beta1/services/image_annotator/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -56,7 +56,10 @@ class ImageAnnotatorClientMeta(type): _transport_registry["grpc"] = ImageAnnotatorGrpcTransport _transport_registry["grpc_asyncio"] = ImageAnnotatorGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[ImageAnnotatorTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ImageAnnotatorTransport]: """Returns an appropriate transport class. Args: @@ -165,10 +168,16 @@ def transport(self) -> ImageAnnotatorTransport: return self._transport @staticmethod - def product_path(project: str, location: str, product: str,) -> str: + def product_path( + project: str, + location: str, + product: str, + ) -> str: """Returns a fully-qualified product string.""" return "projects/{project}/locations/{location}/products/{product}".format( - project=project, location=location, product=product, + project=project, + location=location, + product=product, ) @staticmethod @@ -181,10 +190,18 @@ def parse_product_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def product_set_path(project: str, location: str, product_set: str,) -> str: + def product_set_path( + project: str, + location: str, + product_set: str, + ) -> str: """Returns a fully-qualified product_set string.""" - return "projects/{project}/locations/{location}/productSets/{product_set}".format( - project=project, location=location, product_set=product_set, + return ( + "projects/{project}/locations/{location}/productSets/{product_set}".format( + project=project, + location=location, + product_set=product_set, + ) ) @staticmethod @@ -197,7 +214,9 @@ def parse_product_set_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -210,9 +229,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -221,9 +244,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -232,9 +259,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -243,10 +274,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -432,7 +467,6 @@ def batch_annotate_images( r"""Run image detection and annotation for a batch of images. - .. code-block:: python from google.cloud import vision_v1p4beta1 @@ -503,7 +537,12 @@ def sample_batch_annotate_images(): rpc = self._transport._wrapped_methods[self._transport.batch_annotate_images] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -526,7 +565,6 @@ def batch_annotate_files( perform detection and annotation for each image extracted. - .. code-block:: python from google.cloud import vision_v1p4beta1 @@ -597,7 +635,12 @@ def sample_batch_annotate_files(): rpc = self._transport._wrapped_methods[self._transport.batch_annotate_files] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -625,7 +668,6 @@ def async_batch_annotate_images( in customer GCS bucket, each json file containing BatchAnnotateImagesResponse proto. - .. code-block:: python from google.cloud import vision_v1p4beta1 @@ -714,7 +756,12 @@ def sample_async_batch_annotate_images(): ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -744,7 +791,6 @@ def async_batch_annotate_files( (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` (results). - .. code-block:: python from google.cloud import vision_v1p4beta1 @@ -824,7 +870,12 @@ def sample_async_batch_annotate_files(): ] # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -853,7 +904,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() 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 8d960da1..15b926bd 100644 --- a/google/cloud/vision_v1p4beta1/services/image_annotator/transports/base.py +++ b/google/cloud/vision_v1p4beta1/services/image_annotator/transports/base.py @@ -31,7 +31,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -83,6 +85,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -176,9 +179,9 @@ def _prep_wrapped_messages(self, client_info): def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -229,5 +232,9 @@ def async_batch_annotate_files( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("ImageAnnotatorTransport",) 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 36975ff4..0a97e2b9 100644 --- a/google/cloud/vision_v1p4beta1/services/image_annotator/transports/grpc.py +++ b/google/cloud/vision_v1p4beta1/services/image_annotator/transports/grpc.py @@ -230,8 +230,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -390,5 +389,9 @@ def async_batch_annotate_files( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("ImageAnnotatorGrpcTransport",) 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 fdf16a8e..6d2adcd7 100644 --- a/google/cloud/vision_v1p4beta1/services/product_search/async_client.py +++ b/google/cloud/vision_v1p4beta1/services/product_search/async_client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import functools import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core.client_options import ClientOptions @@ -253,14 +253,13 @@ async def create_product_set( - Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters. - .. code-block:: python from google.cloud import vision_v1p4beta1 - def sample_create_product_set(): + async def sample_create_product_set(): # Create a client - client = vision_v1p4beta1.ProductSearchClient() + client = vision_v1p4beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p4beta1.CreateProductSetRequest( @@ -268,7 +267,7 @@ def sample_create_product_set(): ) # Make the request - response = client.create_product_set(request=request) + response = await client.create_product_set(request=request) # Handle the response print(response) @@ -359,7 +358,12 @@ def sample_create_product_set(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -380,14 +384,13 @@ async def list_product_sets( - Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1. - .. code-block:: python from google.cloud import vision_v1p4beta1 - def sample_list_product_sets(): + async def sample_list_product_sets(): # Create a client - client = vision_v1p4beta1.ProductSearchClient() + client = vision_v1p4beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p4beta1.ListProductSetsRequest( @@ -398,7 +401,7 @@ def sample_list_product_sets(): page_result = client.list_product_sets(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -470,12 +473,20 @@ def sample_list_product_sets(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListProductSetsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -496,14 +507,13 @@ async def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. - .. code-block:: python from google.cloud import vision_v1p4beta1 - def sample_get_product_set(): + async def sample_get_product_set(): # Create a client - client = vision_v1p4beta1.ProductSearchClient() + client = vision_v1p4beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p4beta1.GetProductSetRequest( @@ -511,7 +521,7 @@ def sample_get_product_set(): ) # Make the request - response = client.get_product_set(request=request) + response = await client.get_product_set(request=request) # Handle the response print(response) @@ -586,7 +596,12 @@ def sample_get_product_set(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -611,21 +626,20 @@ async def update_product_set( update_mask but missing from the request or longer than 4096 characters. - .. code-block:: python from google.cloud import vision_v1p4beta1 - def sample_update_product_set(): + async def sample_update_product_set(): # Create a client - client = vision_v1p4beta1.ProductSearchClient() + client = vision_v1p4beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p4beta1.UpdateProductSetRequest( ) # Make the request - response = client.update_product_set(request=request) + response = await client.update_product_set(request=request) # Handle the response print(response) @@ -708,7 +722,12 @@ def sample_update_product_set(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -727,14 +746,13 @@ async def delete_product_set( The actual image files are not deleted from Google Cloud Storage. - .. code-block:: python from google.cloud import vision_v1p4beta1 - def sample_delete_product_set(): + async def sample_delete_product_set(): # Create a client - client = vision_v1p4beta1.ProductSearchClient() + client = vision_v1p4beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p4beta1.DeleteProductSetRequest( @@ -742,7 +760,7 @@ def sample_delete_product_set(): ) # Make the request - client.delete_product_set(request=request) + await client.delete_product_set(request=request) Args: request (Union[google.cloud.vision_v1p4beta1.types.DeleteProductSetRequest, dict]): @@ -806,7 +824,10 @@ def sample_delete_product_set(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def create_product( @@ -831,14 +852,13 @@ async def create_product( - Returns INVALID_ARGUMENT if product_category is missing or invalid. - .. code-block:: python from google.cloud import vision_v1p4beta1 - def sample_create_product(): + async def sample_create_product(): # Create a client - client = vision_v1p4beta1.ProductSearchClient() + client = vision_v1p4beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p4beta1.CreateProductRequest( @@ -846,7 +866,7 @@ def sample_create_product(): ) # Make the request - response = client.create_product(request=request) + response = await client.create_product(request=request) # Handle the response print(response) @@ -932,7 +952,12 @@ def sample_create_product(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -953,14 +978,13 @@ async def list_products( - Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. - .. code-block:: python from google.cloud import vision_v1p4beta1 - def sample_list_products(): + async def sample_list_products(): # Create a client - client = vision_v1p4beta1.ProductSearchClient() + client = vision_v1p4beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p4beta1.ListProductsRequest( @@ -971,7 +995,7 @@ def sample_list_products(): page_result = client.list_products(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -1043,12 +1067,20 @@ def sample_list_products(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListProductsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1069,14 +1101,13 @@ async def get_product( - Returns NOT_FOUND if the Product does not exist. - .. code-block:: python from google.cloud import vision_v1p4beta1 - def sample_get_product(): + async def sample_get_product(): # Create a client - client = vision_v1p4beta1.ProductSearchClient() + client = vision_v1p4beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p4beta1.GetProductRequest( @@ -1084,7 +1115,7 @@ def sample_get_product(): ) # Make the request - response = client.get_product(request=request) + response = await client.get_product(request=request) # Handle the response print(response) @@ -1154,7 +1185,12 @@ def sample_get_product(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1186,21 +1222,20 @@ async def update_product( - Returns INVALID_ARGUMENT if product_category is present in update_mask. - .. code-block:: python from google.cloud import vision_v1p4beta1 - def sample_update_product(): + async def sample_update_product(): # Create a client - client = vision_v1p4beta1.ProductSearchClient() + client = vision_v1p4beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p4beta1.UpdateProductRequest( ) # Make the request - response = client.update_product(request=request) + response = await client.update_product(request=request) # Handle the response print(response) @@ -1280,7 +1315,12 @@ def sample_update_product(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1301,14 +1341,13 @@ async def delete_product( ProductSets containing the product may still work until all related caches are refreshed. - .. code-block:: python from google.cloud import vision_v1p4beta1 - def sample_delete_product(): + async def sample_delete_product(): # Create a client - client = vision_v1p4beta1.ProductSearchClient() + client = vision_v1p4beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p4beta1.DeleteProductRequest( @@ -1316,7 +1355,7 @@ def sample_delete_product(): ) # Make the request - client.delete_product(request=request) + await client.delete_product(request=request) Args: request (Union[google.cloud.vision_v1p4beta1.types.DeleteProductRequest, dict]): @@ -1380,7 +1419,10 @@ def sample_delete_product(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def create_reference_image( @@ -1417,14 +1459,13 @@ async def create_reference_image( - Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. - .. code-block:: python from google.cloud import vision_v1p4beta1 - def sample_create_reference_image(): + async def sample_create_reference_image(): # Create a client - client = vision_v1p4beta1.ProductSearchClient() + client = vision_v1p4beta1.ProductSearchAsyncClient() # Initialize request argument(s) reference_image = vision_v1p4beta1.ReferenceImage() @@ -1436,7 +1477,7 @@ def sample_create_reference_image(): ) # Make the request - response = client.create_reference_image(request=request) + response = await client.create_reference_image(request=request) # Handle the response print(response) @@ -1528,7 +1569,12 @@ def sample_create_reference_image(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1550,14 +1596,13 @@ async def delete_reference_image( The actual image files are not deleted from Google Cloud Storage. - .. code-block:: python from google.cloud import vision_v1p4beta1 - def sample_delete_reference_image(): + async def sample_delete_reference_image(): # Create a client - client = vision_v1p4beta1.ProductSearchClient() + client = vision_v1p4beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p4beta1.DeleteReferenceImageRequest( @@ -1565,7 +1610,7 @@ def sample_delete_reference_image(): ) # Make the request - client.delete_reference_image(request=request) + await client.delete_reference_image(request=request) Args: request (Union[google.cloud.vision_v1p4beta1.types.DeleteReferenceImageRequest, dict]): @@ -1631,7 +1676,10 @@ def sample_delete_reference_image(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def list_reference_images( @@ -1651,14 +1699,13 @@ async def list_reference_images( - Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1. - .. code-block:: python from google.cloud import vision_v1p4beta1 - def sample_list_reference_images(): + async def sample_list_reference_images(): # Create a client - client = vision_v1p4beta1.ProductSearchClient() + client = vision_v1p4beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p4beta1.ListReferenceImagesRequest( @@ -1669,7 +1716,7 @@ def sample_list_reference_images(): page_result = client.list_reference_images(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -1742,12 +1789,20 @@ def sample_list_reference_images(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListReferenceImagesAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1768,14 +1823,13 @@ async def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. - .. code-block:: python from google.cloud import vision_v1p4beta1 - def sample_get_reference_image(): + async def sample_get_reference_image(): # Create a client - client = vision_v1p4beta1.ProductSearchClient() + client = vision_v1p4beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p4beta1.GetReferenceImageRequest( @@ -1783,7 +1837,7 @@ def sample_get_reference_image(): ) # Make the request - response = client.get_reference_image(request=request) + response = await client.get_reference_image(request=request) # Handle the response print(response) @@ -1857,7 +1911,12 @@ def sample_get_reference_image(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1884,14 +1943,13 @@ async def add_product_to_product_set( - Returns NOT_FOUND if the Product or the ProductSet doesn't exist. - .. code-block:: python from google.cloud import vision_v1p4beta1 - def sample_add_product_to_product_set(): + async def sample_add_product_to_product_set(): # Create a client - client = vision_v1p4beta1.ProductSearchClient() + client = vision_v1p4beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p4beta1.AddProductToProductSetRequest( @@ -1900,7 +1958,7 @@ def sample_add_product_to_product_set(): ) # Make the request - client.add_product_to_product_set(request=request) + await client.add_product_to_product_set(request=request) Args: request (Union[google.cloud.vision_v1p4beta1.types.AddProductToProductSetRequest, dict]): @@ -1974,7 +2032,10 @@ def sample_add_product_to_product_set(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def remove_product_from_product_set( @@ -1995,9 +2056,9 @@ async def remove_product_from_product_set( from google.cloud import vision_v1p4beta1 - def sample_remove_product_from_product_set(): + async def sample_remove_product_from_product_set(): # Create a client - client = vision_v1p4beta1.ProductSearchClient() + client = vision_v1p4beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p4beta1.RemoveProductFromProductSetRequest( @@ -2006,7 +2067,7 @@ def sample_remove_product_from_product_set(): ) # Make the request - client.remove_product_from_product_set(request=request) + await client.remove_product_from_product_set(request=request) Args: request (Union[google.cloud.vision_v1p4beta1.types.RemoveProductFromProductSetRequest, dict]): @@ -2080,7 +2141,10 @@ def sample_remove_product_from_product_set(): # Send the request. await rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) async def list_products_in_product_set( @@ -2103,14 +2167,13 @@ async def list_products_in_product_set( - Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. - .. code-block:: python from google.cloud import vision_v1p4beta1 - def sample_list_products_in_product_set(): + async def sample_list_products_in_product_set(): # Create a client - client = vision_v1p4beta1.ProductSearchClient() + client = vision_v1p4beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p4beta1.ListProductsInProductSetRequest( @@ -2121,7 +2184,7 @@ def sample_list_products_in_product_set(): page_result = client.list_products_in_product_set(request=request) # Handle the response - for response in page_result: + async for response in page_result: print(response) Args: @@ -2195,12 +2258,20 @@ def sample_list_products_in_product_set(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. response = pagers.ListProductsInProductSetAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -2229,14 +2300,13 @@ async def import_product_sets( Storage. For the format of the csv file please see [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.csv_file_uri]. - .. code-block:: python from google.cloud import vision_v1p4beta1 - def sample_import_product_sets(): + async def sample_import_product_sets(): # Create a client - client = vision_v1p4beta1.ProductSearchClient() + client = vision_v1p4beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p4beta1.ImportProductSetsRequest( @@ -2248,7 +2318,7 @@ def sample_import_product_sets(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -2335,7 +2405,12 @@ def sample_import_product_sets(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -2385,14 +2460,13 @@ async def purge_products( request. ``Operation.metadata`` contains ``BatchOperationMetadata``. (progress) - .. code-block:: python from google.cloud import vision_v1p4beta1 - def sample_purge_products(): + async def sample_purge_products(): # Create a client - client = vision_v1p4beta1.ProductSearchClient() + client = vision_v1p4beta1.ProductSearchAsyncClient() # Initialize request argument(s) request = vision_v1p4beta1.PurgeProductsRequest( @@ -2404,7 +2478,7 @@ def sample_purge_products(): print("Waiting for operation to complete...") - response = operation.result() + response = await operation.result() # Handle the response print(response) @@ -2479,7 +2553,12 @@ def sample_purge_products(): ) # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation_async.from_gapic( @@ -2501,7 +2580,9 @@ async def __aexit__(self, exc_type, exc, tb): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() diff --git a/google/cloud/vision_v1p4beta1/services/product_search/client.py b/google/cloud/vision_v1p4beta1/services/product_search/client.py index 134d3dbe..58af98fd 100644 --- a/google/cloud/vision_v1p4beta1/services/product_search/client.py +++ b/google/cloud/vision_v1p4beta1/services/product_search/client.py @@ -16,7 +16,7 @@ from collections import OrderedDict import os import re -from typing import Dict, Optional, Sequence, Tuple, Type, Union +from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union import pkg_resources from google.api_core import client_options as client_options_lib @@ -60,7 +60,10 @@ class ProductSearchClientMeta(type): _transport_registry["grpc"] = ProductSearchGrpcTransport _transport_registry["grpc_asyncio"] = ProductSearchGrpcAsyncIOTransport - def get_transport_class(cls, label: str = None,) -> Type[ProductSearchTransport]: + def get_transport_class( + cls, + label: str = None, + ) -> Type[ProductSearchTransport]: """Returns an appropriate transport class. Args: @@ -185,10 +188,16 @@ def transport(self) -> ProductSearchTransport: return self._transport @staticmethod - def product_path(project: str, location: str, product: str,) -> str: + def product_path( + project: str, + location: str, + product: str, + ) -> str: """Returns a fully-qualified product string.""" return "projects/{project}/locations/{location}/products/{product}".format( - project=project, location=location, product=product, + project=project, + location=location, + product=product, ) @staticmethod @@ -201,10 +210,18 @@ def parse_product_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def product_set_path(project: str, location: str, product_set: str,) -> str: + def product_set_path( + project: str, + location: str, + product_set: str, + ) -> str: """Returns a fully-qualified product_set string.""" - return "projects/{project}/locations/{location}/productSets/{product_set}".format( - project=project, location=location, product_set=product_set, + return ( + "projects/{project}/locations/{location}/productSets/{product_set}".format( + project=project, + location=location, + product_set=product_set, + ) ) @staticmethod @@ -218,7 +235,10 @@ def parse_product_set_path(path: str) -> Dict[str, str]: @staticmethod def reference_image_path( - project: str, location: str, product: str, reference_image: str, + project: str, + location: str, + product: str, + reference_image: str, ) -> str: """Returns a fully-qualified reference_image string.""" return "projects/{project}/locations/{location}/products/{product}/referenceImages/{reference_image}".format( @@ -238,7 +258,9 @@ def parse_reference_image_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_billing_account_path(billing_account: str,) -> str: + def common_billing_account_path( + billing_account: str, + ) -> str: """Returns a fully-qualified billing_account string.""" return "billingAccounts/{billing_account}".format( billing_account=billing_account, @@ -251,9 +273,13 @@ def parse_common_billing_account_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_folder_path(folder: str,) -> str: + def common_folder_path( + folder: str, + ) -> str: """Returns a fully-qualified folder string.""" - return "folders/{folder}".format(folder=folder,) + return "folders/{folder}".format( + folder=folder, + ) @staticmethod def parse_common_folder_path(path: str) -> Dict[str, str]: @@ -262,9 +288,13 @@ def parse_common_folder_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_organization_path(organization: str,) -> str: + def common_organization_path( + organization: str, + ) -> str: """Returns a fully-qualified organization string.""" - return "organizations/{organization}".format(organization=organization,) + return "organizations/{organization}".format( + organization=organization, + ) @staticmethod def parse_common_organization_path(path: str) -> Dict[str, str]: @@ -273,9 +303,13 @@ def parse_common_organization_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_project_path(project: str,) -> str: + def common_project_path( + project: str, + ) -> str: """Returns a fully-qualified project string.""" - return "projects/{project}".format(project=project,) + return "projects/{project}".format( + project=project, + ) @staticmethod def parse_common_project_path(path: str) -> Dict[str, str]: @@ -284,10 +318,14 @@ def parse_common_project_path(path: str) -> Dict[str, str]: return m.groupdict() if m else {} @staticmethod - def common_location_path(project: str, location: str,) -> str: + def common_location_path( + project: str, + location: str, + ) -> str: """Returns a fully-qualified location string.""" return "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) @staticmethod @@ -479,7 +517,6 @@ def create_product_set( - Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters. - .. code-block:: python from google.cloud import vision_v1p4beta1 @@ -578,7 +615,12 @@ def sample_create_product_set(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -599,7 +641,6 @@ def list_product_sets( - Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1. - .. code-block:: python from google.cloud import vision_v1p4beta1 @@ -679,12 +720,20 @@ def sample_list_product_sets(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListProductSetsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -705,7 +754,6 @@ def get_product_set( - Returns NOT_FOUND if the ProductSet does not exist. - .. code-block:: python from google.cloud import vision_v1p4beta1 @@ -785,7 +833,12 @@ def sample_get_product_set(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -810,7 +863,6 @@ def update_product_set( update_mask but missing from the request or longer than 4096 characters. - .. code-block:: python from google.cloud import vision_v1p4beta1 @@ -900,7 +952,12 @@ def sample_update_product_set(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -919,7 +976,6 @@ def delete_product_set( The actual image files are not deleted from Google Cloud Storage. - .. code-block:: python from google.cloud import vision_v1p4beta1 @@ -988,7 +1044,10 @@ def sample_delete_product_set(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def create_product( @@ -1013,7 +1072,6 @@ def create_product( - Returns INVALID_ARGUMENT if product_category is missing or invalid. - .. code-block:: python from google.cloud import vision_v1p4beta1 @@ -1107,7 +1165,12 @@ def sample_create_product(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1128,7 +1191,6 @@ def list_products( - Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. - .. code-block:: python from google.cloud import vision_v1p4beta1 @@ -1208,12 +1270,20 @@ def sample_list_products(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListProductsPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1234,7 +1304,6 @@ def get_product( - Returns NOT_FOUND if the Product does not exist. - .. code-block:: python from google.cloud import vision_v1p4beta1 @@ -1309,7 +1378,12 @@ def sample_get_product(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1341,7 +1415,6 @@ def update_product( - Returns INVALID_ARGUMENT if product_category is present in update_mask. - .. code-block:: python from google.cloud import vision_v1p4beta1 @@ -1428,7 +1501,12 @@ def sample_update_product(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1449,7 +1527,6 @@ def delete_product( ProductSets containing the product may still work until all related caches are refreshed. - .. code-block:: python from google.cloud import vision_v1p4beta1 @@ -1518,7 +1595,10 @@ def sample_delete_product(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def create_reference_image( @@ -1555,7 +1635,6 @@ def create_reference_image( - Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. - .. code-block:: python from google.cloud import vision_v1p4beta1 @@ -1659,7 +1738,12 @@ def sample_create_reference_image(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1681,7 +1765,6 @@ def delete_reference_image( The actual image files are not deleted from Google Cloud Storage. - .. code-block:: python from google.cloud import vision_v1p4beta1 @@ -1752,7 +1835,10 @@ def sample_delete_reference_image(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def list_reference_images( @@ -1772,7 +1858,6 @@ def list_reference_images( - Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1. - .. code-block:: python from google.cloud import vision_v1p4beta1 @@ -1853,12 +1938,20 @@ def sample_list_reference_images(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListReferenceImagesPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -1879,7 +1972,6 @@ def get_reference_image( - Returns NOT_FOUND if the specified image does not exist. - .. code-block:: python from google.cloud import vision_v1p4beta1 @@ -1958,7 +2050,12 @@ def sample_get_reference_image(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Done; return the response. return response @@ -1985,7 +2082,6 @@ def add_product_to_product_set( - Returns NOT_FOUND if the Product or the ProductSet doesn't exist. - .. code-block:: python from google.cloud import vision_v1p4beta1 @@ -2072,7 +2168,10 @@ def sample_add_product_to_product_set(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def remove_product_from_product_set( @@ -2175,7 +2274,10 @@ def sample_remove_product_from_product_set(): # Send the request. rpc( - request, retry=retry, timeout=timeout, metadata=metadata, + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) def list_products_in_product_set( @@ -2198,7 +2300,6 @@ def list_products_in_product_set( - Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. - .. code-block:: python from google.cloud import vision_v1p4beta1 @@ -2284,12 +2385,20 @@ def sample_list_products_in_product_set(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. response = pagers.ListProductsInProductSetPager( - method=rpc, request=request, response=response, metadata=metadata, + method=rpc, + request=request, + response=response, + metadata=metadata, ) # Done; return the response. @@ -2318,7 +2427,6 @@ def import_product_sets( Storage. For the format of the csv file please see [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.csv_file_uri]. - .. code-block:: python from google.cloud import vision_v1p4beta1 @@ -2417,7 +2525,12 @@ def sample_import_product_sets(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -2467,7 +2580,6 @@ def purge_products( request. ``Operation.metadata`` contains ``BatchOperationMetadata``. (progress) - .. code-block:: python from google.cloud import vision_v1p4beta1 @@ -2561,7 +2673,12 @@ def sample_purge_products(): ) # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) # Wrap the response in an operation future. response = operation.from_gapic( @@ -2590,7 +2707,9 @@ def __exit__(self, type, value, traceback): try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() 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 ff97ab64..eb88c84d 100644 --- a/google/cloud/vision_v1p4beta1/services/product_search/transports/base.py +++ b/google/cloud/vision_v1p4beta1/services/product_search/transports/base.py @@ -32,7 +32,9 @@ try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( - gapic_version=pkg_resources.get_distribution("google-cloud-vision",).version, + gapic_version=pkg_resources.get_distribution( + "google-cloud-vision", + ).version, ) except pkg_resources.DistributionNotFound: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo() @@ -84,6 +86,7 @@ def __init__( always_use_jwt_access (Optional[bool]): Whether self signed JWT should be used for service account credentials. """ + # Save the hostname. Default to port 443 (HTTPS) if none is specified. if ":" not in host: host += ":443" @@ -371,16 +374,18 @@ def _prep_wrapped_messages(self, client_info): client_info=client_info, ), self.purge_products: gapic_v1.method.wrap_method( - self.purge_products, default_timeout=None, client_info=client_info, + self.purge_products, + default_timeout=None, + client_info=client_info, ), } def close(self): """Closes resources associated with the transport. - .. warning:: - Only call this method if the transport is NOT shared - with other clients - this may cause errors in other clients! + .. warning:: + Only call this method if the transport is NOT shared + with other clients - this may cause errors in other clients! """ raise NotImplementedError() @@ -593,5 +598,9 @@ def purge_products( ]: raise NotImplementedError() + @property + def kind(self) -> str: + raise NotImplementedError() + __all__ = ("ProductSearchTransport",) 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 d769e017..2495c1c7 100644 --- a/google/cloud/vision_v1p4beta1/services/product_search/transports/grpc.py +++ b/google/cloud/vision_v1p4beta1/services/product_search/transports/grpc.py @@ -247,8 +247,7 @@ def create_channel( @property def grpc_channel(self) -> grpc.Channel: - """Return the channel designed to connect to this service. - """ + """Return the channel designed to connect to this service.""" return self._grpc_channel @property @@ -959,5 +958,9 @@ def purge_products( def close(self): self.grpc_channel.close() + @property + def kind(self) -> str: + return "grpc" + __all__ = ("ProductSearchGrpcTransport",) diff --git a/google/cloud/vision_v1p4beta1/types/__init__.py b/google/cloud/vision_v1p4beta1/types/__init__.py index 1f031b25..2b4cff8d 100644 --- a/google/cloud/vision_v1p4beta1/types/__init__.py +++ b/google/cloud/vision_v1p4beta1/types/__init__.py @@ -111,7 +111,9 @@ TextAnnotation, Word, ) -from .web_detection import WebDetection +from .web_detection import ( + WebDetection, +) __all__ = ( "Celebrity", diff --git a/google/cloud/vision_v1p4beta1/types/face.py b/google/cloud/vision_v1p4beta1/types/face.py index 6d7a311c..bda1f4bf 100644 --- a/google/cloud/vision_v1p4beta1/types/face.py +++ b/google/cloud/vision_v1p4beta1/types/face.py @@ -18,7 +18,11 @@ __protobuf__ = proto.module( package="google.cloud.vision.v1p4beta1", - manifest={"FaceRecognitionParams", "Celebrity", "FaceRecognitionResult",}, + manifest={ + "FaceRecognitionParams", + "Celebrity", + "FaceRecognitionResult", + }, ) @@ -35,7 +39,10 @@ class FaceRecognitionParams(proto.Message): Celebrities in the CelebritySets. """ - celebrity_set = proto.RepeatedField(proto.STRING, number=1,) + celebrity_set = proto.RepeatedField( + proto.STRING, + number=1, + ) class Celebrity(proto.Message): @@ -51,9 +58,18 @@ class Celebrity(proto.Message): The Celebrity's description. """ - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) class FaceRecognitionResult(proto.Message): @@ -67,8 +83,15 @@ class FaceRecognitionResult(proto.Message): Recognition confidence. Range [0, 1]. """ - celebrity = proto.Field(proto.MESSAGE, number=1, message="Celebrity",) - confidence = proto.Field(proto.FLOAT, number=2,) + celebrity = proto.Field( + proto.MESSAGE, + number=1, + message="Celebrity", + ) + confidence = proto.Field( + proto.FLOAT, + number=2, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/vision_v1p4beta1/types/geometry.py b/google/cloud/vision_v1p4beta1/types/geometry.py index cd4cf8f6..85607d4a 100644 --- a/google/cloud/vision_v1p4beta1/types/geometry.py +++ b/google/cloud/vision_v1p4beta1/types/geometry.py @@ -18,7 +18,12 @@ __protobuf__ = proto.module( package="google.cloud.vision.v1p4beta1", - manifest={"Vertex", "NormalizedVertex", "BoundingPoly", "Position",}, + manifest={ + "Vertex", + "NormalizedVertex", + "BoundingPoly", + "Position", + }, ) @@ -34,8 +39,14 @@ class Vertex(proto.Message): Y coordinate. """ - x = proto.Field(proto.INT32, number=1,) - y = proto.Field(proto.INT32, number=2,) + x = proto.Field( + proto.INT32, + number=1, + ) + y = proto.Field( + proto.INT32, + number=2, + ) class NormalizedVertex(proto.Message): @@ -50,8 +61,14 @@ class NormalizedVertex(proto.Message): Y coordinate. """ - x = proto.Field(proto.FLOAT, number=1,) - y = proto.Field(proto.FLOAT, number=2,) + x = proto.Field( + proto.FLOAT, + number=1, + ) + y = proto.Field( + proto.FLOAT, + number=2, + ) class BoundingPoly(proto.Message): @@ -64,9 +81,15 @@ class BoundingPoly(proto.Message): The bounding polygon normalized vertices. """ - vertices = proto.RepeatedField(proto.MESSAGE, number=1, message="Vertex",) + vertices = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Vertex", + ) normalized_vertices = proto.RepeatedField( - proto.MESSAGE, number=2, message="NormalizedVertex", + proto.MESSAGE, + number=2, + message="NormalizedVertex", ) @@ -85,9 +108,18 @@ class Position(proto.Message): Z coordinate (or depth). """ - x = proto.Field(proto.FLOAT, number=1,) - y = proto.Field(proto.FLOAT, number=2,) - z = proto.Field(proto.FLOAT, number=3,) + x = proto.Field( + proto.FLOAT, + number=1, + ) + y = proto.Field( + proto.FLOAT, + number=2, + ) + z = proto.Field( + proto.FLOAT, + number=3, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/vision_v1p4beta1/types/image_annotator.py b/google/cloud/vision_v1p4beta1/types/image_annotator.py index aba2ceac..ca8d661f 100644 --- a/google/cloud/vision_v1p4beta1/types/image_annotator.py +++ b/google/cloud/vision_v1p4beta1/types/image_annotator.py @@ -119,9 +119,19 @@ class Type(proto.Enum): PRODUCT_SEARCH = 12 OBJECT_LOCALIZATION = 19 - type_ = proto.Field(proto.ENUM, number=1, enum=Type,) - max_results = proto.Field(proto.INT32, number=2,) - model = proto.Field(proto.STRING, number=3,) + type_ = proto.Field( + proto.ENUM, + number=1, + enum=Type, + ) + max_results = proto.Field( + proto.INT32, + number=2, + ) + model = proto.Field( + proto.STRING, + number=3, + ) class ImageSource(proto.Message): @@ -159,8 +169,14 @@ class ImageSource(proto.Message): ``image_uri`` takes precedence. """ - gcs_image_uri = proto.Field(proto.STRING, number=1,) - image_uri = proto.Field(proto.STRING, number=2,) + gcs_image_uri = proto.Field( + proto.STRING, + number=1, + ) + image_uri = proto.Field( + proto.STRING, + number=2, + ) class Image(proto.Message): @@ -178,8 +194,15 @@ class Image(proto.Message): perform the image annotation request. """ - content = proto.Field(proto.BYTES, number=1,) - source = proto.Field(proto.MESSAGE, number=2, message="ImageSource",) + content = proto.Field( + proto.BYTES, + number=1, + ) + source = proto.Field( + proto.MESSAGE, + number=2, + message="ImageSource", + ) class FaceAnnotation(proto.Message): @@ -299,28 +322,91 @@ class Type(proto.Enum): CHIN_LEFT_GONION = 33 CHIN_RIGHT_GONION = 34 - type_ = proto.Field(proto.ENUM, number=3, enum="FaceAnnotation.Landmark.Type",) - position = proto.Field(proto.MESSAGE, number=4, message=geometry.Position,) - - bounding_poly = proto.Field(proto.MESSAGE, number=1, message=geometry.BoundingPoly,) + type_ = proto.Field( + proto.ENUM, + number=3, + enum="FaceAnnotation.Landmark.Type", + ) + position = proto.Field( + proto.MESSAGE, + number=4, + message=geometry.Position, + ) + + bounding_poly = proto.Field( + proto.MESSAGE, + number=1, + message=geometry.BoundingPoly, + ) fd_bounding_poly = proto.Field( - proto.MESSAGE, number=2, message=geometry.BoundingPoly, - ) - landmarks = proto.RepeatedField(proto.MESSAGE, number=3, message=Landmark,) - roll_angle = proto.Field(proto.FLOAT, number=4,) - pan_angle = proto.Field(proto.FLOAT, number=5,) - tilt_angle = proto.Field(proto.FLOAT, number=6,) - detection_confidence = proto.Field(proto.FLOAT, number=7,) - landmarking_confidence = proto.Field(proto.FLOAT, number=8,) - joy_likelihood = proto.Field(proto.ENUM, number=9, enum="Likelihood",) - sorrow_likelihood = proto.Field(proto.ENUM, number=10, enum="Likelihood",) - anger_likelihood = proto.Field(proto.ENUM, number=11, enum="Likelihood",) - surprise_likelihood = proto.Field(proto.ENUM, number=12, enum="Likelihood",) - under_exposed_likelihood = proto.Field(proto.ENUM, number=13, enum="Likelihood",) - blurred_likelihood = proto.Field(proto.ENUM, number=14, enum="Likelihood",) - headwear_likelihood = proto.Field(proto.ENUM, number=15, enum="Likelihood",) + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + landmarks = proto.RepeatedField( + proto.MESSAGE, + number=3, + message=Landmark, + ) + roll_angle = proto.Field( + proto.FLOAT, + number=4, + ) + pan_angle = proto.Field( + proto.FLOAT, + number=5, + ) + tilt_angle = proto.Field( + proto.FLOAT, + number=6, + ) + detection_confidence = proto.Field( + proto.FLOAT, + number=7, + ) + landmarking_confidence = proto.Field( + proto.FLOAT, + number=8, + ) + joy_likelihood = proto.Field( + proto.ENUM, + number=9, + enum="Likelihood", + ) + sorrow_likelihood = proto.Field( + proto.ENUM, + number=10, + enum="Likelihood", + ) + anger_likelihood = proto.Field( + proto.ENUM, + number=11, + enum="Likelihood", + ) + surprise_likelihood = proto.Field( + proto.ENUM, + number=12, + enum="Likelihood", + ) + under_exposed_likelihood = proto.Field( + proto.ENUM, + number=13, + enum="Likelihood", + ) + blurred_likelihood = proto.Field( + proto.ENUM, + number=14, + enum="Likelihood", + ) + headwear_likelihood = proto.Field( + proto.ENUM, + number=15, + enum="Likelihood", + ) recognition_result = proto.RepeatedField( - proto.MESSAGE, number=16, message=face.FaceRecognitionResult, + proto.MESSAGE, + number=16, + message=face.FaceRecognitionResult, ) @@ -332,7 +418,11 @@ class LocationInfo(proto.Message): lat/long location coordinates. """ - lat_lng = proto.Field(proto.MESSAGE, number=1, message=latlng_pb2.LatLng,) + lat_lng = proto.Field( + proto.MESSAGE, + number=1, + message=latlng_pb2.LatLng, + ) class Property(proto.Message): @@ -347,9 +437,18 @@ class Property(proto.Message): Value of numeric properties. """ - name = proto.Field(proto.STRING, number=1,) - value = proto.Field(proto.STRING, number=2,) - uint64_value = proto.Field(proto.UINT64, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + value = proto.Field( + proto.STRING, + number=2, + ) + uint64_value = proto.Field( + proto.UINT64, + number=3, + ) class EntityAnnotation(proto.Message): @@ -397,15 +496,45 @@ class EntityAnnotation(proto.Message): the entity. """ - mid = proto.Field(proto.STRING, number=1,) - locale = proto.Field(proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) - score = proto.Field(proto.FLOAT, number=4,) - confidence = proto.Field(proto.FLOAT, number=5,) - topicality = proto.Field(proto.FLOAT, number=6,) - bounding_poly = proto.Field(proto.MESSAGE, number=7, message=geometry.BoundingPoly,) - locations = proto.RepeatedField(proto.MESSAGE, number=8, message="LocationInfo",) - properties = proto.RepeatedField(proto.MESSAGE, number=9, message="Property",) + mid = proto.Field( + proto.STRING, + number=1, + ) + locale = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) + score = proto.Field( + proto.FLOAT, + number=4, + ) + confidence = proto.Field( + proto.FLOAT, + number=5, + ) + topicality = proto.Field( + proto.FLOAT, + number=6, + ) + bounding_poly = proto.Field( + proto.MESSAGE, + number=7, + message=geometry.BoundingPoly, + ) + locations = proto.RepeatedField( + proto.MESSAGE, + number=8, + message="LocationInfo", + ) + properties = proto.RepeatedField( + proto.MESSAGE, + number=9, + message="Property", + ) class LocalizedObjectAnnotation(proto.Message): @@ -428,11 +557,27 @@ class LocalizedObjectAnnotation(proto.Message): This must be populated. """ - mid = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) - name = proto.Field(proto.STRING, number=3,) - score = proto.Field(proto.FLOAT, number=4,) - bounding_poly = proto.Field(proto.MESSAGE, number=5, message=geometry.BoundingPoly,) + mid = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) + name = proto.Field( + proto.STRING, + number=3, + ) + score = proto.Field( + proto.FLOAT, + number=4, + ) + bounding_poly = proto.Field( + proto.MESSAGE, + number=5, + message=geometry.BoundingPoly, + ) class SafeSearchAnnotation(proto.Message): @@ -464,11 +609,31 @@ class SafeSearchAnnotation(proto.Message): body areas. """ - adult = proto.Field(proto.ENUM, number=1, enum="Likelihood",) - spoof = proto.Field(proto.ENUM, number=2, enum="Likelihood",) - medical = proto.Field(proto.ENUM, number=3, enum="Likelihood",) - violence = proto.Field(proto.ENUM, number=4, enum="Likelihood",) - racy = proto.Field(proto.ENUM, number=9, enum="Likelihood",) + adult = proto.Field( + proto.ENUM, + number=1, + enum="Likelihood", + ) + spoof = proto.Field( + proto.ENUM, + number=2, + enum="Likelihood", + ) + medical = proto.Field( + proto.ENUM, + number=3, + enum="Likelihood", + ) + violence = proto.Field( + proto.ENUM, + number=4, + enum="Likelihood", + ) + racy = proto.Field( + proto.ENUM, + number=9, + enum="Likelihood", + ) class LatLongRect(proto.Message): @@ -481,8 +646,16 @@ class LatLongRect(proto.Message): Max lat/long pair. """ - min_lat_lng = proto.Field(proto.MESSAGE, number=1, message=latlng_pb2.LatLng,) - max_lat_lng = proto.Field(proto.MESSAGE, number=2, message=latlng_pb2.LatLng,) + min_lat_lng = proto.Field( + proto.MESSAGE, + number=1, + message=latlng_pb2.LatLng, + ) + max_lat_lng = proto.Field( + proto.MESSAGE, + number=2, + message=latlng_pb2.LatLng, + ) class ColorInfo(proto.Message): @@ -499,9 +672,19 @@ class ColorInfo(proto.Message): Value in range [0, 1]. """ - color = proto.Field(proto.MESSAGE, number=1, message=color_pb2.Color,) - score = proto.Field(proto.FLOAT, number=2,) - pixel_fraction = proto.Field(proto.FLOAT, number=3,) + color = proto.Field( + proto.MESSAGE, + number=1, + message=color_pb2.Color, + ) + score = proto.Field( + proto.FLOAT, + number=2, + ) + pixel_fraction = proto.Field( + proto.FLOAT, + number=3, + ) class DominantColorsAnnotation(proto.Message): @@ -513,7 +696,11 @@ class DominantColorsAnnotation(proto.Message): fraction. """ - colors = proto.RepeatedField(proto.MESSAGE, number=1, message="ColorInfo",) + colors = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="ColorInfo", + ) class ImageProperties(proto.Message): @@ -526,7 +713,9 @@ class ImageProperties(proto.Message): """ dominant_colors = proto.Field( - proto.MESSAGE, number=1, message="DominantColorsAnnotation", + proto.MESSAGE, + number=1, + message="DominantColorsAnnotation", ) @@ -546,9 +735,19 @@ class CropHint(proto.Message): with respect to the original image. """ - bounding_poly = proto.Field(proto.MESSAGE, number=1, message=geometry.BoundingPoly,) - confidence = proto.Field(proto.FLOAT, number=2,) - importance_fraction = proto.Field(proto.FLOAT, number=3,) + bounding_poly = proto.Field( + proto.MESSAGE, + number=1, + message=geometry.BoundingPoly, + ) + confidence = proto.Field( + proto.FLOAT, + number=2, + ) + importance_fraction = proto.Field( + proto.FLOAT, + number=3, + ) class CropHintsAnnotation(proto.Message): @@ -560,7 +759,11 @@ class CropHintsAnnotation(proto.Message): Crop hint results. """ - crop_hints = proto.RepeatedField(proto.MESSAGE, number=1, message="CropHint",) + crop_hints = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="CropHint", + ) class CropHintsParams(proto.Message): @@ -578,7 +781,10 @@ class CropHintsParams(proto.Message): provided after the 16th are ignored. """ - aspect_ratios = proto.RepeatedField(proto.FLOAT, number=1,) + aspect_ratios = proto.RepeatedField( + proto.FLOAT, + number=1, + ) class WebDetectionParams(proto.Message): @@ -590,7 +796,10 @@ class WebDetectionParams(proto.Message): geo information in the image. """ - include_geo_results = proto.Field(proto.BOOL, number=2,) + include_geo_results = proto.Field( + proto.BOOL, + number=2, + ) class TextDetectionParams(proto.Message): @@ -604,7 +813,10 @@ class TextDetectionParams(proto.Message): include confidence score for TEXT_DETECTION as well. """ - enable_text_detection_confidence_score = proto.Field(proto.BOOL, number=9,) + enable_text_detection_confidence_score = proto.Field( + proto.BOOL, + number=9, + ) class ImageContext(proto.Message): @@ -637,20 +849,39 @@ class ImageContext(proto.Message): text detection. """ - lat_long_rect = proto.Field(proto.MESSAGE, number=1, message="LatLongRect",) - language_hints = proto.RepeatedField(proto.STRING, number=2,) - crop_hints_params = proto.Field(proto.MESSAGE, number=4, message="CropHintsParams",) + lat_long_rect = proto.Field( + proto.MESSAGE, + number=1, + message="LatLongRect", + ) + language_hints = proto.RepeatedField( + proto.STRING, + number=2, + ) + crop_hints_params = proto.Field( + proto.MESSAGE, + number=4, + message="CropHintsParams", + ) face_recognition_params = proto.Field( - proto.MESSAGE, number=10, message=face.FaceRecognitionParams, + proto.MESSAGE, + number=10, + message=face.FaceRecognitionParams, ) product_search_params = proto.Field( - proto.MESSAGE, number=5, message=product_search.ProductSearchParams, + proto.MESSAGE, + number=5, + message=product_search.ProductSearchParams, ) web_detection_params = proto.Field( - proto.MESSAGE, number=6, message="WebDetectionParams", + proto.MESSAGE, + number=6, + message="WebDetectionParams", ) text_detection_params = proto.Field( - proto.MESSAGE, number=12, message="TextDetectionParams", + proto.MESSAGE, + number=12, + message="TextDetectionParams", ) @@ -669,9 +900,21 @@ class AnnotateImageRequest(proto.Message): image. """ - image = proto.Field(proto.MESSAGE, number=1, message="Image",) - features = proto.RepeatedField(proto.MESSAGE, number=2, message="Feature",) - image_context = proto.Field(proto.MESSAGE, number=3, message="ImageContext",) + image = proto.Field( + proto.MESSAGE, + number=1, + message="Image", + ) + features = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="Feature", + ) + image_context = proto.Field( + proto.MESSAGE, + number=3, + message="ImageContext", + ) class ImageAnnotationContext(proto.Message): @@ -688,8 +931,14 @@ class ImageAnnotationContext(proto.Message): produce the image. """ - uri = proto.Field(proto.STRING, number=1,) - page_number = proto.Field(proto.INT32, number=2,) + uri = proto.Field( + proto.STRING, + number=1, + ) + page_number = proto.Field( + proto.INT32, + number=2, + ) class AnnotateImageResponse(proto.Message): @@ -745,43 +994,75 @@ class AnnotateImageResponse(proto.Message): """ face_annotations = proto.RepeatedField( - proto.MESSAGE, number=1, message="FaceAnnotation", + proto.MESSAGE, + number=1, + message="FaceAnnotation", ) landmark_annotations = proto.RepeatedField( - proto.MESSAGE, number=2, message="EntityAnnotation", + proto.MESSAGE, + number=2, + message="EntityAnnotation", ) logo_annotations = proto.RepeatedField( - proto.MESSAGE, number=3, message="EntityAnnotation", + proto.MESSAGE, + number=3, + message="EntityAnnotation", ) label_annotations = proto.RepeatedField( - proto.MESSAGE, number=4, message="EntityAnnotation", + proto.MESSAGE, + number=4, + message="EntityAnnotation", ) localized_object_annotations = proto.RepeatedField( - proto.MESSAGE, number=22, message="LocalizedObjectAnnotation", + proto.MESSAGE, + number=22, + message="LocalizedObjectAnnotation", ) text_annotations = proto.RepeatedField( - proto.MESSAGE, number=5, message="EntityAnnotation", + proto.MESSAGE, + number=5, + message="EntityAnnotation", ) full_text_annotation = proto.Field( - proto.MESSAGE, number=12, message=text_annotation.TextAnnotation, + proto.MESSAGE, + number=12, + message=text_annotation.TextAnnotation, ) safe_search_annotation = proto.Field( - proto.MESSAGE, number=6, message="SafeSearchAnnotation", + proto.MESSAGE, + number=6, + message="SafeSearchAnnotation", ) image_properties_annotation = proto.Field( - proto.MESSAGE, number=8, message="ImageProperties", + proto.MESSAGE, + number=8, + message="ImageProperties", ) crop_hints_annotation = proto.Field( - proto.MESSAGE, number=11, message="CropHintsAnnotation", + proto.MESSAGE, + number=11, + message="CropHintsAnnotation", ) web_detection = proto.Field( - proto.MESSAGE, number=13, message=gcv_web_detection.WebDetection, + proto.MESSAGE, + number=13, + message=gcv_web_detection.WebDetection, ) product_search_results = proto.Field( - proto.MESSAGE, number=14, message=product_search.ProductSearchResults, + proto.MESSAGE, + number=14, + message=product_search.ProductSearchResults, + ) + error = proto.Field( + proto.MESSAGE, + number=9, + message=status_pb2.Status, + ) + context = proto.Field( + proto.MESSAGE, + number=21, + message="ImageAnnotationContext", ) - error = proto.Field(proto.MESSAGE, number=9, message=status_pb2.Status,) - context = proto.Field(proto.MESSAGE, number=21, message="ImageAnnotationContext",) class BatchAnnotateImagesRequest(proto.Message): @@ -795,7 +1076,9 @@ class BatchAnnotateImagesRequest(proto.Message): """ requests = proto.RepeatedField( - proto.MESSAGE, number=1, message="AnnotateImageRequest", + proto.MESSAGE, + number=1, + message="AnnotateImageRequest", ) @@ -809,7 +1092,9 @@ class BatchAnnotateImagesResponse(proto.Message): """ responses = proto.RepeatedField( - proto.MESSAGE, number=1, message="AnnotateImageResponse", + proto.MESSAGE, + number=1, + message="AnnotateImageResponse", ) @@ -843,10 +1128,25 @@ class AnnotateFileRequest(proto.Message): of the file. """ - input_config = proto.Field(proto.MESSAGE, number=1, message="InputConfig",) - features = proto.RepeatedField(proto.MESSAGE, number=2, message="Feature",) - image_context = proto.Field(proto.MESSAGE, number=3, message="ImageContext",) - pages = proto.RepeatedField(proto.INT32, number=4,) + input_config = proto.Field( + proto.MESSAGE, + number=1, + message="InputConfig", + ) + features = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="Feature", + ) + image_context = proto.Field( + proto.MESSAGE, + number=3, + message="ImageContext", + ) + pages = proto.RepeatedField( + proto.INT32, + number=4, + ) class AnnotateFileResponse(proto.Message): @@ -869,12 +1169,25 @@ class AnnotateFileResponse(proto.Message): The ``responses`` field will not be set in this case. """ - input_config = proto.Field(proto.MESSAGE, number=1, message="InputConfig",) + input_config = proto.Field( + proto.MESSAGE, + number=1, + message="InputConfig", + ) responses = proto.RepeatedField( - proto.MESSAGE, number=2, message="AnnotateImageResponse", + proto.MESSAGE, + number=2, + message="AnnotateImageResponse", + ) + total_pages = proto.Field( + proto.INT32, + number=3, + ) + error = proto.Field( + proto.MESSAGE, + number=4, + message=status_pb2.Status, ) - total_pages = proto.Field(proto.INT32, number=3,) - error = proto.Field(proto.MESSAGE, number=4, message=status_pb2.Status,) class BatchAnnotateFilesRequest(proto.Message): @@ -890,7 +1203,9 @@ class BatchAnnotateFilesRequest(proto.Message): """ requests = proto.RepeatedField( - proto.MESSAGE, number=1, message="AnnotateFileRequest", + proto.MESSAGE, + number=1, + message="AnnotateFileRequest", ) @@ -906,7 +1221,9 @@ class BatchAnnotateFilesResponse(proto.Message): """ responses = proto.RepeatedField( - proto.MESSAGE, number=1, message="AnnotateFileResponse", + proto.MESSAGE, + number=1, + message="AnnotateFileResponse", ) @@ -926,10 +1243,26 @@ class AsyncAnnotateFileRequest(proto.Message): metadata (e.g. format). """ - input_config = proto.Field(proto.MESSAGE, number=1, message="InputConfig",) - features = proto.RepeatedField(proto.MESSAGE, number=2, message="Feature",) - image_context = proto.Field(proto.MESSAGE, number=3, message="ImageContext",) - output_config = proto.Field(proto.MESSAGE, number=4, message="OutputConfig",) + input_config = proto.Field( + proto.MESSAGE, + number=1, + message="InputConfig", + ) + features = proto.RepeatedField( + proto.MESSAGE, + number=2, + message="Feature", + ) + image_context = proto.Field( + proto.MESSAGE, + number=3, + message="ImageContext", + ) + output_config = proto.Field( + proto.MESSAGE, + number=4, + message="OutputConfig", + ) class AsyncAnnotateFileResponse(proto.Message): @@ -941,7 +1274,11 @@ class AsyncAnnotateFileResponse(proto.Message): AsyncAnnotateFileRequest. """ - output_config = proto.Field(proto.MESSAGE, number=1, message="OutputConfig",) + output_config = proto.Field( + proto.MESSAGE, + number=1, + message="OutputConfig", + ) class AsyncBatchAnnotateImagesRequest(proto.Message): @@ -957,9 +1294,15 @@ class AsyncBatchAnnotateImagesRequest(proto.Message): """ requests = proto.RepeatedField( - proto.MESSAGE, number=1, message="AnnotateImageRequest", + proto.MESSAGE, + number=1, + message="AnnotateImageRequest", + ) + output_config = proto.Field( + proto.MESSAGE, + number=2, + message="OutputConfig", ) - output_config = proto.Field(proto.MESSAGE, number=2, message="OutputConfig",) class AsyncBatchAnnotateImagesResponse(proto.Message): @@ -971,7 +1314,11 @@ class AsyncBatchAnnotateImagesResponse(proto.Message): AsyncBatchAnnotateImagesRequest. """ - output_config = proto.Field(proto.MESSAGE, number=1, message="OutputConfig",) + output_config = proto.Field( + proto.MESSAGE, + number=1, + message="OutputConfig", + ) class AsyncBatchAnnotateFilesRequest(proto.Message): @@ -985,7 +1332,9 @@ class AsyncBatchAnnotateFilesRequest(proto.Message): """ requests = proto.RepeatedField( - proto.MESSAGE, number=1, message="AsyncAnnotateFileRequest", + proto.MESSAGE, + number=1, + message="AsyncAnnotateFileRequest", ) @@ -1000,7 +1349,9 @@ class AsyncBatchAnnotateFilesResponse(proto.Message): """ responses = proto.RepeatedField( - proto.MESSAGE, number=1, message="AsyncAnnotateFileResponse", + proto.MESSAGE, + number=1, + message="AsyncAnnotateFileResponse", ) @@ -1025,9 +1376,19 @@ class InputConfig(proto.Message): are supported. Wildcards are not supported. """ - gcs_source = proto.Field(proto.MESSAGE, number=1, message="GcsSource",) - content = proto.Field(proto.BYTES, number=3,) - mime_type = proto.Field(proto.STRING, number=2,) + gcs_source = proto.Field( + proto.MESSAGE, + number=1, + message="GcsSource", + ) + content = proto.Field( + proto.BYTES, + number=3, + ) + mime_type = proto.Field( + proto.STRING, + number=2, + ) class OutputConfig(proto.Message): @@ -1051,8 +1412,15 @@ class OutputConfig(proto.Message): potential future support for other output configurations. """ - gcs_destination = proto.Field(proto.MESSAGE, number=1, message="GcsDestination",) - batch_size = proto.Field(proto.INT32, number=2,) + gcs_destination = proto.Field( + proto.MESSAGE, + number=1, + message="GcsDestination", + ) + batch_size = proto.Field( + proto.INT32, + number=2, + ) class GcsSource(proto.Message): @@ -1066,7 +1434,10 @@ class GcsSource(proto.Message): Wildcards are not currently supported. """ - uri = proto.Field(proto.STRING, number=1,) + uri = proto.Field( + proto.STRING, + number=1, + ) class GcsDestination(proto.Message): @@ -1103,7 +1474,10 @@ class GcsDestination(proto.Message): overflows into multiple sharded files. """ - uri = proto.Field(proto.STRING, number=1,) + uri = proto.Field( + proto.STRING, + number=1, + ) class OperationMetadata(proto.Message): @@ -1127,9 +1501,21 @@ class State(proto.Enum): DONE = 3 CANCELLED = 4 - state = proto.Field(proto.ENUM, number=1, enum=State,) - create_time = proto.Field(proto.MESSAGE, number=5, message=timestamp_pb2.Timestamp,) - update_time = proto.Field(proto.MESSAGE, number=6, message=timestamp_pb2.Timestamp,) + state = proto.Field( + proto.ENUM, + number=1, + enum=State, + ) + create_time = proto.Field( + proto.MESSAGE, + number=5, + message=timestamp_pb2.Timestamp, + ) + update_time = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/vision_v1p4beta1/types/product_search.py b/google/cloud/vision_v1p4beta1/types/product_search.py index d2c1a6ce..5f9fe74f 100644 --- a/google/cloud/vision_v1p4beta1/types/product_search.py +++ b/google/cloud/vision_v1p4beta1/types/product_search.py @@ -22,7 +22,10 @@ __protobuf__ = proto.module( package="google.cloud.vision.v1p4beta1", - manifest={"ProductSearchParams", "ProductSearchResults",}, + manifest={ + "ProductSearchParams", + "ProductSearchResults", + }, ) @@ -67,10 +70,23 @@ class ProductSearchParams(proto.Message): instead of an '='. """ - bounding_poly = proto.Field(proto.MESSAGE, number=9, message=geometry.BoundingPoly,) - product_set = proto.Field(proto.STRING, number=6,) - product_categories = proto.RepeatedField(proto.STRING, number=7,) - filter = proto.Field(proto.STRING, number=8,) + bounding_poly = proto.Field( + proto.MESSAGE, + number=9, + message=geometry.BoundingPoly, + ) + product_set = proto.Field( + proto.STRING, + number=6, + ) + product_categories = proto.RepeatedField( + proto.STRING, + number=7, + ) + filter = proto.Field( + proto.STRING, + number=8, + ) class ProductSearchResults(proto.Message): @@ -108,10 +124,18 @@ class Result(proto.Message): """ product = proto.Field( - proto.MESSAGE, number=1, message=product_search_service.Product, + proto.MESSAGE, + number=1, + message=product_search_service.Product, + ) + score = proto.Field( + proto.FLOAT, + number=2, + ) + image = proto.Field( + proto.STRING, + number=3, ) - score = proto.Field(proto.FLOAT, number=2,) - image = proto.Field(proto.STRING, number=3,) class ObjectAnnotation(proto.Message): r"""Prediction for what the object in the bounding box is. @@ -130,10 +154,22 @@ class ObjectAnnotation(proto.Message): Score of the result. Range [0, 1]. """ - mid = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) - name = proto.Field(proto.STRING, number=3,) - score = proto.Field(proto.FLOAT, number=4,) + mid = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) + name = proto.Field( + proto.STRING, + number=3, + ) + score = proto.Field( + proto.FLOAT, + number=4, + ) class GroupedResult(proto.Message): r"""Information about the products similar to a single product in @@ -151,19 +187,35 @@ class GroupedResult(proto.Message): """ bounding_poly = proto.Field( - proto.MESSAGE, number=1, message=geometry.BoundingPoly, + proto.MESSAGE, + number=1, + message=geometry.BoundingPoly, ) results = proto.RepeatedField( - proto.MESSAGE, number=2, message="ProductSearchResults.Result", + proto.MESSAGE, + number=2, + message="ProductSearchResults.Result", ) object_annotations = proto.RepeatedField( - proto.MESSAGE, number=3, message="ProductSearchResults.ObjectAnnotation", + proto.MESSAGE, + number=3, + message="ProductSearchResults.ObjectAnnotation", ) - index_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - results = proto.RepeatedField(proto.MESSAGE, number=5, message=Result,) + index_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + results = proto.RepeatedField( + proto.MESSAGE, + number=5, + message=Result, + ) product_grouped_results = proto.RepeatedField( - proto.MESSAGE, number=6, message=GroupedResult, + proto.MESSAGE, + number=6, + message=GroupedResult, ) diff --git a/google/cloud/vision_v1p4beta1/types/product_search_service.py b/google/cloud/vision_v1p4beta1/types/product_search_service.py index 4e93375f..ea89fd09 100644 --- a/google/cloud/vision_v1p4beta1/types/product_search_service.py +++ b/google/cloud/vision_v1p4beta1/types/product_search_service.py @@ -115,14 +115,36 @@ class KeyValue(proto.Message): bytes. """ - key = proto.Field(proto.STRING, number=1,) - value = proto.Field(proto.STRING, number=2,) - - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - description = proto.Field(proto.STRING, number=3,) - product_category = proto.Field(proto.STRING, number=4,) - product_labels = proto.RepeatedField(proto.MESSAGE, number=5, message=KeyValue,) + key = proto.Field( + proto.STRING, + number=1, + ) + value = proto.Field( + proto.STRING, + number=2, + ) + + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) + product_category = proto.Field( + proto.STRING, + number=4, + ) + product_labels = proto.RepeatedField( + proto.MESSAGE, + number=5, + message=KeyValue, + ) class ProductSet(proto.Message): @@ -160,10 +182,24 @@ class ProductSet(proto.Message): ProductSet. """ - name = proto.Field(proto.STRING, number=1,) - display_name = proto.Field(proto.STRING, number=2,) - index_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - index_error = proto.Field(proto.MESSAGE, number=4, message=status_pb2.Status,) + name = proto.Field( + proto.STRING, + number=1, + ) + display_name = proto.Field( + proto.STRING, + number=2, + ) + index_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) + index_error = proto.Field( + proto.MESSAGE, + number=4, + message=status_pb2.Status, + ) class ReferenceImage(proto.Message): @@ -197,10 +233,18 @@ class ReferenceImage(proto.Message): 1:4 or less (i.e. 1:3 is ok; 1:5 is not). """ - name = proto.Field(proto.STRING, number=1,) - uri = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + uri = proto.Field( + proto.STRING, + number=2, + ) bounding_polys = proto.RepeatedField( - proto.MESSAGE, number=3, message=geometry.BoundingPoly, + proto.MESSAGE, + number=3, + message=geometry.BoundingPoly, ) @@ -223,9 +267,19 @@ class CreateProductRequest(proto.Message): cannot contain the character ``/``. """ - parent = proto.Field(proto.STRING, number=1,) - product = proto.Field(proto.MESSAGE, number=2, message="Product",) - product_id = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + product = proto.Field( + proto.MESSAGE, + number=2, + message="Product", + ) + product_id = proto.Field( + proto.STRING, + number=3, + ) class ListProductsRequest(proto.Message): @@ -245,9 +299,18 @@ class ListProductsRequest(proto.Message): if any. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListProductsResponse(proto.Message): @@ -266,8 +329,15 @@ class ListProductsResponse(proto.Message): def raw_page(self): return self - products = proto.RepeatedField(proto.MESSAGE, number=1, message="Product",) - next_page_token = proto.Field(proto.STRING, number=2,) + products = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Product", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetProductRequest(proto.Message): @@ -281,7 +351,10 @@ class GetProductRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdateProductRequest(proto.Message): @@ -299,9 +372,15 @@ class UpdateProductRequest(proto.Message): ``product_labels``, ``display_name``, and ``description``. """ - product = proto.Field(proto.MESSAGE, number=1, message="Product",) + product = proto.Field( + proto.MESSAGE, + number=1, + message="Product", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -316,7 +395,10 @@ class DeleteProductRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateProductSetRequest(proto.Message): @@ -338,9 +420,19 @@ class CreateProductSetRequest(proto.Message): cannot contain the character ``/``. """ - parent = proto.Field(proto.STRING, number=1,) - product_set = proto.Field(proto.MESSAGE, number=2, message="ProductSet",) - product_set_id = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + product_set = proto.Field( + proto.MESSAGE, + number=2, + message="ProductSet", + ) + product_set_id = proto.Field( + proto.STRING, + number=3, + ) class ListProductSetsRequest(proto.Message): @@ -360,9 +452,18 @@ class ListProductSetsRequest(proto.Message): if any. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListProductSetsResponse(proto.Message): @@ -381,8 +482,15 @@ class ListProductSetsResponse(proto.Message): def raw_page(self): return self - product_sets = proto.RepeatedField(proto.MESSAGE, number=1, message="ProductSet",) - next_page_token = proto.Field(proto.STRING, number=2,) + product_sets = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="ProductSet", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class GetProductSetRequest(proto.Message): @@ -396,7 +504,10 @@ class GetProductSetRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class UpdateProductSetRequest(proto.Message): @@ -413,9 +524,15 @@ class UpdateProductSetRequest(proto.Message): ``display_name``. """ - product_set = proto.Field(proto.MESSAGE, number=1, message="ProductSet",) + product_set = proto.Field( + proto.MESSAGE, + number=1, + message="ProductSet", + ) update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, ) @@ -430,7 +547,10 @@ class DeleteProductSetRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class CreateReferenceImageRequest(proto.Message): @@ -454,9 +574,19 @@ class CreateReferenceImageRequest(proto.Message): characters long. It cannot contain the character ``/``. """ - parent = proto.Field(proto.STRING, number=1,) - reference_image = proto.Field(proto.MESSAGE, number=2, message="ReferenceImage",) - reference_image_id = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + reference_image = proto.Field( + proto.MESSAGE, + number=2, + message="ReferenceImage", + ) + reference_image_id = proto.Field( + proto.STRING, + number=3, + ) class ListReferenceImagesRequest(proto.Message): @@ -480,9 +610,18 @@ class ListReferenceImagesRequest(proto.Message): Defaults to the first page if not specified. """ - parent = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + parent = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListReferenceImagesResponse(proto.Message): @@ -504,10 +643,18 @@ def raw_page(self): return self reference_images = proto.RepeatedField( - proto.MESSAGE, number=1, message="ReferenceImage", + proto.MESSAGE, + number=1, + message="ReferenceImage", + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + next_page_token = proto.Field( + proto.STRING, + number=3, ) - page_size = proto.Field(proto.INT32, number=2,) - next_page_token = proto.Field(proto.STRING, number=3,) class GetReferenceImageRequest(proto.Message): @@ -522,7 +669,10 @@ class GetReferenceImageRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class DeleteReferenceImageRequest(proto.Message): @@ -538,7 +688,10 @@ class DeleteReferenceImageRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` """ - name = proto.Field(proto.STRING, number=1,) + name = proto.Field( + proto.STRING, + number=1, + ) class AddProductToProductSetRequest(proto.Message): @@ -558,8 +711,14 @@ class AddProductToProductSetRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ - name = proto.Field(proto.STRING, number=1,) - product = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + product = proto.Field( + proto.STRING, + number=2, + ) class RemoveProductFromProductSetRequest(proto.Message): @@ -579,8 +738,14 @@ class RemoveProductFromProductSetRequest(proto.Message): ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ - name = proto.Field(proto.STRING, number=1,) - product = proto.Field(proto.STRING, number=2,) + name = proto.Field( + proto.STRING, + number=1, + ) + product = proto.Field( + proto.STRING, + number=2, + ) class ListProductsInProductSetRequest(proto.Message): @@ -601,9 +766,18 @@ class ListProductsInProductSetRequest(proto.Message): if any. """ - name = proto.Field(proto.STRING, number=1,) - page_size = proto.Field(proto.INT32, number=2,) - page_token = proto.Field(proto.STRING, number=3,) + name = proto.Field( + proto.STRING, + number=1, + ) + page_size = proto.Field( + proto.INT32, + number=2, + ) + page_token = proto.Field( + proto.STRING, + number=3, + ) class ListProductsInProductSetResponse(proto.Message): @@ -622,8 +796,15 @@ class ListProductsInProductSetResponse(proto.Message): def raw_page(self): return self - products = proto.RepeatedField(proto.MESSAGE, number=1, message="Product",) - next_page_token = proto.Field(proto.STRING, number=2,) + products = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Product", + ) + next_page_token = proto.Field( + proto.STRING, + number=2, + ) class ImportProductSetsGcsSource(proto.Message): @@ -707,7 +888,10 @@ class ImportProductSetsGcsSource(proto.Message): too large to process (larger than 20MP). """ - csv_file_uri = proto.Field(proto.STRING, number=1,) + csv_file_uri = proto.Field( + proto.STRING, + number=1, + ) class ImportProductSetsInputConfig(proto.Message): @@ -725,7 +909,10 @@ class ImportProductSetsInputConfig(proto.Message): """ gcs_source = proto.Field( - proto.MESSAGE, number=1, oneof="source", message="ImportProductSetsGcsSource", + proto.MESSAGE, + number=1, + oneof="source", + message="ImportProductSetsGcsSource", ) @@ -743,9 +930,14 @@ class ImportProductSetsRequest(proto.Message): requests. """ - parent = proto.Field(proto.STRING, number=1,) + parent = proto.Field( + proto.STRING, + number=1, + ) input_config = proto.Field( - proto.MESSAGE, number=2, message="ImportProductSetsInputConfig", + proto.MESSAGE, + number=2, + message="ImportProductSetsInputConfig", ) @@ -772,9 +964,15 @@ class ImportProductSetsResponse(proto.Message): """ reference_images = proto.RepeatedField( - proto.MESSAGE, number=1, message="ReferenceImage", + proto.MESSAGE, + number=1, + message="ReferenceImage", + ) + statuses = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=status_pb2.Status, ) - statuses = proto.RepeatedField(proto.MESSAGE, number=2, message=status_pb2.Status,) class BatchOperationMetadata(proto.Message): @@ -806,9 +1004,21 @@ class State(proto.Enum): FAILED = 3 CANCELLED = 4 - state = proto.Field(proto.ENUM, number=1, enum=State,) - submit_time = proto.Field(proto.MESSAGE, number=2, message=timestamp_pb2.Timestamp,) - end_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) + state = proto.Field( + proto.ENUM, + number=1, + enum=State, + ) + submit_time = proto.Field( + proto.MESSAGE, + number=2, + message=timestamp_pb2.Timestamp, + ) + end_time = proto.Field( + proto.MESSAGE, + number=3, + message=timestamp_pb2.Timestamp, + ) class ProductSetPurgeConfig(proto.Message): @@ -822,7 +1032,10 @@ class ProductSetPurgeConfig(proto.Message): ProductSets, the Product will still be deleted. """ - product_set_id = proto.Field(proto.STRING, number=1,) + product_set_id = proto.Field( + proto.STRING, + number=1, + ) class PurgeProductsRequest(proto.Message): @@ -857,11 +1070,24 @@ class PurgeProductsRequest(proto.Message): """ product_set_purge_config = proto.Field( - proto.MESSAGE, number=2, oneof="target", message="ProductSetPurgeConfig", + proto.MESSAGE, + number=2, + oneof="target", + message="ProductSetPurgeConfig", + ) + delete_orphan_products = proto.Field( + proto.BOOL, + number=3, + oneof="target", + ) + parent = proto.Field( + proto.STRING, + number=1, + ) + force = proto.Field( + proto.BOOL, + number=4, ) - delete_orphan_products = proto.Field(proto.BOOL, number=3, oneof="target",) - parent = proto.Field(proto.STRING, number=1,) - force = proto.Field(proto.BOOL, number=4,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/vision_v1p4beta1/types/text_annotation.py b/google/cloud/vision_v1p4beta1/types/text_annotation.py index a83ec169..b111c85f 100644 --- a/google/cloud/vision_v1p4beta1/types/text_annotation.py +++ b/google/cloud/vision_v1p4beta1/types/text_annotation.py @@ -20,7 +20,14 @@ __protobuf__ = proto.module( package="google.cloud.vision.v1p4beta1", - manifest={"TextAnnotation", "Page", "Block", "Paragraph", "Word", "Symbol",}, + manifest={ + "TextAnnotation", + "Page", + "Block", + "Paragraph", + "Word", + "Symbol", + }, ) @@ -53,8 +60,14 @@ class DetectedLanguage(proto.Message): Confidence of detected language. Range [0, 1]. """ - language_code = proto.Field(proto.STRING, number=1,) - confidence = proto.Field(proto.FLOAT, number=2,) + language_code = proto.Field( + proto.STRING, + number=1, + ) + confidence = proto.Field( + proto.FLOAT, + number=2, + ) class DetectedBreak(proto.Message): r"""Detected start or end of a structural component. @@ -76,9 +89,14 @@ class BreakType(proto.Enum): LINE_BREAK = 5 type_ = proto.Field( - proto.ENUM, number=1, enum="TextAnnotation.DetectedBreak.BreakType", + proto.ENUM, + number=1, + enum="TextAnnotation.DetectedBreak.BreakType", + ) + is_prefix = proto.Field( + proto.BOOL, + number=2, ) - is_prefix = proto.Field(proto.BOOL, number=2,) class TextProperty(proto.Message): r"""Additional information detected on the structural component. @@ -92,14 +110,25 @@ class TextProperty(proto.Message): """ detected_languages = proto.RepeatedField( - proto.MESSAGE, number=1, message="TextAnnotation.DetectedLanguage", + proto.MESSAGE, + number=1, + message="TextAnnotation.DetectedLanguage", ) detected_break = proto.Field( - proto.MESSAGE, number=2, message="TextAnnotation.DetectedBreak", + proto.MESSAGE, + number=2, + message="TextAnnotation.DetectedBreak", ) - pages = proto.RepeatedField(proto.MESSAGE, number=1, message="Page",) - text = proto.Field(proto.STRING, number=2,) + pages = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="Page", + ) + text = proto.Field( + proto.STRING, + number=2, + ) class Page(proto.Message): @@ -122,12 +151,27 @@ class Page(proto.Message): """ property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + width = proto.Field( + proto.INT32, + number=2, + ) + height = proto.Field( + proto.INT32, + number=3, + ) + blocks = proto.RepeatedField( + proto.MESSAGE, + number=4, + message="Block", + ) + confidence = proto.Field( + proto.FLOAT, + number=5, ) - width = proto.Field(proto.INT32, number=2,) - height = proto.Field(proto.INT32, number=3,) - blocks = proto.RepeatedField(proto.MESSAGE, number=4, message="Block",) - confidence = proto.Field(proto.FLOAT, number=5,) class Block(proto.Message): @@ -182,12 +226,29 @@ class BlockType(proto.Enum): BARCODE = 5 property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + bounding_box = proto.Field( + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + paragraphs = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="Paragraph", + ) + block_type = proto.Field( + proto.ENUM, + number=4, + enum=BlockType, + ) + confidence = proto.Field( + proto.FLOAT, + number=5, ) - bounding_box = proto.Field(proto.MESSAGE, number=2, message=geometry.BoundingPoly,) - paragraphs = proto.RepeatedField(proto.MESSAGE, number=3, message="Paragraph",) - block_type = proto.Field(proto.ENUM, number=4, enum=BlockType,) - confidence = proto.Field(proto.FLOAT, number=5,) class Paragraph(proto.Message): @@ -218,11 +279,24 @@ class Paragraph(proto.Message): """ property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + bounding_box = proto.Field( + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + words = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="Word", + ) + confidence = proto.Field( + proto.FLOAT, + number=4, ) - bounding_box = proto.Field(proto.MESSAGE, number=2, message=geometry.BoundingPoly,) - words = proto.RepeatedField(proto.MESSAGE, number=3, message="Word",) - confidence = proto.Field(proto.FLOAT, number=4,) class Word(proto.Message): @@ -252,11 +326,24 @@ class Word(proto.Message): """ property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + bounding_box = proto.Field( + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + symbols = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="Symbol", + ) + confidence = proto.Field( + proto.FLOAT, + number=4, ) - bounding_box = proto.Field(proto.MESSAGE, number=2, message=geometry.BoundingPoly,) - symbols = proto.RepeatedField(proto.MESSAGE, number=3, message="Symbol",) - confidence = proto.Field(proto.FLOAT, number=4,) class Symbol(proto.Message): @@ -286,11 +373,23 @@ class Symbol(proto.Message): """ property = proto.Field( - proto.MESSAGE, number=1, message="TextAnnotation.TextProperty", + proto.MESSAGE, + number=1, + message="TextAnnotation.TextProperty", + ) + bounding_box = proto.Field( + proto.MESSAGE, + number=2, + message=geometry.BoundingPoly, + ) + text = proto.Field( + proto.STRING, + number=3, + ) + confidence = proto.Field( + proto.FLOAT, + number=4, ) - bounding_box = proto.Field(proto.MESSAGE, number=2, message=geometry.BoundingPoly,) - text = proto.Field(proto.STRING, number=3,) - confidence = proto.Field(proto.FLOAT, number=4,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/cloud/vision_v1p4beta1/types/web_detection.py b/google/cloud/vision_v1p4beta1/types/web_detection.py index 588a4d74..55d0b826 100644 --- a/google/cloud/vision_v1p4beta1/types/web_detection.py +++ b/google/cloud/vision_v1p4beta1/types/web_detection.py @@ -17,7 +17,10 @@ __protobuf__ = proto.module( - package="google.cloud.vision.v1p4beta1", manifest={"WebDetection",}, + package="google.cloud.vision.v1p4beta1", + manifest={ + "WebDetection", + }, ) @@ -63,9 +66,18 @@ class WebEntity(proto.Message): English. """ - entity_id = proto.Field(proto.STRING, number=1,) - score = proto.Field(proto.FLOAT, number=2,) - description = proto.Field(proto.STRING, number=3,) + entity_id = proto.Field( + proto.STRING, + number=1, + ) + score = proto.Field( + proto.FLOAT, + number=2, + ) + description = proto.Field( + proto.STRING, + number=3, + ) class WebImage(proto.Message): r"""Metadata for online images. @@ -78,8 +90,14 @@ class WebImage(proto.Message): image. """ - url = proto.Field(proto.STRING, number=1,) - score = proto.Field(proto.FLOAT, number=2,) + url = proto.Field( + proto.STRING, + number=1, + ) + score = proto.Field( + proto.FLOAT, + number=2, + ) class WebPage(proto.Message): r"""Metadata for web pages. @@ -104,14 +122,27 @@ class WebPage(proto.Message): crops. """ - url = proto.Field(proto.STRING, number=1,) - score = proto.Field(proto.FLOAT, number=2,) - page_title = proto.Field(proto.STRING, number=3,) + url = proto.Field( + proto.STRING, + number=1, + ) + score = proto.Field( + proto.FLOAT, + number=2, + ) + page_title = proto.Field( + proto.STRING, + number=3, + ) full_matching_images = proto.RepeatedField( - proto.MESSAGE, number=4, message="WebDetection.WebImage", + proto.MESSAGE, + number=4, + message="WebDetection.WebImage", ) partial_matching_images = proto.RepeatedField( - proto.MESSAGE, number=5, message="WebDetection.WebImage", + proto.MESSAGE, + number=5, + message="WebDetection.WebImage", ) class WebLabel(proto.Message): @@ -126,23 +157,45 @@ class WebLabel(proto.Message): http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. """ - label = proto.Field(proto.STRING, number=1,) - language_code = proto.Field(proto.STRING, number=2,) + label = proto.Field( + proto.STRING, + number=1, + ) + language_code = proto.Field( + proto.STRING, + number=2, + ) - web_entities = proto.RepeatedField(proto.MESSAGE, number=1, message=WebEntity,) + web_entities = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=WebEntity, + ) full_matching_images = proto.RepeatedField( - proto.MESSAGE, number=2, message=WebImage, + proto.MESSAGE, + number=2, + message=WebImage, ) partial_matching_images = proto.RepeatedField( - proto.MESSAGE, number=3, message=WebImage, + proto.MESSAGE, + number=3, + message=WebImage, ) pages_with_matching_images = proto.RepeatedField( - proto.MESSAGE, number=4, message=WebPage, + proto.MESSAGE, + number=4, + message=WebPage, ) visually_similar_images = proto.RepeatedField( - proto.MESSAGE, number=6, message=WebImage, + proto.MESSAGE, + number=6, + message=WebImage, + ) + best_guess_labels = proto.RepeatedField( + proto.MESSAGE, + number=8, + message=WebLabel, ) - best_guess_labels = proto.RepeatedField(proto.MESSAGE, number=8, message=WebLabel,) __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/noxfile.py b/noxfile.py index 1eddd7b5..3704e152 100644 --- a/noxfile.py +++ b/noxfile.py @@ -20,16 +20,43 @@ import os import pathlib import shutil +import warnings import nox - -BLACK_VERSION = "black==19.10b0" -BLACK_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] +BLACK_VERSION = "black==22.3.0" +ISORT_VERSION = "isort==5.10.1" +LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] DEFAULT_PYTHON_VERSION = "3.8" -SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] + UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9", "3.10"] +UNIT_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "asyncmock", + "pytest", + "pytest-cov", + "pytest-asyncio", +] +UNIT_TEST_EXTERNAL_DEPENDENCIES = [] +UNIT_TEST_LOCAL_DEPENDENCIES = [] +UNIT_TEST_DEPENDENCIES = [] +UNIT_TEST_EXTRAS = [] +UNIT_TEST_EXTRAS_BY_PYTHON = {} + +SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"] +SYSTEM_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "pytest", + "google-cloud-testutils", +] +SYSTEM_TEST_EXTERNAL_DEPENDENCIES = [ + "google-cloud-storage", +] +SYSTEM_TEST_LOCAL_DEPENDENCIES = [] +SYSTEM_TEST_DEPENDENCIES = [] +SYSTEM_TEST_EXTRAS = [] +SYSTEM_TEST_EXTRAS_BY_PYTHON = {} CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute() @@ -57,7 +84,9 @@ def lint(session): """ session.install("flake8", BLACK_VERSION) session.run( - "black", "--check", *BLACK_PATHS, + "black", + "--check", + *LINT_PATHS, ) session.run("flake8", "google", "tests") @@ -67,7 +96,28 @@ def blacken(session): """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) session.run( - "black", *BLACK_PATHS, + "black", + *LINT_PATHS, + ) + + +@nox.session(python=DEFAULT_PYTHON_VERSION) +def format(session): + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run( + "isort", + "--fss", + *LINT_PATHS, + ) + session.run( + "black", + *LINT_PATHS, ) @@ -78,23 +128,41 @@ def lint_setup_py(session): session.run("python", "setup.py", "check", "--restructuredtext", "--strict") +def install_unittest_dependencies(session, *constraints): + standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES + session.install(*standard_deps, *constraints) + + if UNIT_TEST_EXTERNAL_DEPENDENCIES: + warnings.warn( + "'unit_test_external_dependencies' is deprecated. Instead, please " + "use 'unit_test_dependencies' or 'unit_test_local_dependencies'.", + DeprecationWarning, + ) + session.install(*UNIT_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_LOCAL_DEPENDENCIES: + session.install(*UNIT_TEST_LOCAL_DEPENDENCIES, *constraints) + + if UNIT_TEST_EXTRAS_BY_PYTHON: + extras = UNIT_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif UNIT_TEST_EXTRAS: + extras = UNIT_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + def default(session): # Install all test dependencies, then install this package in-place. constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) - session.install( - "mock", - "asyncmock", - "pytest", - "pytest-cov", - "pytest-asyncio", - "-c", - constraints_path, - ) - - session.install("-e", ".", "-c", constraints_path) + install_unittest_dependencies(session, "-c", constraints_path) # Run py.test against the unit tests. session.run( @@ -118,6 +186,35 @@ def unit(session): default(session) +def install_systemtest_dependencies(session, *constraints): + + # Use pre-release gRPC for system tests. + session.install("--pre", "grpcio") + + session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTERNAL_DEPENDENCIES: + session.install(*SYSTEM_TEST_EXTERNAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_LOCAL_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_LOCAL_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_DEPENDENCIES: + session.install("-e", *SYSTEM_TEST_DEPENDENCIES, *constraints) + + if SYSTEM_TEST_EXTRAS_BY_PYTHON: + extras = SYSTEM_TEST_EXTRAS_BY_PYTHON.get(session.python, []) + elif SYSTEM_TEST_EXTRAS: + extras = SYSTEM_TEST_EXTRAS + else: + extras = [] + + if extras: + session.install("-e", f".[{','.join(extras)}]", *constraints) + else: + session.install("-e", ".", *constraints) + + @nox.session(python=SYSTEM_TEST_PYTHON_VERSIONS) def system(session): """Run the system test suite.""" @@ -140,20 +237,7 @@ def system(session): if not system_test_exists and not system_test_folder_exists: session.skip("System tests were not found") - # Use pre-release gRPC for system tests. - session.install("--pre", "grpcio") - - # Install all test dependencies, then install this package into the - # virtualenv's dist-packages. - session.install( - "mock", - "pytest", - "google-cloud-testutils", - "google-cloud-storage", - "-c", - constraints_path, - ) - session.install("-e", ".", "-c", constraints_path) + install_systemtest_dependencies(session, "-c", constraints_path) # Run py.test against the system tests. if system_test_exists: diff --git a/owlbot.py b/owlbot.py index 4912eeb4..cc957c28 100644 --- a/owlbot.py +++ b/owlbot.py @@ -118,6 +118,8 @@ # Work around bug in templates https://github.com/googleapis/synthtool/pull/1335 s.replace(".github/workflows/unittest.yml", "--fail-under=100", "--fail-under=99") +python.configure_previous_major_version_branches() + # ---------------------------------------------------------------------------- # Samples templates # ---------------------------------------------------------------------------- diff --git a/samples/generated_samples/snippet_metadata_vision_v1.json b/samples/generated_samples/snippet_metadata_vision_v1.json index 9470660d..8f729219 100644 --- a/samples/generated_samples/snippet_metadata_vision_v1.json +++ b/samples/generated_samples/snippet_metadata_vision_v1.json @@ -1,16 +1,61 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.vision.v1", + "version": "v1" + } + ], + "language": "PYTHON", + "name": "google-cloud-vision" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1.ImageAnnotatorAsyncClient", + "shortName": "ImageAnnotatorAsyncClient" + }, + "fullName": "google.cloud.vision_v1.ImageAnnotatorAsyncClient.async_batch_annotate_files", "method": { + "fullName": "google.cloud.vision.v1.ImageAnnotator.AsyncBatchAnnotateFiles", "service": { + "fullName": "google.cloud.vision.v1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "AsyncBatchAnnotateFiles" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.AsyncBatchAnnotateFilesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1.types.AsyncAnnotateFileRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "async_batch_annotate_files" }, + "description": "Sample for AsyncBatchAnnotateFiles", "file": "vision_v1_generated_image_annotator_async_batch_annotate_files_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async", "segments": [ { @@ -43,18 +88,54 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_image_annotator_async_batch_annotate_files_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1.ImageAnnotatorClient", + "shortName": "ImageAnnotatorClient" + }, + "fullName": "google.cloud.vision_v1.ImageAnnotatorClient.async_batch_annotate_files", "method": { + "fullName": "google.cloud.vision.v1.ImageAnnotator.AsyncBatchAnnotateFiles", "service": { + "fullName": "google.cloud.vision.v1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "AsyncBatchAnnotateFiles" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.AsyncBatchAnnotateFilesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1.types.AsyncAnnotateFileRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "async_batch_annotate_files" }, + "description": "Sample for AsyncBatchAnnotateFiles", "file": "vision_v1_generated_image_annotator_async_batch_annotate_files_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_sync", "segments": [ { @@ -87,19 +168,59 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_image_annotator_async_batch_annotate_files_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1.ImageAnnotatorAsyncClient", + "shortName": "ImageAnnotatorAsyncClient" + }, + "fullName": "google.cloud.vision_v1.ImageAnnotatorAsyncClient.async_batch_annotate_images", "method": { + "fullName": "google.cloud.vision.v1.ImageAnnotator.AsyncBatchAnnotateImages", "service": { + "fullName": "google.cloud.vision.v1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "AsyncBatchAnnotateImages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.AsyncBatchAnnotateImagesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]" + }, + { + "name": "output_config", + "type": "google.cloud.vision_v1.types.OutputConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "async_batch_annotate_images" }, + "description": "Sample for AsyncBatchAnnotateImages", "file": "vision_v1_generated_image_annotator_async_batch_annotate_images_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ImageAnnotator_AsyncBatchAnnotateImages_async", "segments": [ { @@ -132,18 +253,58 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_image_annotator_async_batch_annotate_images_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1.ImageAnnotatorClient", + "shortName": "ImageAnnotatorClient" + }, + "fullName": "google.cloud.vision_v1.ImageAnnotatorClient.async_batch_annotate_images", "method": { + "fullName": "google.cloud.vision.v1.ImageAnnotator.AsyncBatchAnnotateImages", "service": { + "fullName": "google.cloud.vision.v1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "AsyncBatchAnnotateImages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.AsyncBatchAnnotateImagesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]" + }, + { + "name": "output_config", + "type": "google.cloud.vision_v1.types.OutputConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "async_batch_annotate_images" }, + "description": "Sample for AsyncBatchAnnotateImages", "file": "vision_v1_generated_image_annotator_async_batch_annotate_images_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ImageAnnotator_AsyncBatchAnnotateImages_sync", "segments": [ { @@ -176,19 +337,55 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_image_annotator_async_batch_annotate_images_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1.ImageAnnotatorAsyncClient", + "shortName": "ImageAnnotatorAsyncClient" + }, + "fullName": "google.cloud.vision_v1.ImageAnnotatorAsyncClient.batch_annotate_files", "method": { + "fullName": "google.cloud.vision.v1.ImageAnnotator.BatchAnnotateFiles", "service": { + "fullName": "google.cloud.vision.v1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "BatchAnnotateFiles" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.BatchAnnotateFilesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1.types.AnnotateFileRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.types.BatchAnnotateFilesResponse", + "shortName": "batch_annotate_files" }, + "description": "Sample for BatchAnnotateFiles", "file": "vision_v1_generated_image_annotator_batch_annotate_files_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ImageAnnotator_BatchAnnotateFiles_async", "segments": [ { @@ -221,18 +418,54 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_image_annotator_batch_annotate_files_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1.ImageAnnotatorClient", + "shortName": "ImageAnnotatorClient" + }, + "fullName": "google.cloud.vision_v1.ImageAnnotatorClient.batch_annotate_files", "method": { + "fullName": "google.cloud.vision.v1.ImageAnnotator.BatchAnnotateFiles", "service": { + "fullName": "google.cloud.vision.v1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "BatchAnnotateFiles" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.BatchAnnotateFilesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1.types.AnnotateFileRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.types.BatchAnnotateFilesResponse", + "shortName": "batch_annotate_files" }, + "description": "Sample for BatchAnnotateFiles", "file": "vision_v1_generated_image_annotator_batch_annotate_files_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ImageAnnotator_BatchAnnotateFiles_sync", "segments": [ { @@ -265,19 +498,55 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_image_annotator_batch_annotate_files_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1.ImageAnnotatorAsyncClient", + "shortName": "ImageAnnotatorAsyncClient" + }, + "fullName": "google.cloud.vision_v1.ImageAnnotatorAsyncClient.batch_annotate_images", "method": { + "fullName": "google.cloud.vision.v1.ImageAnnotator.BatchAnnotateImages", "service": { + "fullName": "google.cloud.vision.v1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "BatchAnnotateImages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.BatchAnnotateImagesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.types.BatchAnnotateImagesResponse", + "shortName": "batch_annotate_images" }, + "description": "Sample for BatchAnnotateImages", "file": "vision_v1_generated_image_annotator_batch_annotate_images_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ImageAnnotator_BatchAnnotateImages_async", "segments": [ { @@ -310,18 +579,54 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_image_annotator_batch_annotate_images_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1.ImageAnnotatorClient", + "shortName": "ImageAnnotatorClient" + }, + "fullName": "google.cloud.vision_v1.ImageAnnotatorClient.batch_annotate_images", "method": { + "fullName": "google.cloud.vision.v1.ImageAnnotator.BatchAnnotateImages", "service": { + "fullName": "google.cloud.vision.v1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "BatchAnnotateImages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.BatchAnnotateImagesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1.types.AnnotateImageRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.types.BatchAnnotateImagesResponse", + "shortName": "batch_annotate_images" }, + "description": "Sample for BatchAnnotateImages", "file": "vision_v1_generated_image_annotator_batch_annotate_images_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ImageAnnotator_BatchAnnotateImages_sync", "segments": [ { @@ -354,19 +659,58 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_image_annotator_batch_annotate_images_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient.add_product_to_product_set", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.AddProductToProductSet", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "AddProductToProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.AddProductToProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "product", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "add_product_to_product_set" }, + "description": "Sample for AddProductToProductSet", "file": "vision_v1_generated_product_search_add_product_to_product_set_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_AddProductToProductSet_async", "segments": [ { @@ -397,18 +741,57 @@ "end": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_add_product_to_product_set_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchClient.add_product_to_product_set", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.AddProductToProductSet", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "AddProductToProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.AddProductToProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "product", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "add_product_to_product_set" }, + "description": "Sample for AddProductToProductSet", "file": "vision_v1_generated_product_search_add_product_to_product_set_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_AddProductToProductSet_sync", "segments": [ { @@ -439,19 +822,63 @@ "end": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_add_product_to_product_set_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient.create_product_set", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.CreateProductSet", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "CreateProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.CreateProductSetRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "product_set", + "type": "google.cloud.vision_v1.types.ProductSet" + }, + { + "name": "product_set_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.types.ProductSet", + "shortName": "create_product_set" }, + "description": "Sample for CreateProductSet", "file": "vision_v1_generated_product_search_create_product_set_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_CreateProductSet_async", "segments": [ { @@ -484,18 +911,62 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_create_product_set_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchClient.create_product_set", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.CreateProductSet", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "CreateProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.CreateProductSetRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "product_set", + "type": "google.cloud.vision_v1.types.ProductSet" + }, + { + "name": "product_set_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.types.ProductSet", + "shortName": "create_product_set" }, + "description": "Sample for CreateProductSet", "file": "vision_v1_generated_product_search_create_product_set_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_CreateProductSet_sync", "segments": [ { @@ -528,19 +999,63 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_create_product_set_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient.create_product", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.CreateProduct", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "CreateProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.CreateProductRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "product", + "type": "google.cloud.vision_v1.types.Product" + }, + { + "name": "product_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.types.Product", + "shortName": "create_product" }, + "description": "Sample for CreateProduct", "file": "vision_v1_generated_product_search_create_product_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_CreateProduct_async", "segments": [ { @@ -573,18 +1088,62 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_create_product_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchClient.create_product", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.CreateProduct", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "CreateProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.CreateProductRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "product", + "type": "google.cloud.vision_v1.types.Product" + }, + { + "name": "product_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.types.Product", + "shortName": "create_product" }, + "description": "Sample for CreateProduct", "file": "vision_v1_generated_product_search_create_product_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_CreateProduct_sync", "segments": [ { @@ -617,19 +1176,63 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_create_product_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient.create_reference_image", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.CreateReferenceImage", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "CreateReferenceImage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.CreateReferenceImageRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "reference_image", + "type": "google.cloud.vision_v1.types.ReferenceImage" + }, + { + "name": "reference_image_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.types.ReferenceImage", + "shortName": "create_reference_image" }, + "description": "Sample for CreateReferenceImage", "file": "vision_v1_generated_product_search_create_reference_image_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_CreateReferenceImage_async", "segments": [ { @@ -662,18 +1265,62 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_create_reference_image_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchClient.create_reference_image", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.CreateReferenceImage", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "CreateReferenceImage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.CreateReferenceImageRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "reference_image", + "type": "google.cloud.vision_v1.types.ReferenceImage" + }, + { + "name": "reference_image_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.types.ReferenceImage", + "shortName": "create_reference_image" }, + "description": "Sample for CreateReferenceImage", "file": "vision_v1_generated_product_search_create_reference_image_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_CreateReferenceImage_sync", "segments": [ { @@ -706,19 +1353,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_create_reference_image_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient.delete_product_set", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.DeleteProductSet", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "DeleteProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.DeleteProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_product_set" }, + "description": "Sample for DeleteProductSet", "file": "vision_v1_generated_product_search_delete_product_set_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_DeleteProductSet_async", "segments": [ { @@ -749,18 +1431,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_delete_product_set_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchClient.delete_product_set", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.DeleteProductSet", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "DeleteProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.DeleteProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_product_set" }, + "description": "Sample for DeleteProductSet", "file": "vision_v1_generated_product_search_delete_product_set_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_DeleteProductSet_sync", "segments": [ { @@ -791,19 +1508,54 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_delete_product_set_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient.delete_product", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.DeleteProduct", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "DeleteProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.DeleteProductRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_product" }, + "description": "Sample for DeleteProduct", "file": "vision_v1_generated_product_search_delete_product_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_DeleteProduct_async", "segments": [ { @@ -834,18 +1586,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_delete_product_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchClient.delete_product", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.DeleteProduct", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "DeleteProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.DeleteProductRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_product" }, + "description": "Sample for DeleteProduct", "file": "vision_v1_generated_product_search_delete_product_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_DeleteProduct_sync", "segments": [ { @@ -876,19 +1663,54 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_delete_product_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient.delete_reference_image", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.DeleteReferenceImage", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "DeleteReferenceImage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.DeleteReferenceImageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_reference_image" }, + "description": "Sample for DeleteReferenceImage", "file": "vision_v1_generated_product_search_delete_reference_image_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_DeleteReferenceImage_async", "segments": [ { @@ -919,18 +1741,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_delete_reference_image_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchClient.delete_reference_image", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.DeleteReferenceImage", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "DeleteReferenceImage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.DeleteReferenceImageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_reference_image" }, + "description": "Sample for DeleteReferenceImage", "file": "vision_v1_generated_product_search_delete_reference_image_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_DeleteReferenceImage_sync", "segments": [ { @@ -961,19 +1818,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_delete_reference_image_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient.get_product_set", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.GetProductSet", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "GetProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.GetProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.types.ProductSet", + "shortName": "get_product_set" }, + "description": "Sample for GetProductSet", "file": "vision_v1_generated_product_search_get_product_set_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_GetProductSet_async", "segments": [ { @@ -1006,18 +1899,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_get_product_set_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchClient.get_product_set", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.GetProductSet", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "GetProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.GetProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.types.ProductSet", + "shortName": "get_product_set" }, + "description": "Sample for GetProductSet", "file": "vision_v1_generated_product_search_get_product_set_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_GetProductSet_sync", "segments": [ { @@ -1050,19 +1979,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_get_product_set_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient.get_product", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.GetProduct", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "GetProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.GetProductRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.types.Product", + "shortName": "get_product" }, + "description": "Sample for GetProduct", "file": "vision_v1_generated_product_search_get_product_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_GetProduct_async", "segments": [ { @@ -1095,18 +2060,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_get_product_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchClient.get_product", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.GetProduct", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "GetProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.GetProductRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.types.Product", + "shortName": "get_product" }, + "description": "Sample for GetProduct", "file": "vision_v1_generated_product_search_get_product_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_GetProduct_sync", "segments": [ { @@ -1139,19 +2140,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_get_product_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient.get_reference_image", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.GetReferenceImage", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "GetReferenceImage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.GetReferenceImageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.types.ReferenceImage", + "shortName": "get_reference_image" }, + "description": "Sample for GetReferenceImage", "file": "vision_v1_generated_product_search_get_reference_image_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_GetReferenceImage_async", "segments": [ { @@ -1184,18 +2221,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_get_reference_image_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchClient.get_reference_image", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.GetReferenceImage", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "GetReferenceImage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.GetReferenceImageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.types.ReferenceImage", + "shortName": "get_reference_image" }, + "description": "Sample for GetReferenceImage", "file": "vision_v1_generated_product_search_get_reference_image_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_GetReferenceImage_sync", "segments": [ { @@ -1228,19 +2301,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_get_reference_image_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient.import_product_sets", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.ImportProductSets", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ImportProductSets" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.ImportProductSetsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "input_config", + "type": "google.cloud.vision_v1.types.ImportProductSetsInputConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "import_product_sets" }, + "description": "Sample for ImportProductSets", "file": "vision_v1_generated_product_search_import_product_sets_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_ImportProductSets_async", "segments": [ { @@ -1273,18 +2386,58 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_import_product_sets_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchClient.import_product_sets", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.ImportProductSets", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ImportProductSets" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.ImportProductSetsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "input_config", + "type": "google.cloud.vision_v1.types.ImportProductSetsInputConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "import_product_sets" }, + "description": "Sample for ImportProductSets", "file": "vision_v1_generated_product_search_import_product_sets_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_ImportProductSets_sync", "segments": [ { @@ -1317,19 +2470,55 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_import_product_sets_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient.list_product_sets", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.ListProductSets", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListProductSets" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.ListProductSetsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.services.product_search.pagers.ListProductSetsAsyncPager", + "shortName": "list_product_sets" }, + "description": "Sample for ListProductSets", "file": "vision_v1_generated_product_search_list_product_sets_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_ListProductSets_async", "segments": [ { @@ -1362,18 +2551,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_list_product_sets_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchClient.list_product_sets", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.ListProductSets", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListProductSets" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.ListProductSetsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.services.product_search.pagers.ListProductSetsPager", + "shortName": "list_product_sets" }, + "description": "Sample for ListProductSets", "file": "vision_v1_generated_product_search_list_product_sets_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_ListProductSets_sync", "segments": [ { @@ -1406,19 +2631,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_list_product_sets_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient.list_products_in_product_set", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.ListProductsInProductSet", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListProductsInProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.ListProductsInProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.services.product_search.pagers.ListProductsInProductSetAsyncPager", + "shortName": "list_products_in_product_set" }, + "description": "Sample for ListProductsInProductSet", "file": "vision_v1_generated_product_search_list_products_in_product_set_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_ListProductsInProductSet_async", "segments": [ { @@ -1451,18 +2712,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_list_products_in_product_set_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchClient.list_products_in_product_set", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.ListProductsInProductSet", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListProductsInProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.ListProductsInProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.services.product_search.pagers.ListProductsInProductSetPager", + "shortName": "list_products_in_product_set" }, + "description": "Sample for ListProductsInProductSet", "file": "vision_v1_generated_product_search_list_products_in_product_set_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_ListProductsInProductSet_sync", "segments": [ { @@ -1495,19 +2792,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_list_products_in_product_set_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient.list_products", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.ListProducts", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListProducts" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.ListProductsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.services.product_search.pagers.ListProductsAsyncPager", + "shortName": "list_products" }, + "description": "Sample for ListProducts", "file": "vision_v1_generated_product_search_list_products_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_ListProducts_async", "segments": [ { @@ -1540,18 +2873,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_list_products_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchClient.list_products", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.ListProducts", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListProducts" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.ListProductsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.services.product_search.pagers.ListProductsPager", + "shortName": "list_products" }, + "description": "Sample for ListProducts", "file": "vision_v1_generated_product_search_list_products_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_ListProducts_sync", "segments": [ { @@ -1584,19 +2953,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_list_products_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient.list_reference_images", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.ListReferenceImages", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListReferenceImages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.ListReferenceImagesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.services.product_search.pagers.ListReferenceImagesAsyncPager", + "shortName": "list_reference_images" }, + "description": "Sample for ListReferenceImages", "file": "vision_v1_generated_product_search_list_reference_images_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_ListReferenceImages_async", "segments": [ { @@ -1629,18 +3034,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_list_reference_images_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchClient.list_reference_images", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.ListReferenceImages", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListReferenceImages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.ListReferenceImagesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.services.product_search.pagers.ListReferenceImagesPager", + "shortName": "list_reference_images" }, + "description": "Sample for ListReferenceImages", "file": "vision_v1_generated_product_search_list_reference_images_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_ListReferenceImages_sync", "segments": [ { @@ -1673,19 +3114,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_list_reference_images_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient.purge_products", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.PurgeProducts", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "PurgeProducts" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.PurgeProductsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "purge_products" }, + "description": "Sample for PurgeProducts", "file": "vision_v1_generated_product_search_purge_products_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_PurgeProducts_async", "segments": [ { @@ -1718,18 +3195,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_purge_products_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchClient.purge_products", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.PurgeProducts", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "PurgeProducts" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.PurgeProductsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "purge_products" }, + "description": "Sample for PurgeProducts", "file": "vision_v1_generated_product_search_purge_products_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_PurgeProducts_sync", "segments": [ { @@ -1762,19 +3275,58 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_purge_products_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient.remove_product_from_product_set", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.RemoveProductFromProductSet", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "RemoveProductFromProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.RemoveProductFromProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "product", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "remove_product_from_product_set" }, + "description": "Sample for RemoveProductFromProductSet", "file": "vision_v1_generated_product_search_remove_product_from_product_set_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_RemoveProductFromProductSet_async", "segments": [ { @@ -1805,18 +3357,57 @@ "end": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_remove_product_from_product_set_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchClient.remove_product_from_product_set", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.RemoveProductFromProductSet", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "RemoveProductFromProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.RemoveProductFromProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "product", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "remove_product_from_product_set" }, + "description": "Sample for RemoveProductFromProductSet", "file": "vision_v1_generated_product_search_remove_product_from_product_set_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_RemoveProductFromProductSet_sync", "segments": [ { @@ -1847,19 +3438,59 @@ "end": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_remove_product_from_product_set_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient.update_product_set", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.UpdateProductSet", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "UpdateProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.UpdateProductSetRequest" + }, + { + "name": "product_set", + "type": "google.cloud.vision_v1.types.ProductSet" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.types.ProductSet", + "shortName": "update_product_set" }, + "description": "Sample for UpdateProductSet", "file": "vision_v1_generated_product_search_update_product_set_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_UpdateProductSet_async", "segments": [ { @@ -1892,18 +3523,58 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_update_product_set_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchClient.update_product_set", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.UpdateProductSet", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "UpdateProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.UpdateProductSetRequest" + }, + { + "name": "product_set", + "type": "google.cloud.vision_v1.types.ProductSet" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.types.ProductSet", + "shortName": "update_product_set" }, + "description": "Sample for UpdateProductSet", "file": "vision_v1_generated_product_search_update_product_set_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_UpdateProductSet_sync", "segments": [ { @@ -1936,19 +3607,59 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_update_product_set_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchAsyncClient.update_product", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.UpdateProduct", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "UpdateProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.UpdateProductRequest" + }, + { + "name": "product", + "type": "google.cloud.vision_v1.types.Product" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.types.Product", + "shortName": "update_product" }, + "description": "Sample for UpdateProduct", "file": "vision_v1_generated_product_search_update_product_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_UpdateProduct_async", "segments": [ { @@ -1981,18 +3692,58 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_update_product_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1.ProductSearchClient.update_product", "method": { + "fullName": "google.cloud.vision.v1.ProductSearch.UpdateProduct", "service": { + "fullName": "google.cloud.vision.v1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "UpdateProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1.types.UpdateProductRequest" + }, + { + "name": "product", + "type": "google.cloud.vision_v1.types.Product" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1.types.Product", + "shortName": "update_product" }, + "description": "Sample for UpdateProduct", "file": "vision_v1_generated_product_search_update_product_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1_generated_ProductSearch_UpdateProduct_sync", "segments": [ { @@ -2025,7 +3776,8 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1_generated_product_search_update_product_sync.py" } ] } diff --git a/samples/generated_samples/snippet_metadata_vision_v1p1beta1.json b/samples/generated_samples/snippet_metadata_vision_v1p1beta1.json index d588d510..5cc6ba51 100644 --- a/samples/generated_samples/snippet_metadata_vision_v1p1beta1.json +++ b/samples/generated_samples/snippet_metadata_vision_v1p1beta1.json @@ -1,16 +1,61 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.vision.v1p1beta1", + "version": "v1p1beta1" + } + ], + "language": "PYTHON", + "name": "google-cloud-vision" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p1beta1.ImageAnnotatorAsyncClient", + "shortName": "ImageAnnotatorAsyncClient" + }, + "fullName": "google.cloud.vision_v1p1beta1.ImageAnnotatorAsyncClient.batch_annotate_images", "method": { + "fullName": "google.cloud.vision.v1p1beta1.ImageAnnotator.BatchAnnotateImages", "service": { + "fullName": "google.cloud.vision.v1p1beta1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "BatchAnnotateImages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p1beta1.types.BatchAnnotateImagesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1p1beta1.types.AnnotateImageRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p1beta1.types.BatchAnnotateImagesResponse", + "shortName": "batch_annotate_images" }, + "description": "Sample for BatchAnnotateImages", "file": "vision_v1p1beta1_generated_image_annotator_batch_annotate_images_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p1beta1_generated_ImageAnnotator_BatchAnnotateImages_async", "segments": [ { @@ -43,18 +88,54 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p1beta1_generated_image_annotator_batch_annotate_images_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p1beta1.ImageAnnotatorClient", + "shortName": "ImageAnnotatorClient" + }, + "fullName": "google.cloud.vision_v1p1beta1.ImageAnnotatorClient.batch_annotate_images", "method": { + "fullName": "google.cloud.vision.v1p1beta1.ImageAnnotator.BatchAnnotateImages", "service": { + "fullName": "google.cloud.vision.v1p1beta1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "BatchAnnotateImages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p1beta1.types.BatchAnnotateImagesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1p1beta1.types.AnnotateImageRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p1beta1.types.BatchAnnotateImagesResponse", + "shortName": "batch_annotate_images" }, + "description": "Sample for BatchAnnotateImages", "file": "vision_v1p1beta1_generated_image_annotator_batch_annotate_images_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p1beta1_generated_ImageAnnotator_BatchAnnotateImages_sync", "segments": [ { @@ -87,7 +168,8 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p1beta1_generated_image_annotator_batch_annotate_images_sync.py" } ] } diff --git a/samples/generated_samples/snippet_metadata_vision_v1p2beta1.json b/samples/generated_samples/snippet_metadata_vision_v1p2beta1.json index 80d069b0..4192445b 100644 --- a/samples/generated_samples/snippet_metadata_vision_v1p2beta1.json +++ b/samples/generated_samples/snippet_metadata_vision_v1p2beta1.json @@ -1,16 +1,61 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.vision.v1p2beta1", + "version": "v1p2beta1" + } + ], + "language": "PYTHON", + "name": "google-cloud-vision" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p2beta1.ImageAnnotatorAsyncClient", + "shortName": "ImageAnnotatorAsyncClient" + }, + "fullName": "google.cloud.vision_v1p2beta1.ImageAnnotatorAsyncClient.async_batch_annotate_files", "method": { + "fullName": "google.cloud.vision.v1p2beta1.ImageAnnotator.AsyncBatchAnnotateFiles", "service": { + "fullName": "google.cloud.vision.v1p2beta1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "AsyncBatchAnnotateFiles" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p2beta1.types.AsyncBatchAnnotateFilesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1p2beta1.types.AsyncAnnotateFileRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "async_batch_annotate_files" }, + "description": "Sample for AsyncBatchAnnotateFiles", "file": "vision_v1p2beta1_generated_image_annotator_async_batch_annotate_files_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p2beta1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async", "segments": [ { @@ -43,18 +88,54 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p2beta1_generated_image_annotator_async_batch_annotate_files_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p2beta1.ImageAnnotatorClient", + "shortName": "ImageAnnotatorClient" + }, + "fullName": "google.cloud.vision_v1p2beta1.ImageAnnotatorClient.async_batch_annotate_files", "method": { + "fullName": "google.cloud.vision.v1p2beta1.ImageAnnotator.AsyncBatchAnnotateFiles", "service": { + "fullName": "google.cloud.vision.v1p2beta1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "AsyncBatchAnnotateFiles" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p2beta1.types.AsyncBatchAnnotateFilesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1p2beta1.types.AsyncAnnotateFileRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "async_batch_annotate_files" }, + "description": "Sample for AsyncBatchAnnotateFiles", "file": "vision_v1p2beta1_generated_image_annotator_async_batch_annotate_files_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p2beta1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_sync", "segments": [ { @@ -87,19 +168,55 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p2beta1_generated_image_annotator_async_batch_annotate_files_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p2beta1.ImageAnnotatorAsyncClient", + "shortName": "ImageAnnotatorAsyncClient" + }, + "fullName": "google.cloud.vision_v1p2beta1.ImageAnnotatorAsyncClient.batch_annotate_images", "method": { + "fullName": "google.cloud.vision.v1p2beta1.ImageAnnotator.BatchAnnotateImages", "service": { + "fullName": "google.cloud.vision.v1p2beta1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "BatchAnnotateImages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p2beta1.types.BatchAnnotateImagesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1p2beta1.types.AnnotateImageRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p2beta1.types.BatchAnnotateImagesResponse", + "shortName": "batch_annotate_images" }, + "description": "Sample for BatchAnnotateImages", "file": "vision_v1p2beta1_generated_image_annotator_batch_annotate_images_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p2beta1_generated_ImageAnnotator_BatchAnnotateImages_async", "segments": [ { @@ -132,18 +249,54 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p2beta1_generated_image_annotator_batch_annotate_images_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p2beta1.ImageAnnotatorClient", + "shortName": "ImageAnnotatorClient" + }, + "fullName": "google.cloud.vision_v1p2beta1.ImageAnnotatorClient.batch_annotate_images", "method": { + "fullName": "google.cloud.vision.v1p2beta1.ImageAnnotator.BatchAnnotateImages", "service": { + "fullName": "google.cloud.vision.v1p2beta1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "BatchAnnotateImages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p2beta1.types.BatchAnnotateImagesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1p2beta1.types.AnnotateImageRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p2beta1.types.BatchAnnotateImagesResponse", + "shortName": "batch_annotate_images" }, + "description": "Sample for BatchAnnotateImages", "file": "vision_v1p2beta1_generated_image_annotator_batch_annotate_images_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p2beta1_generated_ImageAnnotator_BatchAnnotateImages_sync", "segments": [ { @@ -176,7 +329,8 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p2beta1_generated_image_annotator_batch_annotate_images_sync.py" } ] } diff --git a/samples/generated_samples/snippet_metadata_vision_v1p3beta1.json b/samples/generated_samples/snippet_metadata_vision_v1p3beta1.json index 9cdb395b..71ead40c 100644 --- a/samples/generated_samples/snippet_metadata_vision_v1p3beta1.json +++ b/samples/generated_samples/snippet_metadata_vision_v1p3beta1.json @@ -1,16 +1,61 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.vision.v1p3beta1", + "version": "v1p3beta1" + } + ], + "language": "PYTHON", + "name": "google-cloud-vision" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ImageAnnotatorAsyncClient", + "shortName": "ImageAnnotatorAsyncClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ImageAnnotatorAsyncClient.async_batch_annotate_files", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ImageAnnotator.AsyncBatchAnnotateFiles", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "AsyncBatchAnnotateFiles" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.AsyncBatchAnnotateFilesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1p3beta1.types.AsyncAnnotateFileRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "async_batch_annotate_files" }, + "description": "Sample for AsyncBatchAnnotateFiles", "file": "vision_v1p3beta1_generated_image_annotator_async_batch_annotate_files_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async", "segments": [ { @@ -43,18 +88,54 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_image_annotator_async_batch_annotate_files_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ImageAnnotatorClient", + "shortName": "ImageAnnotatorClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ImageAnnotatorClient.async_batch_annotate_files", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ImageAnnotator.AsyncBatchAnnotateFiles", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "AsyncBatchAnnotateFiles" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.AsyncBatchAnnotateFilesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1p3beta1.types.AsyncAnnotateFileRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "async_batch_annotate_files" }, + "description": "Sample for AsyncBatchAnnotateFiles", "file": "vision_v1p3beta1_generated_image_annotator_async_batch_annotate_files_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_sync", "segments": [ { @@ -87,19 +168,55 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_image_annotator_async_batch_annotate_files_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ImageAnnotatorAsyncClient", + "shortName": "ImageAnnotatorAsyncClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ImageAnnotatorAsyncClient.batch_annotate_images", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ImageAnnotator.BatchAnnotateImages", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "BatchAnnotateImages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.BatchAnnotateImagesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1p3beta1.types.AnnotateImageRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.types.BatchAnnotateImagesResponse", + "shortName": "batch_annotate_images" }, + "description": "Sample for BatchAnnotateImages", "file": "vision_v1p3beta1_generated_image_annotator_batch_annotate_images_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ImageAnnotator_BatchAnnotateImages_async", "segments": [ { @@ -132,18 +249,54 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_image_annotator_batch_annotate_images_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ImageAnnotatorClient", + "shortName": "ImageAnnotatorClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ImageAnnotatorClient.batch_annotate_images", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ImageAnnotator.BatchAnnotateImages", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "BatchAnnotateImages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.BatchAnnotateImagesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1p3beta1.types.AnnotateImageRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.types.BatchAnnotateImagesResponse", + "shortName": "batch_annotate_images" }, + "description": "Sample for BatchAnnotateImages", "file": "vision_v1p3beta1_generated_image_annotator_batch_annotate_images_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ImageAnnotator_BatchAnnotateImages_sync", "segments": [ { @@ -176,19 +329,58 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_image_annotator_batch_annotate_images_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient.add_product_to_product_set", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.AddProductToProductSet", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "AddProductToProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.AddProductToProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "product", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "add_product_to_product_set" }, + "description": "Sample for AddProductToProductSet", "file": "vision_v1p3beta1_generated_product_search_add_product_to_product_set_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_AddProductToProductSet_async", "segments": [ { @@ -219,18 +411,57 @@ "end": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_add_product_to_product_set_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient.add_product_to_product_set", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.AddProductToProductSet", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "AddProductToProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.AddProductToProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "product", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "add_product_to_product_set" }, + "description": "Sample for AddProductToProductSet", "file": "vision_v1p3beta1_generated_product_search_add_product_to_product_set_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_AddProductToProductSet_sync", "segments": [ { @@ -261,19 +492,63 @@ "end": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_add_product_to_product_set_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient.create_product_set", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.CreateProductSet", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "CreateProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.CreateProductSetRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "product_set", + "type": "google.cloud.vision_v1p3beta1.types.ProductSet" + }, + { + "name": "product_set_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.types.ProductSet", + "shortName": "create_product_set" }, + "description": "Sample for CreateProductSet", "file": "vision_v1p3beta1_generated_product_search_create_product_set_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_CreateProductSet_async", "segments": [ { @@ -306,18 +581,62 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_create_product_set_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient.create_product_set", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.CreateProductSet", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "CreateProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.CreateProductSetRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "product_set", + "type": "google.cloud.vision_v1p3beta1.types.ProductSet" + }, + { + "name": "product_set_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.types.ProductSet", + "shortName": "create_product_set" }, + "description": "Sample for CreateProductSet", "file": "vision_v1p3beta1_generated_product_search_create_product_set_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_CreateProductSet_sync", "segments": [ { @@ -350,19 +669,63 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_create_product_set_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient.create_product", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.CreateProduct", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "CreateProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.CreateProductRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "product", + "type": "google.cloud.vision_v1p3beta1.types.Product" + }, + { + "name": "product_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.types.Product", + "shortName": "create_product" }, + "description": "Sample for CreateProduct", "file": "vision_v1p3beta1_generated_product_search_create_product_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_CreateProduct_async", "segments": [ { @@ -395,18 +758,62 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_create_product_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient.create_product", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.CreateProduct", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "CreateProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.CreateProductRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "product", + "type": "google.cloud.vision_v1p3beta1.types.Product" + }, + { + "name": "product_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.types.Product", + "shortName": "create_product" }, + "description": "Sample for CreateProduct", "file": "vision_v1p3beta1_generated_product_search_create_product_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_CreateProduct_sync", "segments": [ { @@ -439,19 +846,63 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_create_product_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient.create_reference_image", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.CreateReferenceImage", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "CreateReferenceImage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.CreateReferenceImageRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "reference_image", + "type": "google.cloud.vision_v1p3beta1.types.ReferenceImage" + }, + { + "name": "reference_image_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.types.ReferenceImage", + "shortName": "create_reference_image" }, + "description": "Sample for CreateReferenceImage", "file": "vision_v1p3beta1_generated_product_search_create_reference_image_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_CreateReferenceImage_async", "segments": [ { @@ -484,18 +935,62 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_create_reference_image_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient.create_reference_image", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.CreateReferenceImage", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "CreateReferenceImage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.CreateReferenceImageRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "reference_image", + "type": "google.cloud.vision_v1p3beta1.types.ReferenceImage" + }, + { + "name": "reference_image_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.types.ReferenceImage", + "shortName": "create_reference_image" }, + "description": "Sample for CreateReferenceImage", "file": "vision_v1p3beta1_generated_product_search_create_reference_image_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_CreateReferenceImage_sync", "segments": [ { @@ -528,19 +1023,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_create_reference_image_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient.delete_product_set", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.DeleteProductSet", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "DeleteProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.DeleteProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_product_set" }, + "description": "Sample for DeleteProductSet", "file": "vision_v1p3beta1_generated_product_search_delete_product_set_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_DeleteProductSet_async", "segments": [ { @@ -571,18 +1101,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_delete_product_set_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient.delete_product_set", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.DeleteProductSet", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "DeleteProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.DeleteProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_product_set" }, + "description": "Sample for DeleteProductSet", "file": "vision_v1p3beta1_generated_product_search_delete_product_set_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_DeleteProductSet_sync", "segments": [ { @@ -613,19 +1178,54 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_delete_product_set_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient.delete_product", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.DeleteProduct", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "DeleteProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.DeleteProductRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_product" }, + "description": "Sample for DeleteProduct", "file": "vision_v1p3beta1_generated_product_search_delete_product_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_DeleteProduct_async", "segments": [ { @@ -656,18 +1256,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_delete_product_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient.delete_product", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.DeleteProduct", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "DeleteProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.DeleteProductRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_product" }, + "description": "Sample for DeleteProduct", "file": "vision_v1p3beta1_generated_product_search_delete_product_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_DeleteProduct_sync", "segments": [ { @@ -698,19 +1333,54 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_delete_product_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient.delete_reference_image", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.DeleteReferenceImage", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "DeleteReferenceImage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.DeleteReferenceImageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_reference_image" }, + "description": "Sample for DeleteReferenceImage", "file": "vision_v1p3beta1_generated_product_search_delete_reference_image_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_DeleteReferenceImage_async", "segments": [ { @@ -741,18 +1411,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_delete_reference_image_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient.delete_reference_image", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.DeleteReferenceImage", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "DeleteReferenceImage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.DeleteReferenceImageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_reference_image" }, + "description": "Sample for DeleteReferenceImage", "file": "vision_v1p3beta1_generated_product_search_delete_reference_image_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_DeleteReferenceImage_sync", "segments": [ { @@ -783,19 +1488,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_delete_reference_image_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient.get_product_set", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.GetProductSet", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "GetProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.GetProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.types.ProductSet", + "shortName": "get_product_set" }, + "description": "Sample for GetProductSet", "file": "vision_v1p3beta1_generated_product_search_get_product_set_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_GetProductSet_async", "segments": [ { @@ -828,18 +1569,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_get_product_set_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient.get_product_set", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.GetProductSet", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "GetProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.GetProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.types.ProductSet", + "shortName": "get_product_set" }, + "description": "Sample for GetProductSet", "file": "vision_v1p3beta1_generated_product_search_get_product_set_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_GetProductSet_sync", "segments": [ { @@ -872,19 +1649,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_get_product_set_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient.get_product", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.GetProduct", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "GetProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.GetProductRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.types.Product", + "shortName": "get_product" }, + "description": "Sample for GetProduct", "file": "vision_v1p3beta1_generated_product_search_get_product_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_GetProduct_async", "segments": [ { @@ -917,18 +1730,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_get_product_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient.get_product", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.GetProduct", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "GetProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.GetProductRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.types.Product", + "shortName": "get_product" }, + "description": "Sample for GetProduct", "file": "vision_v1p3beta1_generated_product_search_get_product_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_GetProduct_sync", "segments": [ { @@ -961,19 +1810,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_get_product_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient.get_reference_image", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.GetReferenceImage", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "GetReferenceImage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.GetReferenceImageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.types.ReferenceImage", + "shortName": "get_reference_image" }, + "description": "Sample for GetReferenceImage", "file": "vision_v1p3beta1_generated_product_search_get_reference_image_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_GetReferenceImage_async", "segments": [ { @@ -1006,18 +1891,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_get_reference_image_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient.get_reference_image", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.GetReferenceImage", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "GetReferenceImage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.GetReferenceImageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.types.ReferenceImage", + "shortName": "get_reference_image" }, + "description": "Sample for GetReferenceImage", "file": "vision_v1p3beta1_generated_product_search_get_reference_image_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_GetReferenceImage_sync", "segments": [ { @@ -1050,19 +1971,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_get_reference_image_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient.import_product_sets", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.ImportProductSets", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ImportProductSets" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.ImportProductSetsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "input_config", + "type": "google.cloud.vision_v1p3beta1.types.ImportProductSetsInputConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "import_product_sets" }, + "description": "Sample for ImportProductSets", "file": "vision_v1p3beta1_generated_product_search_import_product_sets_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_ImportProductSets_async", "segments": [ { @@ -1095,18 +2056,58 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_import_product_sets_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient.import_product_sets", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.ImportProductSets", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ImportProductSets" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.ImportProductSetsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "input_config", + "type": "google.cloud.vision_v1p3beta1.types.ImportProductSetsInputConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "import_product_sets" }, + "description": "Sample for ImportProductSets", "file": "vision_v1p3beta1_generated_product_search_import_product_sets_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_ImportProductSets_sync", "segments": [ { @@ -1139,19 +2140,55 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_import_product_sets_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient.list_product_sets", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.ListProductSets", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListProductSets" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.ListProductSetsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductSetsAsyncPager", + "shortName": "list_product_sets" }, + "description": "Sample for ListProductSets", "file": "vision_v1p3beta1_generated_product_search_list_product_sets_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_ListProductSets_async", "segments": [ { @@ -1184,18 +2221,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_list_product_sets_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient.list_product_sets", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.ListProductSets", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListProductSets" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.ListProductSetsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductSetsPager", + "shortName": "list_product_sets" }, + "description": "Sample for ListProductSets", "file": "vision_v1p3beta1_generated_product_search_list_product_sets_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_ListProductSets_sync", "segments": [ { @@ -1228,19 +2301,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_list_product_sets_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient.list_products_in_product_set", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.ListProductsInProductSet", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListProductsInProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.ListProductsInProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductsInProductSetAsyncPager", + "shortName": "list_products_in_product_set" }, + "description": "Sample for ListProductsInProductSet", "file": "vision_v1p3beta1_generated_product_search_list_products_in_product_set_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_ListProductsInProductSet_async", "segments": [ { @@ -1273,18 +2382,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_list_products_in_product_set_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient.list_products_in_product_set", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.ListProductsInProductSet", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListProductsInProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.ListProductsInProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductsInProductSetPager", + "shortName": "list_products_in_product_set" }, + "description": "Sample for ListProductsInProductSet", "file": "vision_v1p3beta1_generated_product_search_list_products_in_product_set_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_ListProductsInProductSet_sync", "segments": [ { @@ -1317,19 +2462,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_list_products_in_product_set_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient.list_products", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.ListProducts", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListProducts" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.ListProductsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductsAsyncPager", + "shortName": "list_products" }, + "description": "Sample for ListProducts", "file": "vision_v1p3beta1_generated_product_search_list_products_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_ListProducts_async", "segments": [ { @@ -1362,18 +2543,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_list_products_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient.list_products", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.ListProducts", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListProducts" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.ListProductsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductsPager", + "shortName": "list_products" }, + "description": "Sample for ListProducts", "file": "vision_v1p3beta1_generated_product_search_list_products_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_ListProducts_sync", "segments": [ { @@ -1406,19 +2623,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_list_products_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient.list_reference_images", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.ListReferenceImages", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListReferenceImages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.ListReferenceImagesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.services.product_search.pagers.ListReferenceImagesAsyncPager", + "shortName": "list_reference_images" }, + "description": "Sample for ListReferenceImages", "file": "vision_v1p3beta1_generated_product_search_list_reference_images_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_ListReferenceImages_async", "segments": [ { @@ -1451,18 +2704,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_list_reference_images_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient.list_reference_images", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.ListReferenceImages", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListReferenceImages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.ListReferenceImagesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.services.product_search.pagers.ListReferenceImagesPager", + "shortName": "list_reference_images" }, + "description": "Sample for ListReferenceImages", "file": "vision_v1p3beta1_generated_product_search_list_reference_images_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_ListReferenceImages_sync", "segments": [ { @@ -1495,19 +2784,58 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_list_reference_images_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient.remove_product_from_product_set", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.RemoveProductFromProductSet", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "RemoveProductFromProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.RemoveProductFromProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "product", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "remove_product_from_product_set" }, + "description": "Sample for RemoveProductFromProductSet", "file": "vision_v1p3beta1_generated_product_search_remove_product_from_product_set_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_RemoveProductFromProductSet_async", "segments": [ { @@ -1538,18 +2866,57 @@ "end": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_remove_product_from_product_set_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient.remove_product_from_product_set", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.RemoveProductFromProductSet", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "RemoveProductFromProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.RemoveProductFromProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "product", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "remove_product_from_product_set" }, + "description": "Sample for RemoveProductFromProductSet", "file": "vision_v1p3beta1_generated_product_search_remove_product_from_product_set_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_RemoveProductFromProductSet_sync", "segments": [ { @@ -1580,19 +2947,59 @@ "end": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_remove_product_from_product_set_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient.update_product_set", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.UpdateProductSet", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "UpdateProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.UpdateProductSetRequest" + }, + { + "name": "product_set", + "type": "google.cloud.vision_v1p3beta1.types.ProductSet" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.types.ProductSet", + "shortName": "update_product_set" }, + "description": "Sample for UpdateProductSet", "file": "vision_v1p3beta1_generated_product_search_update_product_set_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_UpdateProductSet_async", "segments": [ { @@ -1625,18 +3032,58 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_update_product_set_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient.update_product_set", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.UpdateProductSet", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "UpdateProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.UpdateProductSetRequest" + }, + { + "name": "product_set", + "type": "google.cloud.vision_v1p3beta1.types.ProductSet" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.types.ProductSet", + "shortName": "update_product_set" }, + "description": "Sample for UpdateProductSet", "file": "vision_v1p3beta1_generated_product_search_update_product_set_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_UpdateProductSet_sync", "segments": [ { @@ -1669,19 +3116,59 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_update_product_set_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchAsyncClient.update_product", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.UpdateProduct", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "UpdateProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.UpdateProductRequest" + }, + { + "name": "product", + "type": "google.cloud.vision_v1p3beta1.types.Product" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.types.Product", + "shortName": "update_product" }, + "description": "Sample for UpdateProduct", "file": "vision_v1p3beta1_generated_product_search_update_product_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_UpdateProduct_async", "segments": [ { @@ -1714,18 +3201,58 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_update_product_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p3beta1.ProductSearchClient.update_product", "method": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch.UpdateProduct", "service": { + "fullName": "google.cloud.vision.v1p3beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "UpdateProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p3beta1.types.UpdateProductRequest" + }, + { + "name": "product", + "type": "google.cloud.vision_v1p3beta1.types.Product" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p3beta1.types.Product", + "shortName": "update_product" }, + "description": "Sample for UpdateProduct", "file": "vision_v1p3beta1_generated_product_search_update_product_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p3beta1_generated_ProductSearch_UpdateProduct_sync", "segments": [ { @@ -1758,7 +3285,8 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p3beta1_generated_product_search_update_product_sync.py" } ] } diff --git a/samples/generated_samples/snippet_metadata_vision_v1p4beta1.json b/samples/generated_samples/snippet_metadata_vision_v1p4beta1.json index 8a312b70..16c5e532 100644 --- a/samples/generated_samples/snippet_metadata_vision_v1p4beta1.json +++ b/samples/generated_samples/snippet_metadata_vision_v1p4beta1.json @@ -1,16 +1,61 @@ { + "clientLibrary": { + "apis": [ + { + "id": "google.cloud.vision.v1p4beta1", + "version": "v1p4beta1" + } + ], + "language": "PYTHON", + "name": "google-cloud-vision" + }, "snippets": [ { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ImageAnnotatorAsyncClient", + "shortName": "ImageAnnotatorAsyncClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ImageAnnotatorAsyncClient.async_batch_annotate_files", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator.AsyncBatchAnnotateFiles", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "AsyncBatchAnnotateFiles" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateFilesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1p4beta1.types.AsyncAnnotateFileRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "async_batch_annotate_files" }, + "description": "Sample for AsyncBatchAnnotateFiles", "file": "vision_v1p4beta1_generated_image_annotator_async_batch_annotate_files_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_async", "segments": [ { @@ -43,18 +88,54 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_image_annotator_async_batch_annotate_files_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ImageAnnotatorClient", + "shortName": "ImageAnnotatorClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ImageAnnotatorClient.async_batch_annotate_files", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator.AsyncBatchAnnotateFiles", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "AsyncBatchAnnotateFiles" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateFilesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1p4beta1.types.AsyncAnnotateFileRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "async_batch_annotate_files" }, + "description": "Sample for AsyncBatchAnnotateFiles", "file": "vision_v1p4beta1_generated_image_annotator_async_batch_annotate_files_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ImageAnnotator_AsyncBatchAnnotateFiles_sync", "segments": [ { @@ -87,19 +168,59 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_image_annotator_async_batch_annotate_files_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ImageAnnotatorAsyncClient", + "shortName": "ImageAnnotatorAsyncClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ImageAnnotatorAsyncClient.async_batch_annotate_images", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator.AsyncBatchAnnotateImages", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "AsyncBatchAnnotateImages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateImagesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]" + }, + { + "name": "output_config", + "type": "google.cloud.vision_v1p4beta1.types.OutputConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "async_batch_annotate_images" }, + "description": "Sample for AsyncBatchAnnotateImages", "file": "vision_v1p4beta1_generated_image_annotator_async_batch_annotate_images_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ImageAnnotator_AsyncBatchAnnotateImages_async", "segments": [ { @@ -132,18 +253,58 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_image_annotator_async_batch_annotate_images_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ImageAnnotatorClient", + "shortName": "ImageAnnotatorClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ImageAnnotatorClient.async_batch_annotate_images", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator.AsyncBatchAnnotateImages", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "AsyncBatchAnnotateImages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.AsyncBatchAnnotateImagesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]" + }, + { + "name": "output_config", + "type": "google.cloud.vision_v1p4beta1.types.OutputConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "async_batch_annotate_images" }, + "description": "Sample for AsyncBatchAnnotateImages", "file": "vision_v1p4beta1_generated_image_annotator_async_batch_annotate_images_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ImageAnnotator_AsyncBatchAnnotateImages_sync", "segments": [ { @@ -176,19 +337,55 @@ "start": 45, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_image_annotator_async_batch_annotate_images_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ImageAnnotatorAsyncClient", + "shortName": "ImageAnnotatorAsyncClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ImageAnnotatorAsyncClient.batch_annotate_files", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator.BatchAnnotateFiles", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "BatchAnnotateFiles" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.BatchAnnotateFilesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1p4beta1.types.AnnotateFileRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.types.BatchAnnotateFilesResponse", + "shortName": "batch_annotate_files" }, + "description": "Sample for BatchAnnotateFiles", "file": "vision_v1p4beta1_generated_image_annotator_batch_annotate_files_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ImageAnnotator_BatchAnnotateFiles_async", "segments": [ { @@ -221,18 +418,54 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_image_annotator_batch_annotate_files_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ImageAnnotatorClient", + "shortName": "ImageAnnotatorClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ImageAnnotatorClient.batch_annotate_files", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator.BatchAnnotateFiles", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "BatchAnnotateFiles" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.BatchAnnotateFilesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1p4beta1.types.AnnotateFileRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.types.BatchAnnotateFilesResponse", + "shortName": "batch_annotate_files" }, + "description": "Sample for BatchAnnotateFiles", "file": "vision_v1p4beta1_generated_image_annotator_batch_annotate_files_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ImageAnnotator_BatchAnnotateFiles_sync", "segments": [ { @@ -265,19 +498,55 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_image_annotator_batch_annotate_files_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ImageAnnotatorAsyncClient", + "shortName": "ImageAnnotatorAsyncClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ImageAnnotatorAsyncClient.batch_annotate_images", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator.BatchAnnotateImages", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "BatchAnnotateImages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.BatchAnnotateImagesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.types.BatchAnnotateImagesResponse", + "shortName": "batch_annotate_images" }, + "description": "Sample for BatchAnnotateImages", "file": "vision_v1p4beta1_generated_image_annotator_batch_annotate_images_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ImageAnnotator_BatchAnnotateImages_async", "segments": [ { @@ -310,18 +579,54 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_image_annotator_batch_annotate_images_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ImageAnnotatorClient", + "shortName": "ImageAnnotatorClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ImageAnnotatorClient.batch_annotate_images", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator.BatchAnnotateImages", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ImageAnnotator", "shortName": "ImageAnnotator" }, "shortName": "BatchAnnotateImages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.BatchAnnotateImagesRequest" + }, + { + "name": "requests", + "type": "Sequence[google.cloud.vision_v1p4beta1.types.AnnotateImageRequest]" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.types.BatchAnnotateImagesResponse", + "shortName": "batch_annotate_images" }, + "description": "Sample for BatchAnnotateImages", "file": "vision_v1p4beta1_generated_image_annotator_batch_annotate_images_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ImageAnnotator_BatchAnnotateImages_sync", "segments": [ { @@ -354,19 +659,58 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_image_annotator_batch_annotate_images_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient.add_product_to_product_set", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.AddProductToProductSet", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "AddProductToProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.AddProductToProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "product", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "add_product_to_product_set" }, + "description": "Sample for AddProductToProductSet", "file": "vision_v1p4beta1_generated_product_search_add_product_to_product_set_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_AddProductToProductSet_async", "segments": [ { @@ -397,18 +741,57 @@ "end": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_add_product_to_product_set_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient.add_product_to_product_set", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.AddProductToProductSet", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "AddProductToProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.AddProductToProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "product", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "add_product_to_product_set" }, + "description": "Sample for AddProductToProductSet", "file": "vision_v1p4beta1_generated_product_search_add_product_to_product_set_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_AddProductToProductSet_sync", "segments": [ { @@ -439,19 +822,63 @@ "end": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_add_product_to_product_set_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient.create_product_set", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.CreateProductSet", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "CreateProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.CreateProductSetRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "product_set", + "type": "google.cloud.vision_v1p4beta1.types.ProductSet" + }, + { + "name": "product_set_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.types.ProductSet", + "shortName": "create_product_set" }, + "description": "Sample for CreateProductSet", "file": "vision_v1p4beta1_generated_product_search_create_product_set_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_CreateProductSet_async", "segments": [ { @@ -484,18 +911,62 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_create_product_set_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient.create_product_set", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.CreateProductSet", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "CreateProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.CreateProductSetRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "product_set", + "type": "google.cloud.vision_v1p4beta1.types.ProductSet" + }, + { + "name": "product_set_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.types.ProductSet", + "shortName": "create_product_set" }, + "description": "Sample for CreateProductSet", "file": "vision_v1p4beta1_generated_product_search_create_product_set_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_CreateProductSet_sync", "segments": [ { @@ -528,19 +999,63 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_create_product_set_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient.create_product", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.CreateProduct", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "CreateProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.CreateProductRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "product", + "type": "google.cloud.vision_v1p4beta1.types.Product" + }, + { + "name": "product_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.types.Product", + "shortName": "create_product" }, + "description": "Sample for CreateProduct", "file": "vision_v1p4beta1_generated_product_search_create_product_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_CreateProduct_async", "segments": [ { @@ -573,18 +1088,62 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_create_product_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient.create_product", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.CreateProduct", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "CreateProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.CreateProductRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "product", + "type": "google.cloud.vision_v1p4beta1.types.Product" + }, + { + "name": "product_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.types.Product", + "shortName": "create_product" }, + "description": "Sample for CreateProduct", "file": "vision_v1p4beta1_generated_product_search_create_product_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_CreateProduct_sync", "segments": [ { @@ -617,19 +1176,63 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_create_product_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient.create_reference_image", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.CreateReferenceImage", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "CreateReferenceImage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.CreateReferenceImageRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "reference_image", + "type": "google.cloud.vision_v1p4beta1.types.ReferenceImage" + }, + { + "name": "reference_image_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.types.ReferenceImage", + "shortName": "create_reference_image" }, + "description": "Sample for CreateReferenceImage", "file": "vision_v1p4beta1_generated_product_search_create_reference_image_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_CreateReferenceImage_async", "segments": [ { @@ -662,18 +1265,62 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_create_reference_image_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient.create_reference_image", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.CreateReferenceImage", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "CreateReferenceImage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.CreateReferenceImageRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "reference_image", + "type": "google.cloud.vision_v1p4beta1.types.ReferenceImage" + }, + { + "name": "reference_image_id", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.types.ReferenceImage", + "shortName": "create_reference_image" }, + "description": "Sample for CreateReferenceImage", "file": "vision_v1p4beta1_generated_product_search_create_reference_image_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_CreateReferenceImage_sync", "segments": [ { @@ -706,19 +1353,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_create_reference_image_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient.delete_product_set", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.DeleteProductSet", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "DeleteProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.DeleteProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_product_set" }, + "description": "Sample for DeleteProductSet", "file": "vision_v1p4beta1_generated_product_search_delete_product_set_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_DeleteProductSet_async", "segments": [ { @@ -749,18 +1431,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_delete_product_set_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient.delete_product_set", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.DeleteProductSet", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "DeleteProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.DeleteProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_product_set" }, + "description": "Sample for DeleteProductSet", "file": "vision_v1p4beta1_generated_product_search_delete_product_set_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_DeleteProductSet_sync", "segments": [ { @@ -791,19 +1508,54 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_delete_product_set_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient.delete_product", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.DeleteProduct", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "DeleteProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.DeleteProductRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_product" }, + "description": "Sample for DeleteProduct", "file": "vision_v1p4beta1_generated_product_search_delete_product_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_DeleteProduct_async", "segments": [ { @@ -834,18 +1586,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_delete_product_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient.delete_product", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.DeleteProduct", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "DeleteProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.DeleteProductRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_product" }, + "description": "Sample for DeleteProduct", "file": "vision_v1p4beta1_generated_product_search_delete_product_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_DeleteProduct_sync", "segments": [ { @@ -876,19 +1663,54 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_delete_product_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient.delete_reference_image", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.DeleteReferenceImage", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "DeleteReferenceImage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.DeleteReferenceImageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_reference_image" }, + "description": "Sample for DeleteReferenceImage", "file": "vision_v1p4beta1_generated_product_search_delete_reference_image_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_DeleteReferenceImage_async", "segments": [ { @@ -919,18 +1741,53 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_delete_reference_image_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient.delete_reference_image", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.DeleteReferenceImage", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "DeleteReferenceImage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.DeleteReferenceImageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "delete_reference_image" }, + "description": "Sample for DeleteReferenceImage", "file": "vision_v1p4beta1_generated_product_search_delete_reference_image_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_DeleteReferenceImage_sync", "segments": [ { @@ -961,19 +1818,55 @@ "end": 43, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_delete_reference_image_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient.get_product_set", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.GetProductSet", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "GetProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.GetProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.types.ProductSet", + "shortName": "get_product_set" }, + "description": "Sample for GetProductSet", "file": "vision_v1p4beta1_generated_product_search_get_product_set_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_GetProductSet_async", "segments": [ { @@ -1006,18 +1899,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_get_product_set_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient.get_product_set", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.GetProductSet", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "GetProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.GetProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.types.ProductSet", + "shortName": "get_product_set" }, + "description": "Sample for GetProductSet", "file": "vision_v1p4beta1_generated_product_search_get_product_set_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_GetProductSet_sync", "segments": [ { @@ -1050,19 +1979,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_get_product_set_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient.get_product", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.GetProduct", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "GetProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.GetProductRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.types.Product", + "shortName": "get_product" }, + "description": "Sample for GetProduct", "file": "vision_v1p4beta1_generated_product_search_get_product_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_GetProduct_async", "segments": [ { @@ -1095,18 +2060,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_get_product_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient.get_product", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.GetProduct", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "GetProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.GetProductRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.types.Product", + "shortName": "get_product" }, + "description": "Sample for GetProduct", "file": "vision_v1p4beta1_generated_product_search_get_product_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_GetProduct_sync", "segments": [ { @@ -1139,19 +2140,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_get_product_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient.get_reference_image", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.GetReferenceImage", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "GetReferenceImage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.GetReferenceImageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.types.ReferenceImage", + "shortName": "get_reference_image" }, + "description": "Sample for GetReferenceImage", "file": "vision_v1p4beta1_generated_product_search_get_reference_image_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_GetReferenceImage_async", "segments": [ { @@ -1184,18 +2221,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_get_reference_image_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient.get_reference_image", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.GetReferenceImage", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "GetReferenceImage" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.GetReferenceImageRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.types.ReferenceImage", + "shortName": "get_reference_image" }, + "description": "Sample for GetReferenceImage", "file": "vision_v1p4beta1_generated_product_search_get_reference_image_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_GetReferenceImage_sync", "segments": [ { @@ -1228,19 +2301,59 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_get_reference_image_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient.import_product_sets", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.ImportProductSets", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ImportProductSets" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.ImportProductSetsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "input_config", + "type": "google.cloud.vision_v1p4beta1.types.ImportProductSetsInputConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "import_product_sets" }, + "description": "Sample for ImportProductSets", "file": "vision_v1p4beta1_generated_product_search_import_product_sets_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_ImportProductSets_async", "segments": [ { @@ -1273,18 +2386,58 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_import_product_sets_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient.import_product_sets", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.ImportProductSets", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ImportProductSets" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.ImportProductSetsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "input_config", + "type": "google.cloud.vision_v1p4beta1.types.ImportProductSetsInputConfig" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "import_product_sets" }, + "description": "Sample for ImportProductSets", "file": "vision_v1p4beta1_generated_product_search_import_product_sets_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_ImportProductSets_sync", "segments": [ { @@ -1317,19 +2470,55 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_import_product_sets_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient.list_product_sets", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.ListProductSets", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListProductSets" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.ListProductSetsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductSetsAsyncPager", + "shortName": "list_product_sets" }, + "description": "Sample for ListProductSets", "file": "vision_v1p4beta1_generated_product_search_list_product_sets_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_ListProductSets_async", "segments": [ { @@ -1362,18 +2551,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_list_product_sets_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient.list_product_sets", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.ListProductSets", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListProductSets" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.ListProductSetsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductSetsPager", + "shortName": "list_product_sets" }, + "description": "Sample for ListProductSets", "file": "vision_v1p4beta1_generated_product_search_list_product_sets_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_ListProductSets_sync", "segments": [ { @@ -1406,19 +2631,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_list_product_sets_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient.list_products_in_product_set", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.ListProductsInProductSet", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListProductsInProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.ListProductsInProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductsInProductSetAsyncPager", + "shortName": "list_products_in_product_set" }, + "description": "Sample for ListProductsInProductSet", "file": "vision_v1p4beta1_generated_product_search_list_products_in_product_set_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_ListProductsInProductSet_async", "segments": [ { @@ -1451,18 +2712,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_list_products_in_product_set_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient.list_products_in_product_set", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.ListProductsInProductSet", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListProductsInProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.ListProductsInProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductsInProductSetPager", + "shortName": "list_products_in_product_set" }, + "description": "Sample for ListProductsInProductSet", "file": "vision_v1p4beta1_generated_product_search_list_products_in_product_set_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_ListProductsInProductSet_sync", "segments": [ { @@ -1495,19 +2792,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_list_products_in_product_set_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient.list_products", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.ListProducts", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListProducts" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.ListProductsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductsAsyncPager", + "shortName": "list_products" }, + "description": "Sample for ListProducts", "file": "vision_v1p4beta1_generated_product_search_list_products_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_ListProducts_async", "segments": [ { @@ -1540,18 +2873,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_list_products_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient.list_products", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.ListProducts", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListProducts" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.ListProductsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductsPager", + "shortName": "list_products" }, + "description": "Sample for ListProducts", "file": "vision_v1p4beta1_generated_product_search_list_products_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_ListProducts_sync", "segments": [ { @@ -1584,19 +2953,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_list_products_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient.list_reference_images", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.ListReferenceImages", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListReferenceImages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.ListReferenceImagesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.services.product_search.pagers.ListReferenceImagesAsyncPager", + "shortName": "list_reference_images" }, + "description": "Sample for ListReferenceImages", "file": "vision_v1p4beta1_generated_product_search_list_reference_images_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_ListReferenceImages_async", "segments": [ { @@ -1629,18 +3034,54 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_list_reference_images_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient.list_reference_images", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.ListReferenceImages", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "ListReferenceImages" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.ListReferenceImagesRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.services.product_search.pagers.ListReferenceImagesPager", + "shortName": "list_reference_images" }, + "description": "Sample for ListReferenceImages", "file": "vision_v1p4beta1_generated_product_search_list_reference_images_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_ListReferenceImages_sync", "segments": [ { @@ -1673,19 +3114,55 @@ "start": 42, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_list_reference_images_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient.purge_products", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.PurgeProducts", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "PurgeProducts" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.PurgeProductsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation_async.AsyncOperation", + "shortName": "purge_products" }, + "description": "Sample for PurgeProducts", "file": "vision_v1p4beta1_generated_product_search_purge_products_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_PurgeProducts_async", "segments": [ { @@ -1718,18 +3195,54 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_purge_products_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient.purge_products", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.PurgeProducts", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "PurgeProducts" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.PurgeProductsRequest" + }, + { + "name": "parent", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.api_core.operation.Operation", + "shortName": "purge_products" }, + "description": "Sample for PurgeProducts", "file": "vision_v1p4beta1_generated_product_search_purge_products_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_PurgeProducts_sync", "segments": [ { @@ -1762,19 +3275,58 @@ "start": 46, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_purge_products_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient.remove_product_from_product_set", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.RemoveProductFromProductSet", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "RemoveProductFromProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.RemoveProductFromProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "product", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "remove_product_from_product_set" }, + "description": "Sample for RemoveProductFromProductSet", "file": "vision_v1p4beta1_generated_product_search_remove_product_from_product_set_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_RemoveProductFromProductSet_async", "segments": [ { @@ -1805,18 +3357,57 @@ "end": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_remove_product_from_product_set_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient.remove_product_from_product_set", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.RemoveProductFromProductSet", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "RemoveProductFromProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.RemoveProductFromProductSetRequest" + }, + { + "name": "name", + "type": "str" + }, + { + "name": "product", + "type": "str" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "shortName": "remove_product_from_product_set" }, + "description": "Sample for RemoveProductFromProductSet", "file": "vision_v1p4beta1_generated_product_search_remove_product_from_product_set_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_RemoveProductFromProductSet_sync", "segments": [ { @@ -1847,19 +3438,59 @@ "end": 44, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_remove_product_from_product_set_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient.update_product_set", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.UpdateProductSet", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "UpdateProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.UpdateProductSetRequest" + }, + { + "name": "product_set", + "type": "google.cloud.vision_v1p4beta1.types.ProductSet" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.types.ProductSet", + "shortName": "update_product_set" }, + "description": "Sample for UpdateProductSet", "file": "vision_v1p4beta1_generated_product_search_update_product_set_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_UpdateProductSet_async", "segments": [ { @@ -1892,18 +3523,58 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_update_product_set_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient.update_product_set", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.UpdateProductSet", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "UpdateProductSet" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.UpdateProductSetRequest" + }, + { + "name": "product_set", + "type": "google.cloud.vision_v1p4beta1.types.ProductSet" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.types.ProductSet", + "shortName": "update_product_set" }, + "description": "Sample for UpdateProductSet", "file": "vision_v1p4beta1_generated_product_search_update_product_set_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_UpdateProductSet_sync", "segments": [ { @@ -1936,19 +3607,59 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_update_product_set_sync.py" }, { + "canonical": true, "clientMethod": { "async": true, + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient", + "shortName": "ProductSearchAsyncClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchAsyncClient.update_product", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.UpdateProduct", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "UpdateProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.UpdateProductRequest" + }, + { + "name": "product", + "type": "google.cloud.vision_v1p4beta1.types.Product" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.types.Product", + "shortName": "update_product" }, + "description": "Sample for UpdateProduct", "file": "vision_v1p4beta1_generated_product_search_update_product_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_UpdateProduct_async", "segments": [ { @@ -1981,18 +3692,58 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_update_product_async.py" }, { + "canonical": true, "clientMethod": { + "client": { + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient", + "shortName": "ProductSearchClient" + }, + "fullName": "google.cloud.vision_v1p4beta1.ProductSearchClient.update_product", "method": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch.UpdateProduct", "service": { + "fullName": "google.cloud.vision.v1p4beta1.ProductSearch", "shortName": "ProductSearch" }, "shortName": "UpdateProduct" - } + }, + "parameters": [ + { + "name": "request", + "type": "google.cloud.vision_v1p4beta1.types.UpdateProductRequest" + }, + { + "name": "product", + "type": "google.cloud.vision_v1p4beta1.types.Product" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.cloud.vision_v1p4beta1.types.Product", + "shortName": "update_product" }, + "description": "Sample for UpdateProduct", "file": "vision_v1p4beta1_generated_product_search_update_product_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", "regionTag": "vision_v1p4beta1_generated_ProductSearch_UpdateProduct_sync", "segments": [ { @@ -2025,7 +3776,8 @@ "start": 41, "type": "RESPONSE_HANDLING" } - ] + ], + "title": "vision_v1p4beta1_generated_product_search_update_product_sync.py" } ] } diff --git a/samples/generated_samples/vision_v1_generated_image_annotator_async_batch_annotate_files_async.py b/samples/generated_samples/vision_v1_generated_image_annotator_async_batch_annotate_files_async.py index 6226e997..c88f1667 100644 --- a/samples/generated_samples/vision_v1_generated_image_annotator_async_batch_annotate_files_async.py +++ b/samples/generated_samples/vision_v1_generated_image_annotator_async_batch_annotate_files_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_image_annotator_async_batch_annotate_files_sync.py b/samples/generated_samples/vision_v1_generated_image_annotator_async_batch_annotate_files_sync.py index 028744c3..4083f27e 100644 --- a/samples/generated_samples/vision_v1_generated_image_annotator_async_batch_annotate_files_sync.py +++ b/samples/generated_samples/vision_v1_generated_image_annotator_async_batch_annotate_files_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_image_annotator_async_batch_annotate_images_async.py b/samples/generated_samples/vision_v1_generated_image_annotator_async_batch_annotate_images_async.py index f06f42aa..4822d4d5 100644 --- a/samples/generated_samples/vision_v1_generated_image_annotator_async_batch_annotate_images_async.py +++ b/samples/generated_samples/vision_v1_generated_image_annotator_async_batch_annotate_images_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_image_annotator_async_batch_annotate_images_sync.py b/samples/generated_samples/vision_v1_generated_image_annotator_async_batch_annotate_images_sync.py index 73c94918..bc2a232f 100644 --- a/samples/generated_samples/vision_v1_generated_image_annotator_async_batch_annotate_images_sync.py +++ b/samples/generated_samples/vision_v1_generated_image_annotator_async_batch_annotate_images_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_image_annotator_batch_annotate_files_async.py b/samples/generated_samples/vision_v1_generated_image_annotator_batch_annotate_files_async.py index c09df6a2..07534e6b 100644 --- a/samples/generated_samples/vision_v1_generated_image_annotator_batch_annotate_files_async.py +++ b/samples/generated_samples/vision_v1_generated_image_annotator_batch_annotate_files_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_image_annotator_batch_annotate_files_sync.py b/samples/generated_samples/vision_v1_generated_image_annotator_batch_annotate_files_sync.py index 9eac77d5..1227a233 100644 --- a/samples/generated_samples/vision_v1_generated_image_annotator_batch_annotate_files_sync.py +++ b/samples/generated_samples/vision_v1_generated_image_annotator_batch_annotate_files_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_image_annotator_batch_annotate_images_async.py b/samples/generated_samples/vision_v1_generated_image_annotator_batch_annotate_images_async.py index 0e7691f5..435150fa 100644 --- a/samples/generated_samples/vision_v1_generated_image_annotator_batch_annotate_images_async.py +++ b/samples/generated_samples/vision_v1_generated_image_annotator_batch_annotate_images_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_image_annotator_batch_annotate_images_sync.py b/samples/generated_samples/vision_v1_generated_image_annotator_batch_annotate_images_sync.py index 88a4536e..a4ef39bd 100644 --- a/samples/generated_samples/vision_v1_generated_image_annotator_batch_annotate_images_sync.py +++ b/samples/generated_samples/vision_v1_generated_image_annotator_batch_annotate_images_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_add_product_to_product_set_async.py b/samples/generated_samples/vision_v1_generated_product_search_add_product_to_product_set_async.py index ed1e2bd8..f529325b 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_add_product_to_product_set_async.py +++ b/samples/generated_samples/vision_v1_generated_product_search_add_product_to_product_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_add_product_to_product_set_sync.py b/samples/generated_samples/vision_v1_generated_product_search_add_product_to_product_set_sync.py index 29fe7afb..8caa593e 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_add_product_to_product_set_sync.py +++ b/samples/generated_samples/vision_v1_generated_product_search_add_product_to_product_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_create_product_async.py b/samples/generated_samples/vision_v1_generated_product_search_create_product_async.py index bf946336..42705dcb 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_create_product_async.py +++ b/samples/generated_samples/vision_v1_generated_product_search_create_product_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_create_product_set_async.py b/samples/generated_samples/vision_v1_generated_product_search_create_product_set_async.py index fd46b3bd..0713328d 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_create_product_set_async.py +++ b/samples/generated_samples/vision_v1_generated_product_search_create_product_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_create_product_set_sync.py b/samples/generated_samples/vision_v1_generated_product_search_create_product_set_sync.py index 581f3ca0..4ee7ea62 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_create_product_set_sync.py +++ b/samples/generated_samples/vision_v1_generated_product_search_create_product_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_create_product_sync.py b/samples/generated_samples/vision_v1_generated_product_search_create_product_sync.py index fe57e203..61a3d577 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_create_product_sync.py +++ b/samples/generated_samples/vision_v1_generated_product_search_create_product_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_create_reference_image_async.py b/samples/generated_samples/vision_v1_generated_product_search_create_reference_image_async.py index 18497bc0..94821cbd 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_create_reference_image_async.py +++ b/samples/generated_samples/vision_v1_generated_product_search_create_reference_image_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_create_reference_image_sync.py b/samples/generated_samples/vision_v1_generated_product_search_create_reference_image_sync.py index ceae9b0a..98618c95 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_create_reference_image_sync.py +++ b/samples/generated_samples/vision_v1_generated_product_search_create_reference_image_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_delete_product_async.py b/samples/generated_samples/vision_v1_generated_product_search_delete_product_async.py index 1831f433..7e56e615 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_delete_product_async.py +++ b/samples/generated_samples/vision_v1_generated_product_search_delete_product_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_delete_product_set_async.py b/samples/generated_samples/vision_v1_generated_product_search_delete_product_set_async.py index 17b81593..f4ec49fd 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_delete_product_set_async.py +++ b/samples/generated_samples/vision_v1_generated_product_search_delete_product_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_delete_product_set_sync.py b/samples/generated_samples/vision_v1_generated_product_search_delete_product_set_sync.py index a4481e02..68f93483 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_delete_product_set_sync.py +++ b/samples/generated_samples/vision_v1_generated_product_search_delete_product_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_delete_product_sync.py b/samples/generated_samples/vision_v1_generated_product_search_delete_product_sync.py index f8fa3fad..c500eede 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_delete_product_sync.py +++ b/samples/generated_samples/vision_v1_generated_product_search_delete_product_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_delete_reference_image_async.py b/samples/generated_samples/vision_v1_generated_product_search_delete_reference_image_async.py index 830b88f0..3bc0212f 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_delete_reference_image_async.py +++ b/samples/generated_samples/vision_v1_generated_product_search_delete_reference_image_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_delete_reference_image_sync.py b/samples/generated_samples/vision_v1_generated_product_search_delete_reference_image_sync.py index 7beb3f83..9dfb165c 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_delete_reference_image_sync.py +++ b/samples/generated_samples/vision_v1_generated_product_search_delete_reference_image_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_get_product_async.py b/samples/generated_samples/vision_v1_generated_product_search_get_product_async.py index fa998b95..347cd239 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_get_product_async.py +++ b/samples/generated_samples/vision_v1_generated_product_search_get_product_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_get_product_set_async.py b/samples/generated_samples/vision_v1_generated_product_search_get_product_set_async.py index 8f9862fc..39f42899 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_get_product_set_async.py +++ b/samples/generated_samples/vision_v1_generated_product_search_get_product_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_get_product_set_sync.py b/samples/generated_samples/vision_v1_generated_product_search_get_product_set_sync.py index cd592b37..08552c78 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_get_product_set_sync.py +++ b/samples/generated_samples/vision_v1_generated_product_search_get_product_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_get_product_sync.py b/samples/generated_samples/vision_v1_generated_product_search_get_product_sync.py index 88b5b72b..d3a2f78d 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_get_product_sync.py +++ b/samples/generated_samples/vision_v1_generated_product_search_get_product_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_get_reference_image_async.py b/samples/generated_samples/vision_v1_generated_product_search_get_reference_image_async.py index 059604f9..c7b618f5 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_get_reference_image_async.py +++ b/samples/generated_samples/vision_v1_generated_product_search_get_reference_image_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_get_reference_image_sync.py b/samples/generated_samples/vision_v1_generated_product_search_get_reference_image_sync.py index cb19d1ce..9bc6bb13 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_get_reference_image_sync.py +++ b/samples/generated_samples/vision_v1_generated_product_search_get_reference_image_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_import_product_sets_async.py b/samples/generated_samples/vision_v1_generated_product_search_import_product_sets_async.py index be8141fa..a177155a 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_import_product_sets_async.py +++ b/samples/generated_samples/vision_v1_generated_product_search_import_product_sets_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_import_product_sets_sync.py b/samples/generated_samples/vision_v1_generated_product_search_import_product_sets_sync.py index 6243011a..cbe472f0 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_import_product_sets_sync.py +++ b/samples/generated_samples/vision_v1_generated_product_search_import_product_sets_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_list_product_sets_async.py b/samples/generated_samples/vision_v1_generated_product_search_list_product_sets_async.py index eef8937f..baddb688 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_list_product_sets_async.py +++ b/samples/generated_samples/vision_v1_generated_product_search_list_product_sets_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_list_product_sets_sync.py b/samples/generated_samples/vision_v1_generated_product_search_list_product_sets_sync.py index fad94a07..b492af3d 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_list_product_sets_sync.py +++ b/samples/generated_samples/vision_v1_generated_product_search_list_product_sets_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_list_products_async.py b/samples/generated_samples/vision_v1_generated_product_search_list_products_async.py index b48b7669..91878f2b 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_list_products_async.py +++ b/samples/generated_samples/vision_v1_generated_product_search_list_products_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_list_products_in_product_set_async.py b/samples/generated_samples/vision_v1_generated_product_search_list_products_in_product_set_async.py index 31c269d4..256cab32 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_list_products_in_product_set_async.py +++ b/samples/generated_samples/vision_v1_generated_product_search_list_products_in_product_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_list_products_in_product_set_sync.py b/samples/generated_samples/vision_v1_generated_product_search_list_products_in_product_set_sync.py index 5b32317c..fba5edc6 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_list_products_in_product_set_sync.py +++ b/samples/generated_samples/vision_v1_generated_product_search_list_products_in_product_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_list_products_sync.py b/samples/generated_samples/vision_v1_generated_product_search_list_products_sync.py index d3516515..8e56bde9 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_list_products_sync.py +++ b/samples/generated_samples/vision_v1_generated_product_search_list_products_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_list_reference_images_async.py b/samples/generated_samples/vision_v1_generated_product_search_list_reference_images_async.py index 6394b8e7..ea3d4d8a 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_list_reference_images_async.py +++ b/samples/generated_samples/vision_v1_generated_product_search_list_reference_images_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_list_reference_images_sync.py b/samples/generated_samples/vision_v1_generated_product_search_list_reference_images_sync.py index 1ced3d04..515cac0c 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_list_reference_images_sync.py +++ b/samples/generated_samples/vision_v1_generated_product_search_list_reference_images_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_purge_products_async.py b/samples/generated_samples/vision_v1_generated_product_search_purge_products_async.py index 5d49ee36..5eae3a52 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_purge_products_async.py +++ b/samples/generated_samples/vision_v1_generated_product_search_purge_products_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_purge_products_sync.py b/samples/generated_samples/vision_v1_generated_product_search_purge_products_sync.py index a12d8e61..ec7be1c4 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_purge_products_sync.py +++ b/samples/generated_samples/vision_v1_generated_product_search_purge_products_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_remove_product_from_product_set_async.py b/samples/generated_samples/vision_v1_generated_product_search_remove_product_from_product_set_async.py index f6dc57c6..0ac45182 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_remove_product_from_product_set_async.py +++ b/samples/generated_samples/vision_v1_generated_product_search_remove_product_from_product_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_remove_product_from_product_set_sync.py b/samples/generated_samples/vision_v1_generated_product_search_remove_product_from_product_set_sync.py index 10e6b70f..e6abad64 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_remove_product_from_product_set_sync.py +++ b/samples/generated_samples/vision_v1_generated_product_search_remove_product_from_product_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_update_product_async.py b/samples/generated_samples/vision_v1_generated_product_search_update_product_async.py index 2387c5bd..4e8dae14 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_update_product_async.py +++ b/samples/generated_samples/vision_v1_generated_product_search_update_product_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_update_product_set_async.py b/samples/generated_samples/vision_v1_generated_product_search_update_product_set_async.py index 5706b54e..751297f9 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_update_product_set_async.py +++ b/samples/generated_samples/vision_v1_generated_product_search_update_product_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_update_product_set_sync.py b/samples/generated_samples/vision_v1_generated_product_search_update_product_set_sync.py index 1d24cf6a..70257b59 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_update_product_set_sync.py +++ b/samples/generated_samples/vision_v1_generated_product_search_update_product_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1_generated_product_search_update_product_sync.py b/samples/generated_samples/vision_v1_generated_product_search_update_product_sync.py index 5655e9a6..0f212288 100644 --- a/samples/generated_samples/vision_v1_generated_product_search_update_product_sync.py +++ b/samples/generated_samples/vision_v1_generated_product_search_update_product_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p1beta1_generated_image_annotator_batch_annotate_images_async.py b/samples/generated_samples/vision_v1p1beta1_generated_image_annotator_batch_annotate_images_async.py index 3b37ba99..4aeb7e8b 100644 --- a/samples/generated_samples/vision_v1p1beta1_generated_image_annotator_batch_annotate_images_async.py +++ b/samples/generated_samples/vision_v1p1beta1_generated_image_annotator_batch_annotate_images_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p1beta1_generated_image_annotator_batch_annotate_images_sync.py b/samples/generated_samples/vision_v1p1beta1_generated_image_annotator_batch_annotate_images_sync.py index 8e5f8967..1ef89ac6 100644 --- a/samples/generated_samples/vision_v1p1beta1_generated_image_annotator_batch_annotate_images_sync.py +++ b/samples/generated_samples/vision_v1p1beta1_generated_image_annotator_batch_annotate_images_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p2beta1_generated_image_annotator_async_batch_annotate_files_async.py b/samples/generated_samples/vision_v1p2beta1_generated_image_annotator_async_batch_annotate_files_async.py index 93fbdba2..d0d93adc 100644 --- a/samples/generated_samples/vision_v1p2beta1_generated_image_annotator_async_batch_annotate_files_async.py +++ b/samples/generated_samples/vision_v1p2beta1_generated_image_annotator_async_batch_annotate_files_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p2beta1_generated_image_annotator_async_batch_annotate_files_sync.py b/samples/generated_samples/vision_v1p2beta1_generated_image_annotator_async_batch_annotate_files_sync.py index 996ade25..04c4241f 100644 --- a/samples/generated_samples/vision_v1p2beta1_generated_image_annotator_async_batch_annotate_files_sync.py +++ b/samples/generated_samples/vision_v1p2beta1_generated_image_annotator_async_batch_annotate_files_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p2beta1_generated_image_annotator_batch_annotate_images_async.py b/samples/generated_samples/vision_v1p2beta1_generated_image_annotator_batch_annotate_images_async.py index e2b2c9d7..bd50f2e9 100644 --- a/samples/generated_samples/vision_v1p2beta1_generated_image_annotator_batch_annotate_images_async.py +++ b/samples/generated_samples/vision_v1p2beta1_generated_image_annotator_batch_annotate_images_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p2beta1_generated_image_annotator_batch_annotate_images_sync.py b/samples/generated_samples/vision_v1p2beta1_generated_image_annotator_batch_annotate_images_sync.py index 04b0a807..68ca8713 100644 --- a/samples/generated_samples/vision_v1p2beta1_generated_image_annotator_batch_annotate_images_sync.py +++ b/samples/generated_samples/vision_v1p2beta1_generated_image_annotator_batch_annotate_images_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_image_annotator_async_batch_annotate_files_async.py b/samples/generated_samples/vision_v1p3beta1_generated_image_annotator_async_batch_annotate_files_async.py index 10b44a96..fda9161b 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_image_annotator_async_batch_annotate_files_async.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_image_annotator_async_batch_annotate_files_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_image_annotator_async_batch_annotate_files_sync.py b/samples/generated_samples/vision_v1p3beta1_generated_image_annotator_async_batch_annotate_files_sync.py index 26e1fbee..b7dfa115 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_image_annotator_async_batch_annotate_files_sync.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_image_annotator_async_batch_annotate_files_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_image_annotator_batch_annotate_images_async.py b/samples/generated_samples/vision_v1p3beta1_generated_image_annotator_batch_annotate_images_async.py index 45d1c1f0..5a5b0433 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_image_annotator_batch_annotate_images_async.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_image_annotator_batch_annotate_images_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_image_annotator_batch_annotate_images_sync.py b/samples/generated_samples/vision_v1p3beta1_generated_image_annotator_batch_annotate_images_sync.py index f754ef17..7e1bba14 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_image_annotator_batch_annotate_images_sync.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_image_annotator_batch_annotate_images_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_add_product_to_product_set_async.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_add_product_to_product_set_async.py index 36320750..b155b1a5 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_add_product_to_product_set_async.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_add_product_to_product_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_add_product_to_product_set_sync.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_add_product_to_product_set_sync.py index e62449f3..9731ff4f 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_add_product_to_product_set_sync.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_add_product_to_product_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_product_async.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_product_async.py index 03644862..9bece5d5 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_product_async.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_product_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_product_set_async.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_product_set_async.py index c6076ba2..9ab7d882 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_product_set_async.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_product_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_product_set_sync.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_product_set_sync.py index a0e3228c..a3baf4ff 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_product_set_sync.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_product_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_product_sync.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_product_sync.py index 932b9396..73a9762e 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_product_sync.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_product_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_reference_image_async.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_reference_image_async.py index 7ac32420..14ec410b 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_reference_image_async.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_reference_image_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_reference_image_sync.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_reference_image_sync.py index 280651d3..31292c4f 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_reference_image_sync.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_create_reference_image_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_product_async.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_product_async.py index 15c1bcca..738185b7 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_product_async.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_product_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_product_set_async.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_product_set_async.py index ca8bcb35..45b07c80 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_product_set_async.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_product_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_product_set_sync.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_product_set_sync.py index 023a02bb..5fdcd34e 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_product_set_sync.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_product_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_product_sync.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_product_sync.py index d7262f49..deeb79e4 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_product_sync.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_product_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_reference_image_async.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_reference_image_async.py index 7ad98e65..79d7eb5d 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_reference_image_async.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_reference_image_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_reference_image_sync.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_reference_image_sync.py index 50a1e9ff..8da94c94 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_reference_image_sync.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_delete_reference_image_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_product_async.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_product_async.py index 9ef5bd7c..57daa7a6 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_product_async.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_product_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_product_set_async.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_product_set_async.py index f0b0fb00..2f803881 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_product_set_async.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_product_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_product_set_sync.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_product_set_sync.py index 09187224..8c11dc3c 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_product_set_sync.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_product_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_product_sync.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_product_sync.py index 24c20878..31347eb1 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_product_sync.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_product_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_reference_image_async.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_reference_image_async.py index 4c9db65a..d6841008 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_reference_image_async.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_reference_image_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_reference_image_sync.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_reference_image_sync.py index 2485d0c4..a0c84d36 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_reference_image_sync.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_get_reference_image_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_import_product_sets_async.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_import_product_sets_async.py index b805d043..4605a2c8 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_import_product_sets_async.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_import_product_sets_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_import_product_sets_sync.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_import_product_sets_sync.py index bbc33d79..59afe3bf 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_import_product_sets_sync.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_import_product_sets_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_product_sets_async.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_product_sets_async.py index 00c178df..7799f171 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_product_sets_async.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_product_sets_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_product_sets_sync.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_product_sets_sync.py index 3304c071..75d2a263 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_product_sets_sync.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_product_sets_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_products_async.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_products_async.py index 738e1fb8..42a8d9c3 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_products_async.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_products_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_products_in_product_set_async.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_products_in_product_set_async.py index 98c1c128..99ff8d3e 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_products_in_product_set_async.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_products_in_product_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_products_in_product_set_sync.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_products_in_product_set_sync.py index 50902a45..d76435c6 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_products_in_product_set_sync.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_products_in_product_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_products_sync.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_products_sync.py index 9da9d12a..a7171b3b 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_products_sync.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_products_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_reference_images_async.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_reference_images_async.py index 018fbdf0..8329aeeb 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_reference_images_async.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_reference_images_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_reference_images_sync.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_reference_images_sync.py index 83536bfe..414f7fd1 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_reference_images_sync.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_list_reference_images_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_remove_product_from_product_set_async.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_remove_product_from_product_set_async.py index 13047fbb..d517a6e9 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_remove_product_from_product_set_async.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_remove_product_from_product_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_remove_product_from_product_set_sync.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_remove_product_from_product_set_sync.py index efd01864..38b48708 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_remove_product_from_product_set_sync.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_remove_product_from_product_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_update_product_async.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_update_product_async.py index d84f1f8f..21baf36f 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_update_product_async.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_update_product_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_update_product_set_async.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_update_product_set_async.py index 56687e51..83103c37 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_update_product_set_async.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_update_product_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_update_product_set_sync.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_update_product_set_sync.py index 905e63f8..afd1c8e0 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_update_product_set_sync.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_update_product_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p3beta1_generated_product_search_update_product_sync.py b/samples/generated_samples/vision_v1p3beta1_generated_product_search_update_product_sync.py index 60c47ae2..f651f2ae 100644 --- a/samples/generated_samples/vision_v1p3beta1_generated_product_search_update_product_sync.py +++ b/samples/generated_samples/vision_v1p3beta1_generated_product_search_update_product_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_async_batch_annotate_files_async.py b/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_async_batch_annotate_files_async.py index 6d8661cd..342204db 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_async_batch_annotate_files_async.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_async_batch_annotate_files_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_async_batch_annotate_files_sync.py b/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_async_batch_annotate_files_sync.py index 59431046..8b773d37 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_async_batch_annotate_files_sync.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_async_batch_annotate_files_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_async_batch_annotate_images_async.py b/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_async_batch_annotate_images_async.py index ada26db9..9c62f79c 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_async_batch_annotate_images_async.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_async_batch_annotate_images_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_async_batch_annotate_images_sync.py b/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_async_batch_annotate_images_sync.py index 39dfb18d..a679f67b 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_async_batch_annotate_images_sync.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_async_batch_annotate_images_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_batch_annotate_files_async.py b/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_batch_annotate_files_async.py index b84e92ee..5eb3c4d7 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_batch_annotate_files_async.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_batch_annotate_files_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_batch_annotate_files_sync.py b/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_batch_annotate_files_sync.py index 11c7bfdd..1465e954 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_batch_annotate_files_sync.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_batch_annotate_files_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_batch_annotate_images_async.py b/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_batch_annotate_images_async.py index 86725658..ecd53523 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_batch_annotate_images_async.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_batch_annotate_images_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_batch_annotate_images_sync.py b/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_batch_annotate_images_sync.py index 2fef1158..e804c415 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_batch_annotate_images_sync.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_image_annotator_batch_annotate_images_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_add_product_to_product_set_async.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_add_product_to_product_set_async.py index f32ceb7c..256b9e1e 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_add_product_to_product_set_async.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_add_product_to_product_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_add_product_to_product_set_sync.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_add_product_to_product_set_sync.py index adf51de6..3f34e108 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_add_product_to_product_set_sync.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_add_product_to_product_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_product_async.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_product_async.py index 946c2549..2f7e2298 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_product_async.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_product_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_product_set_async.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_product_set_async.py index 33e5c8e9..e09d5810 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_product_set_async.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_product_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_product_set_sync.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_product_set_sync.py index 174540e7..b5a28422 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_product_set_sync.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_product_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_product_sync.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_product_sync.py index 5a536f9d..193190c0 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_product_sync.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_product_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_reference_image_async.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_reference_image_async.py index ce9cc79f..a4ed35cc 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_reference_image_async.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_reference_image_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_reference_image_sync.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_reference_image_sync.py index 9b8f5b27..f834becd 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_reference_image_sync.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_create_reference_image_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_product_async.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_product_async.py index b6cbae49..fb85fedc 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_product_async.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_product_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_product_set_async.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_product_set_async.py index 9f756fe1..d4360a46 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_product_set_async.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_product_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_product_set_sync.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_product_set_sync.py index 4932e163..f349e17f 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_product_set_sync.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_product_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_product_sync.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_product_sync.py index f1c4ed75..cf28cf30 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_product_sync.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_product_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_reference_image_async.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_reference_image_async.py index 5be65e8e..cca8dd23 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_reference_image_async.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_reference_image_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_reference_image_sync.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_reference_image_sync.py index 5aa274b0..5b8cd3f4 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_reference_image_sync.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_delete_reference_image_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_product_async.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_product_async.py index 40466cce..43832682 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_product_async.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_product_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_product_set_async.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_product_set_async.py index 242aae30..10d1e938 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_product_set_async.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_product_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_product_set_sync.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_product_set_sync.py index 69d04d3e..0581ddab 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_product_set_sync.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_product_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_product_sync.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_product_sync.py index dccd9868..886dd0df 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_product_sync.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_product_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_reference_image_async.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_reference_image_async.py index 404cbadd..7e13f923 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_reference_image_async.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_reference_image_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_reference_image_sync.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_reference_image_sync.py index f0ccc3a3..c5c4cd38 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_reference_image_sync.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_get_reference_image_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_import_product_sets_async.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_import_product_sets_async.py index a9bc814d..f6c1e7fd 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_import_product_sets_async.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_import_product_sets_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_import_product_sets_sync.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_import_product_sets_sync.py index a68c06a9..003fd642 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_import_product_sets_sync.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_import_product_sets_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_product_sets_async.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_product_sets_async.py index 03f1058c..a4607cce 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_product_sets_async.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_product_sets_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_product_sets_sync.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_product_sets_sync.py index 16f1bd6e..b58c082b 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_product_sets_sync.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_product_sets_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_products_async.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_products_async.py index f6b3187c..c93dbc4e 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_products_async.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_products_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_products_in_product_set_async.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_products_in_product_set_async.py index eca1ba75..a589f840 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_products_in_product_set_async.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_products_in_product_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_products_in_product_set_sync.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_products_in_product_set_sync.py index beec0e44..afc68093 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_products_in_product_set_sync.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_products_in_product_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_products_sync.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_products_sync.py index 27fe43d4..3b5d89ce 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_products_sync.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_products_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_reference_images_async.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_reference_images_async.py index 3e7d989b..662e1490 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_reference_images_async.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_reference_images_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_reference_images_sync.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_reference_images_sync.py index d97fb7c9..57a1da16 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_reference_images_sync.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_list_reference_images_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_purge_products_async.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_purge_products_async.py index 50c37226..61558707 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_purge_products_async.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_purge_products_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_purge_products_sync.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_purge_products_sync.py index 799081e1..97e01f25 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_purge_products_sync.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_purge_products_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_remove_product_from_product_set_async.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_remove_product_from_product_set_async.py index 51bf3f54..6f3fa166 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_remove_product_from_product_set_async.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_remove_product_from_product_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_remove_product_from_product_set_sync.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_remove_product_from_product_set_sync.py index f14e0b1d..d9bb0f74 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_remove_product_from_product_set_sync.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_remove_product_from_product_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_update_product_async.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_update_product_async.py index 44870b2e..9ad63f3f 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_update_product_async.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_update_product_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_update_product_set_async.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_update_product_set_async.py index 92ae01f5..4476e43e 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_update_product_set_async.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_update_product_set_async.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_update_product_set_sync.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_update_product_set_sync.py index d403db36..8b23598d 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_update_product_set_sync.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_update_product_set_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/generated_samples/vision_v1p4beta1_generated_product_search_update_product_sync.py b/samples/generated_samples/vision_v1p4beta1_generated_product_search_update_product_sync.py index 92a4a617..70636223 100644 --- a/samples/generated_samples/vision_v1p4beta1_generated_product_search_update_product_sync.py +++ b/samples/generated_samples/vision_v1p4beta1_generated_product_search_update_product_sync.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright 2020 Google LLC +# Copyright 2022 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/samples/snippets/crop_hints/noxfile.py b/samples/snippets/crop_hints/noxfile.py index 4c808af7..38bb0a57 100644 --- a/samples/snippets/crop_hints/noxfile.py +++ b/samples/snippets/crop_hints/noxfile.py @@ -29,7 +29,8 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" +ISORT_VERSION = "isort==5.10.1" # Copy `noxfile_config.py` to your directory and modify it instead. @@ -168,12 +169,32 @@ def lint(session: nox.sessions.Session) -> None: @nox.session def blacken(session: nox.sessions.Session) -> None: + """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) python_files = [path for path in os.listdir(".") if path.endswith(".py")] session.run("black", *python_files) +# +# format = isort + black +# + +@nox.session +def format(session: nox.sessions.Session) -> None: + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + python_files = [path for path in os.listdir(".") if path.endswith(".py")] + + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run("isort", "--fss", *python_files) + session.run("black", *python_files) + + # # Sample Tests # diff --git a/samples/snippets/crop_hints/requirements-test.txt b/samples/snippets/crop_hints/requirements-test.txt index 4f6bf643..d00689e0 100644 --- a/samples/snippets/crop_hints/requirements-test.txt +++ b/samples/snippets/crop_hints/requirements-test.txt @@ -1 +1 @@ -pytest==7.1.1 +pytest==7.1.2 diff --git a/samples/snippets/crop_hints/requirements.txt b/samples/snippets/crop_hints/requirements.txt index fc64b7f4..02d48e78 100644 --- a/samples/snippets/crop_hints/requirements.txt +++ b/samples/snippets/crop_hints/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-vision==2.7.1 -pillow==9.0.1 +google-cloud-vision==2.7.2 +pillow==9.1.1 diff --git a/samples/snippets/detect/noxfile.py b/samples/snippets/detect/noxfile.py index 4c808af7..38bb0a57 100644 --- a/samples/snippets/detect/noxfile.py +++ b/samples/snippets/detect/noxfile.py @@ -29,7 +29,8 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" +ISORT_VERSION = "isort==5.10.1" # Copy `noxfile_config.py` to your directory and modify it instead. @@ -168,12 +169,32 @@ def lint(session: nox.sessions.Session) -> None: @nox.session def blacken(session: nox.sessions.Session) -> None: + """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) python_files = [path for path in os.listdir(".") if path.endswith(".py")] session.run("black", *python_files) +# +# format = isort + black +# + +@nox.session +def format(session: nox.sessions.Session) -> None: + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + python_files = [path for path in os.listdir(".") if path.endswith(".py")] + + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run("isort", "--fss", *python_files) + session.run("black", *python_files) + + # # Sample Tests # diff --git a/samples/snippets/detect/requirements-test.txt b/samples/snippets/detect/requirements-test.txt index f906abff..5b20ca4a 100644 --- a/samples/snippets/detect/requirements-test.txt +++ b/samples/snippets/detect/requirements-test.txt @@ -1,3 +1,3 @@ -backoff==1.11.1 -pytest==7.1.1 +backoff==2.0.1 +pytest==7.1.2 flaky==3.7.0 diff --git a/samples/snippets/detect/requirements.txt b/samples/snippets/detect/requirements.txt index 8155db02..21eaed98 100644 --- a/samples/snippets/detect/requirements.txt +++ b/samples/snippets/detect/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-vision==2.7.1 -google-cloud-storage==2.2.1 +google-cloud-vision==2.7.2 +google-cloud-storage==2.3.0 diff --git a/samples/snippets/document_text/noxfile.py b/samples/snippets/document_text/noxfile.py index 4c808af7..38bb0a57 100644 --- a/samples/snippets/document_text/noxfile.py +++ b/samples/snippets/document_text/noxfile.py @@ -29,7 +29,8 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" +ISORT_VERSION = "isort==5.10.1" # Copy `noxfile_config.py` to your directory and modify it instead. @@ -168,12 +169,32 @@ def lint(session: nox.sessions.Session) -> None: @nox.session def blacken(session: nox.sessions.Session) -> None: + """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) python_files = [path for path in os.listdir(".") if path.endswith(".py")] session.run("black", *python_files) +# +# format = isort + black +# + +@nox.session +def format(session: nox.sessions.Session) -> None: + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + python_files = [path for path in os.listdir(".") if path.endswith(".py")] + + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run("isort", "--fss", *python_files) + session.run("black", *python_files) + + # # Sample Tests # diff --git a/samples/snippets/document_text/requirements-test.txt b/samples/snippets/document_text/requirements-test.txt index 4f6bf643..d00689e0 100644 --- a/samples/snippets/document_text/requirements-test.txt +++ b/samples/snippets/document_text/requirements-test.txt @@ -1 +1 @@ -pytest==7.1.1 +pytest==7.1.2 diff --git a/samples/snippets/document_text/requirements.txt b/samples/snippets/document_text/requirements.txt index fc64b7f4..02d48e78 100644 --- a/samples/snippets/document_text/requirements.txt +++ b/samples/snippets/document_text/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-vision==2.7.1 -pillow==9.0.1 +google-cloud-vision==2.7.2 +pillow==9.1.1 diff --git a/samples/snippets/face_detection/noxfile.py b/samples/snippets/face_detection/noxfile.py index 4c808af7..38bb0a57 100644 --- a/samples/snippets/face_detection/noxfile.py +++ b/samples/snippets/face_detection/noxfile.py @@ -29,7 +29,8 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" +ISORT_VERSION = "isort==5.10.1" # Copy `noxfile_config.py` to your directory and modify it instead. @@ -168,12 +169,32 @@ def lint(session: nox.sessions.Session) -> None: @nox.session def blacken(session: nox.sessions.Session) -> None: + """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) python_files = [path for path in os.listdir(".") if path.endswith(".py")] session.run("black", *python_files) +# +# format = isort + black +# + +@nox.session +def format(session: nox.sessions.Session) -> None: + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + python_files = [path for path in os.listdir(".") if path.endswith(".py")] + + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run("isort", "--fss", *python_files) + session.run("black", *python_files) + + # # Sample Tests # diff --git a/samples/snippets/face_detection/requirements-test.txt b/samples/snippets/face_detection/requirements-test.txt index 4f6bf643..d00689e0 100644 --- a/samples/snippets/face_detection/requirements-test.txt +++ b/samples/snippets/face_detection/requirements-test.txt @@ -1 +1 @@ -pytest==7.1.1 +pytest==7.1.2 diff --git a/samples/snippets/face_detection/requirements.txt b/samples/snippets/face_detection/requirements.txt index fc64b7f4..02d48e78 100644 --- a/samples/snippets/face_detection/requirements.txt +++ b/samples/snippets/face_detection/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-vision==2.7.1 -pillow==9.0.1 +google-cloud-vision==2.7.2 +pillow==9.1.1 diff --git a/samples/snippets/product_search/noxfile.py b/samples/snippets/product_search/noxfile.py index 4c808af7..38bb0a57 100644 --- a/samples/snippets/product_search/noxfile.py +++ b/samples/snippets/product_search/noxfile.py @@ -29,7 +29,8 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" +ISORT_VERSION = "isort==5.10.1" # Copy `noxfile_config.py` to your directory and modify it instead. @@ -168,12 +169,32 @@ def lint(session: nox.sessions.Session) -> None: @nox.session def blacken(session: nox.sessions.Session) -> None: + """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) python_files = [path for path in os.listdir(".") if path.endswith(".py")] session.run("black", *python_files) +# +# format = isort + black +# + +@nox.session +def format(session: nox.sessions.Session) -> None: + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + python_files = [path for path in os.listdir(".") if path.endswith(".py")] + + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run("isort", "--fss", *python_files) + session.run("black", *python_files) + + # # Sample Tests # diff --git a/samples/snippets/product_search/requirements-test.txt b/samples/snippets/product_search/requirements-test.txt index 4df68568..3c8d45d4 100644 --- a/samples/snippets/product_search/requirements-test.txt +++ b/samples/snippets/product_search/requirements-test.txt @@ -1,2 +1,2 @@ -pytest==7.1.1 +pytest==7.1.2 flaky==3.7.0 \ No newline at end of file diff --git a/samples/snippets/product_search/requirements.txt b/samples/snippets/product_search/requirements.txt index 8155db02..21eaed98 100644 --- a/samples/snippets/product_search/requirements.txt +++ b/samples/snippets/product_search/requirements.txt @@ -1,2 +1,2 @@ -google-cloud-vision==2.7.1 -google-cloud-storage==2.2.1 +google-cloud-vision==2.7.2 +google-cloud-storage==2.3.0 diff --git a/samples/snippets/quickstart/noxfile.py b/samples/snippets/quickstart/noxfile.py index 4c808af7..38bb0a57 100644 --- a/samples/snippets/quickstart/noxfile.py +++ b/samples/snippets/quickstart/noxfile.py @@ -29,7 +29,8 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" +ISORT_VERSION = "isort==5.10.1" # Copy `noxfile_config.py` to your directory and modify it instead. @@ -168,12 +169,32 @@ def lint(session: nox.sessions.Session) -> None: @nox.session def blacken(session: nox.sessions.Session) -> None: + """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) python_files = [path for path in os.listdir(".") if path.endswith(".py")] session.run("black", *python_files) +# +# format = isort + black +# + +@nox.session +def format(session: nox.sessions.Session) -> None: + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + python_files = [path for path in os.listdir(".") if path.endswith(".py")] + + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run("isort", "--fss", *python_files) + session.run("black", *python_files) + + # # Sample Tests # diff --git a/samples/snippets/quickstart/requirements-test.txt b/samples/snippets/quickstart/requirements-test.txt index 4f6bf643..d00689e0 100644 --- a/samples/snippets/quickstart/requirements-test.txt +++ b/samples/snippets/quickstart/requirements-test.txt @@ -1 +1 @@ -pytest==7.1.1 +pytest==7.1.2 diff --git a/samples/snippets/quickstart/requirements.txt b/samples/snippets/quickstart/requirements.txt index 3c9b949d..ad6102a1 100644 --- a/samples/snippets/quickstart/requirements.txt +++ b/samples/snippets/quickstart/requirements.txt @@ -1 +1 @@ -google-cloud-vision==2.7.1 +google-cloud-vision==2.7.2 diff --git a/samples/snippets/web/noxfile.py b/samples/snippets/web/noxfile.py index 4c808af7..38bb0a57 100644 --- a/samples/snippets/web/noxfile.py +++ b/samples/snippets/web/noxfile.py @@ -29,7 +29,8 @@ # WARNING - WARNING - WARNING - WARNING - WARNING # WARNING - WARNING - WARNING - WARNING - WARNING -BLACK_VERSION = "black==19.10b0" +BLACK_VERSION = "black==22.3.0" +ISORT_VERSION = "isort==5.10.1" # Copy `noxfile_config.py` to your directory and modify it instead. @@ -168,12 +169,32 @@ def lint(session: nox.sessions.Session) -> None: @nox.session def blacken(session: nox.sessions.Session) -> None: + """Run black. Format code to uniform standard.""" session.install(BLACK_VERSION) python_files = [path for path in os.listdir(".") if path.endswith(".py")] session.run("black", *python_files) +# +# format = isort + black +# + +@nox.session +def format(session: nox.sessions.Session) -> None: + """ + Run isort to sort imports. Then run black + to format code to uniform standard. + """ + session.install(BLACK_VERSION, ISORT_VERSION) + python_files = [path for path in os.listdir(".") if path.endswith(".py")] + + # Use the --fss option to sort imports using strict alphabetical order. + # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections + session.run("isort", "--fss", *python_files) + session.run("black", *python_files) + + # # Sample Tests # diff --git a/samples/snippets/web/requirements-test.txt b/samples/snippets/web/requirements-test.txt index 4e8b54f4..ee91c465 100644 --- a/samples/snippets/web/requirements-test.txt +++ b/samples/snippets/web/requirements-test.txt @@ -1,2 +1,2 @@ flaky==3.7.0 -pytest==7.1.1 +pytest==7.1.2 diff --git a/samples/snippets/web/requirements.txt b/samples/snippets/web/requirements.txt index 3c9b949d..ad6102a1 100644 --- a/samples/snippets/web/requirements.txt +++ b/samples/snippets/web/requirements.txt @@ -1 +1 @@ -google-cloud-vision==2.7.1 +google-cloud-vision==2.7.2 diff --git a/scripts/readme-gen/readme_gen.py b/scripts/readme-gen/readme_gen.py index d309d6e9..91b59676 100644 --- a/scripts/readme-gen/readme_gen.py +++ b/scripts/readme-gen/readme_gen.py @@ -28,7 +28,10 @@ jinja_env = jinja2.Environment( trim_blocks=True, loader=jinja2.FileSystemLoader( - os.path.abspath(os.path.join(os.path.dirname(__file__), 'templates')))) + os.path.abspath(os.path.join(os.path.dirname(__file__), "templates")) + ), + autoescape=True, +) README_TMPL = jinja_env.get_template('README.tmpl.rst') diff --git a/setup.py b/setup.py index 31675916..b38aa1b8 100644 --- a/setup.py +++ b/setup.py @@ -19,14 +19,15 @@ name = "google-cloud-vision" description = "Cloud Vision API API client library" -version = "2.7.2" +version = "2.7.3" release_status = "Development Status :: 5 - Production/Stable" dependencies = [ # NOTE: Maintainers, please do not require google-api-core>=2.x.x # Until this issue is closed # https://github.com/googleapis/google-cloud-python/issues/10566 "google-api-core[grpc] >= 1.31.5, <3.0.0dev,!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0", - "proto-plus >= 1.15.0", + "proto-plus >= 1.15.0, <2.0.0dev", + "protobuf >= 3.19.0, <4.0.0dev", ] extras = {"libcst": "libcst >= 0.2.5"} diff --git a/testing/constraints-3.6.txt b/testing/constraints-3.6.txt index b666ca6c..ec8ca201 100644 --- a/testing/constraints-3.6.txt +++ b/testing/constraints-3.6.txt @@ -7,3 +7,4 @@ # Then this file should have foo==1.14.0 google-api-core==1.31.5 proto-plus==1.15.0 +protobuf==3.19.0 diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index e69de29b..ec8ca201 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -0,0 +1,10 @@ +# This constraints file is used to check that lower bounds +# are correct in setup.py +# List *all* library dependencies and extras in this file. +# Pin the version to the lower bound. +# +# e.g., if setup.py has "foo >= 1.14.0, < 2.0.0dev", +# Then this file should have foo==1.14.0 +google-api-core==1.31.5 +proto-plus==1.15.0 +protobuf==3.19.0 diff --git a/tests/unit/gapic/vision_v1/test_image_annotator.py b/tests/unit/gapic/vision_v1/test_image_annotator.py index ebf186c6..4042e332 100644 --- a/tests/unit/gapic/vision_v1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1/test_image_annotator.py @@ -92,20 +92,24 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] + "client_class,transport_name", + [ + (ImageAnnotatorClient, "grpc"), + (ImageAnnotatorAsyncClient, "grpc_asyncio"), + ], ) -def test_image_annotator_client_from_service_account_info(client_class): +def test_image_annotator_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") @pytest.mark.parametrize( @@ -134,23 +138,31 @@ def test_image_annotator_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] + "client_class,transport_name", + [ + (ImageAnnotatorClient, "grpc"), + (ImageAnnotatorAsyncClient, "grpc_asyncio"), + ], ) -def test_image_annotator_client_from_service_account_file(client_class): +def test_image_annotator_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") def test_image_annotator_client_get_transport_class(): @@ -498,7 +510,9 @@ def test_image_annotator_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -642,11 +656,16 @@ def test_image_annotator_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [image_annotator.BatchAnnotateImagesRequest, dict,] + "request_type", + [ + image_annotator.BatchAnnotateImagesRequest, + dict, + ], ) def test_batch_annotate_images(request_type, transport: str = "grpc"): client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -674,7 +693,8 @@ def test_batch_annotate_images_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -693,7 +713,8 @@ async def test_batch_annotate_images_async( request_type=image_annotator.BatchAnnotateImagesRequest, ): client = ImageAnnotatorAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -725,7 +746,9 @@ async def test_batch_annotate_images_async_from_dict(): def test_batch_annotate_images_flattened(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -757,7 +780,9 @@ def test_batch_annotate_images_flattened(): def test_batch_annotate_images_flattened_error(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -831,11 +856,16 @@ async def test_batch_annotate_images_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [image_annotator.BatchAnnotateFilesRequest, dict,] + "request_type", + [ + image_annotator.BatchAnnotateFilesRequest, + dict, + ], ) def test_batch_annotate_files(request_type, transport: str = "grpc"): client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -863,7 +893,8 @@ def test_batch_annotate_files_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -882,7 +913,8 @@ async def test_batch_annotate_files_async( request_type=image_annotator.BatchAnnotateFilesRequest, ): client = ImageAnnotatorAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -914,7 +946,9 @@ async def test_batch_annotate_files_async_from_dict(): def test_batch_annotate_files_flattened(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -950,7 +984,9 @@ def test_batch_annotate_files_flattened(): def test_batch_annotate_files_flattened_error(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1032,11 +1068,16 @@ async def test_batch_annotate_files_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [image_annotator.AsyncBatchAnnotateImagesRequest, dict,] + "request_type", + [ + image_annotator.AsyncBatchAnnotateImagesRequest, + dict, + ], ) def test_async_batch_annotate_images(request_type, transport: str = "grpc"): client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1064,7 +1105,8 @@ def test_async_batch_annotate_images_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1083,7 +1125,8 @@ async def test_async_batch_annotate_images_async( request_type=image_annotator.AsyncBatchAnnotateImagesRequest, ): client = ImageAnnotatorAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1115,7 +1158,9 @@ async def test_async_batch_annotate_images_async_from_dict(): def test_async_batch_annotate_images_flattened(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1155,7 +1200,9 @@ def test_async_batch_annotate_images_flattened(): def test_async_batch_annotate_images_flattened_error(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1243,11 +1290,16 @@ async def test_async_batch_annotate_images_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [image_annotator.AsyncBatchAnnotateFilesRequest, dict,] + "request_type", + [ + image_annotator.AsyncBatchAnnotateFilesRequest, + dict, + ], ) def test_async_batch_annotate_files(request_type, transport: str = "grpc"): client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1275,7 +1327,8 @@ def test_async_batch_annotate_files_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1294,7 +1347,8 @@ async def test_async_batch_annotate_files_async( request_type=image_annotator.AsyncBatchAnnotateFilesRequest, ): client = ImageAnnotatorAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1326,7 +1380,9 @@ async def test_async_batch_annotate_files_async_from_dict(): def test_async_batch_annotate_files_flattened(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1362,7 +1418,9 @@ def test_async_batch_annotate_files_flattened(): def test_async_batch_annotate_files_flattened_error(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1450,7 +1508,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1470,7 +1529,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ImageAnnotatorClient(client_options=options, transport=transport,) + client = ImageAnnotatorClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1486,7 +1548,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ImageAnnotatorClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1529,10 +1592,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = ImageAnnotatorClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.ImageAnnotatorGrpcTransport,) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.ImageAnnotatorGrpcTransport, + ) def test_image_annotator_base_transport_error(): @@ -1574,6 +1655,14 @@ def test_image_annotator_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_image_annotator_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1585,7 +1674,8 @@ def test_image_annotator_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ImageAnnotatorTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1730,24 +1820,40 @@ def test_image_annotator_grpc_transport_client_cert_source_for_mtls(transport_cl ) -def test_image_annotator_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_image_annotator_host_no_port(transport_name): client = ImageAnnotatorClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="vision.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") -def test_image_annotator_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_image_annotator_host_with_port(transport_name): client = ImageAnnotatorClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="vision.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "vision.googleapis.com:8000" + assert client.transport._host == ("vision.googleapis.com:8000") def test_image_annotator_grpc_transport_channel(): @@ -1755,7 +1861,8 @@ def test_image_annotator_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1767,7 +1874,8 @@ def test_image_annotator_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1876,12 +1984,16 @@ def test_image_annotator_transport_channel_mtls_with_adc(transport_class): def test_image_annotator_grpc_lro_client(): client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -1889,12 +2001,16 @@ def test_image_annotator_grpc_lro_client(): def test_image_annotator_grpc_lro_async_client(): client = ImageAnnotatorAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -1905,7 +2021,9 @@ def test_product_path(): location = "clam" product = "whelk" expected = "projects/{project}/locations/{location}/products/{product}".format( - project=project, location=location, product=product, + project=project, + location=location, + product=product, ) actual = ImageAnnotatorClient.product_path(project, location, product) assert expected == actual @@ -1928,8 +2046,12 @@ def test_product_set_path(): project = "cuttlefish" location = "mussel" product_set = "winkle" - expected = "projects/{project}/locations/{location}/productSets/{product_set}".format( - project=project, location=location, product_set=product_set, + expected = ( + "projects/{project}/locations/{location}/productSets/{product_set}".format( + project=project, + location=location, + product_set=product_set, + ) ) actual = ImageAnnotatorClient.product_set_path(project, location, product_set) assert expected == actual @@ -1970,7 +2092,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ImageAnnotatorClient.common_folder_path(folder) assert expected == actual @@ -1988,7 +2112,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ImageAnnotatorClient.common_organization_path(organization) assert expected == actual @@ -2006,7 +2132,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ImageAnnotatorClient.common_project_path(project) assert expected == actual @@ -2026,7 +2154,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ImageAnnotatorClient.common_location_path(project, location) assert expected == actual @@ -2051,7 +2180,8 @@ def test_client_with_default_client_info(): transports.ImageAnnotatorTransport, "_prep_wrapped_messages" ) as prep: client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2060,7 +2190,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ImageAnnotatorClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2068,7 +2199,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ImageAnnotatorAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/vision_v1/test_product_search.py b/tests/unit/gapic/vision_v1/test_product_search.py index c5fbafc7..0e9e3b2c 100644 --- a/tests/unit/gapic/vision_v1/test_product_search.py +++ b/tests/unit/gapic/vision_v1/test_product_search.py @@ -95,20 +95,24 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [ProductSearchClient, ProductSearchAsyncClient,] + "client_class,transport_name", + [ + (ProductSearchClient, "grpc"), + (ProductSearchAsyncClient, "grpc_asyncio"), + ], ) -def test_product_search_client_from_service_account_info(client_class): +def test_product_search_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") @pytest.mark.parametrize( @@ -137,23 +141,31 @@ def test_product_search_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [ProductSearchClient, ProductSearchAsyncClient,] + "client_class,transport_name", + [ + (ProductSearchClient, "grpc"), + (ProductSearchAsyncClient, "grpc_asyncio"), + ], ) -def test_product_search_client_from_service_account_file(client_class): +def test_product_search_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") def test_product_search_client_get_transport_class(): @@ -501,7 +513,9 @@ def test_product_search_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -645,11 +659,16 @@ def test_product_search_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [product_search_service.CreateProductSetRequest, dict,] + "request_type", + [ + product_search_service.CreateProductSetRequest, + dict, + ], ) def test_create_product_set(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -662,7 +681,8 @@ def test_create_product_set(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = product_search_service.ProductSet( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) response = client.create_product_set(request) @@ -681,7 +701,8 @@ def test_create_product_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -700,7 +721,8 @@ async def test_create_product_set_async( request_type=product_search_service.CreateProductSetRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -714,7 +736,8 @@ async def test_create_product_set_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( product_search_service.ProductSet( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) ) response = await client.create_product_set(request) @@ -736,13 +759,15 @@ async def test_create_product_set_async_from_dict(): def test_create_product_set_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.CreateProductSetRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -758,7 +783,10 @@ def test_create_product_set_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -771,7 +799,7 @@ async def test_create_product_set_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.CreateProductSetRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -789,11 +817,16 @@ async def test_create_product_set_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_product_set_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -825,7 +858,9 @@ def test_create_product_set_flattened(): def test_create_product_set_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -895,11 +930,16 @@ async def test_create_product_set_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [product_search_service.ListProductSetsRequest, dict,] + "request_type", + [ + product_search_service.ListProductSetsRequest, + dict, + ], ) def test_list_product_sets(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -930,7 +970,8 @@ def test_list_product_sets_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -949,7 +990,8 @@ async def test_list_product_sets_async( request_type=product_search_service.ListProductSetsRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -984,13 +1026,15 @@ async def test_list_product_sets_async_from_dict(): def test_list_product_sets_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.ListProductSetsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1006,7 +1050,10 @@ def test_list_product_sets_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1019,7 +1066,7 @@ async def test_list_product_sets_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.ListProductSetsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1037,11 +1084,16 @@ async def test_list_product_sets_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_product_sets_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1051,7 +1103,9 @@ def test_list_product_sets_flattened(): call.return_value = product_search_service.ListProductSetsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_product_sets(parent="parent_value",) + client.list_product_sets( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1063,13 +1117,16 @@ def test_list_product_sets_flattened(): def test_list_product_sets_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_product_sets( - product_search_service.ListProductSetsRequest(), parent="parent_value", + product_search_service.ListProductSetsRequest(), + parent="parent_value", ) @@ -1091,7 +1148,9 @@ async def test_list_product_sets_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_product_sets(parent="parent_value",) + response = await client.list_product_sets( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1112,13 +1171,15 @@ async def test_list_product_sets_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_product_sets( - product_search_service.ListProductSetsRequest(), parent="parent_value", + product_search_service.ListProductSetsRequest(), + parent="parent_value", ) def test_list_product_sets_pager(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1136,10 +1197,13 @@ def test_list_product_sets_pager(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListProductSetsResponse( - product_sets=[], next_page_token="def", + product_sets=[], + next_page_token="def", ), product_search_service.ListProductSetsResponse( - product_sets=[product_search_service.ProductSet(),], + product_sets=[ + product_search_service.ProductSet(), + ], next_page_token="ghi", ), product_search_service.ListProductSetsResponse( @@ -1159,14 +1223,15 @@ def test_list_product_sets_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, product_search_service.ProductSet) for i in results) def test_list_product_sets_pages(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1184,10 +1249,13 @@ def test_list_product_sets_pages(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListProductSetsResponse( - product_sets=[], next_page_token="def", + product_sets=[], + next_page_token="def", ), product_search_service.ListProductSetsResponse( - product_sets=[product_search_service.ProductSet(),], + product_sets=[ + product_search_service.ProductSet(), + ], next_page_token="ghi", ), product_search_service.ListProductSetsResponse( @@ -1205,7 +1273,9 @@ def test_list_product_sets_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_product_sets_async_pager(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1224,10 +1294,13 @@ async def test_list_product_sets_async_pager(): next_page_token="abc", ), product_search_service.ListProductSetsResponse( - product_sets=[], next_page_token="def", + product_sets=[], + next_page_token="def", ), product_search_service.ListProductSetsResponse( - product_sets=[product_search_service.ProductSet(),], + product_sets=[ + product_search_service.ProductSet(), + ], next_page_token="ghi", ), product_search_service.ListProductSetsResponse( @@ -1238,10 +1311,12 @@ async def test_list_product_sets_async_pager(): ), RuntimeError, ) - async_pager = await client.list_product_sets(request={},) + async_pager = await client.list_product_sets( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1250,7 +1325,9 @@ async def test_list_product_sets_async_pager(): @pytest.mark.asyncio async def test_list_product_sets_async_pages(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1269,10 +1346,13 @@ async def test_list_product_sets_async_pages(): next_page_token="abc", ), product_search_service.ListProductSetsResponse( - product_sets=[], next_page_token="def", + product_sets=[], + next_page_token="def", ), product_search_service.ListProductSetsResponse( - product_sets=[product_search_service.ProductSet(),], + product_sets=[ + product_search_service.ProductSet(), + ], next_page_token="ghi", ), product_search_service.ListProductSetsResponse( @@ -1284,18 +1364,25 @@ async def test_list_product_sets_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_product_sets(request={})).pages: + async for page_ in ( + await client.list_product_sets(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [product_search_service.GetProductSetRequest, dict,] + "request_type", + [ + product_search_service.GetProductSetRequest, + dict, + ], ) def test_get_product_set(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1306,7 +1393,8 @@ def test_get_product_set(request_type, transport: str = "grpc"): with mock.patch.object(type(client.transport.get_product_set), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = product_search_service.ProductSet( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) response = client.get_product_set(request) @@ -1325,7 +1413,8 @@ def test_get_product_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1342,7 +1431,8 @@ async def test_get_product_set_async( request_type=product_search_service.GetProductSetRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1354,7 +1444,8 @@ async def test_get_product_set_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( product_search_service.ProductSet( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) ) response = await client.get_product_set(request) @@ -1376,13 +1467,15 @@ async def test_get_product_set_async_from_dict(): def test_get_product_set_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.GetProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_product_set), "__call__") as call: @@ -1396,7 +1489,10 @@ def test_get_product_set_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1409,7 +1505,7 @@ async def test_get_product_set_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.GetProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_product_set), "__call__") as call: @@ -1425,11 +1521,16 @@ async def test_get_product_set_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_product_set_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_product_set), "__call__") as call: @@ -1437,7 +1538,9 @@ def test_get_product_set_flattened(): call.return_value = product_search_service.ProductSet() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_product_set(name="name_value",) + client.get_product_set( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1449,13 +1552,16 @@ def test_get_product_set_flattened(): def test_get_product_set_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_product_set( - product_search_service.GetProductSetRequest(), name="name_value", + product_search_service.GetProductSetRequest(), + name="name_value", ) @@ -1475,7 +1581,9 @@ async def test_get_product_set_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_product_set(name="name_value",) + response = await client.get_product_set( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1496,16 +1604,22 @@ async def test_get_product_set_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_product_set( - product_search_service.GetProductSetRequest(), name="name_value", + product_search_service.GetProductSetRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [product_search_service.UpdateProductSetRequest, dict,] + "request_type", + [ + product_search_service.UpdateProductSetRequest, + dict, + ], ) def test_update_product_set(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1518,7 +1632,8 @@ def test_update_product_set(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = product_search_service.ProductSet( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) response = client.update_product_set(request) @@ -1537,7 +1652,8 @@ def test_update_product_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1556,7 +1672,8 @@ async def test_update_product_set_async( request_type=product_search_service.UpdateProductSetRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1570,7 +1687,8 @@ async def test_update_product_set_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( product_search_service.ProductSet( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) ) response = await client.update_product_set(request) @@ -1592,13 +1710,15 @@ async def test_update_product_set_async_from_dict(): def test_update_product_set_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.UpdateProductSetRequest() - request.product_set.name = "product_set.name/value" + request.product_set.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1614,9 +1734,10 @@ def test_update_product_set_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "product_set.name=product_set.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "product_set.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1629,7 +1750,7 @@ async def test_update_product_set_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.UpdateProductSetRequest() - request.product_set.name = "product_set.name/value" + request.product_set.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1647,13 +1768,16 @@ async def test_update_product_set_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "product_set.name=product_set.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "product_set.name=name_value", + ) in kw["metadata"] def test_update_product_set_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1681,7 +1805,9 @@ def test_update_product_set_flattened(): def test_update_product_set_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1745,11 +1871,16 @@ async def test_update_product_set_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [product_search_service.DeleteProductSetRequest, dict,] + "request_type", + [ + product_search_service.DeleteProductSetRequest, + dict, + ], ) def test_delete_product_set(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1777,7 +1908,8 @@ def test_delete_product_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1796,7 +1928,8 @@ async def test_delete_product_set_async( request_type=product_search_service.DeleteProductSetRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1826,13 +1959,15 @@ async def test_delete_product_set_async_from_dict(): def test_delete_product_set_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.DeleteProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1848,7 +1983,10 @@ def test_delete_product_set_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1861,7 +1999,7 @@ async def test_delete_product_set_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.DeleteProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1877,11 +2015,16 @@ async def test_delete_product_set_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_product_set_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1891,7 +2034,9 @@ def test_delete_product_set_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_product_set(name="name_value",) + client.delete_product_set( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1903,13 +2048,16 @@ def test_delete_product_set_flattened(): def test_delete_product_set_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_product_set( - product_search_service.DeleteProductSetRequest(), name="name_value", + product_search_service.DeleteProductSetRequest(), + name="name_value", ) @@ -1929,7 +2077,9 @@ async def test_delete_product_set_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_product_set(name="name_value",) + response = await client.delete_product_set( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1950,16 +2100,22 @@ async def test_delete_product_set_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_product_set( - product_search_service.DeleteProductSetRequest(), name="name_value", + product_search_service.DeleteProductSetRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [product_search_service.CreateProductRequest, dict,] + "request_type", + [ + product_search_service.CreateProductRequest, + dict, + ], ) def test_create_product(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1994,7 +2150,8 @@ def test_create_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2011,7 +2168,8 @@ async def test_create_product_async( request_type=product_search_service.CreateProductRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2050,13 +2208,15 @@ async def test_create_product_async_from_dict(): def test_create_product_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.CreateProductRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_product), "__call__") as call: @@ -2070,7 +2230,10 @@ def test_create_product_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2083,7 +2246,7 @@ async def test_create_product_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.CreateProductRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_product), "__call__") as call: @@ -2099,11 +2262,16 @@ async def test_create_product_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_product_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_product), "__call__") as call: @@ -2133,7 +2301,9 @@ def test_create_product_flattened(): def test_create_product_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2201,11 +2371,16 @@ async def test_create_product_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [product_search_service.ListProductsRequest, dict,] + "request_type", + [ + product_search_service.ListProductsRequest, + dict, + ], ) def test_list_products(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2234,7 +2409,8 @@ def test_list_products_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2251,7 +2427,8 @@ async def test_list_products_async( request_type=product_search_service.ListProductsRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2284,13 +2461,15 @@ async def test_list_products_async_from_dict(): def test_list_products_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.ListProductsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_products), "__call__") as call: @@ -2304,7 +2483,10 @@ def test_list_products_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2317,7 +2499,7 @@ async def test_list_products_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.ListProductsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_products), "__call__") as call: @@ -2333,11 +2515,16 @@ async def test_list_products_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_products_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_products), "__call__") as call: @@ -2345,7 +2532,9 @@ def test_list_products_flattened(): call.return_value = product_search_service.ListProductsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_products(parent="parent_value",) + client.list_products( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2357,13 +2546,16 @@ def test_list_products_flattened(): def test_list_products_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_products( - product_search_service.ListProductsRequest(), parent="parent_value", + product_search_service.ListProductsRequest(), + parent="parent_value", ) @@ -2383,7 +2575,9 @@ async def test_list_products_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_products(parent="parent_value",) + response = await client.list_products( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2404,13 +2598,15 @@ async def test_list_products_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_products( - product_search_service.ListProductsRequest(), parent="parent_value", + product_search_service.ListProductsRequest(), + parent="parent_value", ) def test_list_products_pager(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2426,10 +2622,14 @@ def test_list_products_pager(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListProductsResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsResponse( products=[ @@ -2448,14 +2648,15 @@ def test_list_products_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, product_search_service.Product) for i in results) def test_list_products_pages(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2471,10 +2672,14 @@ def test_list_products_pages(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListProductsResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsResponse( products=[ @@ -2491,7 +2696,9 @@ def test_list_products_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_products_async_pager(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2508,10 +2715,14 @@ async def test_list_products_async_pager(): next_page_token="abc", ), product_search_service.ListProductsResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsResponse( products=[ @@ -2521,10 +2732,12 @@ async def test_list_products_async_pager(): ), RuntimeError, ) - async_pager = await client.list_products(request={},) + async_pager = await client.list_products( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -2533,7 +2746,9 @@ async def test_list_products_async_pager(): @pytest.mark.asyncio async def test_list_products_async_pages(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2550,10 +2765,14 @@ async def test_list_products_async_pages(): next_page_token="abc", ), product_search_service.ListProductsResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsResponse( products=[ @@ -2564,18 +2783,25 @@ async def test_list_products_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_products(request={})).pages: + async for page_ in ( + await client.list_products(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [product_search_service.GetProductRequest, dict,] + "request_type", + [ + product_search_service.GetProductRequest, + dict, + ], ) def test_get_product(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2610,7 +2836,8 @@ def test_get_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2627,7 +2854,8 @@ async def test_get_product_async( request_type=product_search_service.GetProductRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2666,13 +2894,15 @@ async def test_get_product_async_from_dict(): def test_get_product_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.GetProductRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_product), "__call__") as call: @@ -2686,7 +2916,10 @@ def test_get_product_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2699,7 +2932,7 @@ async def test_get_product_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.GetProductRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_product), "__call__") as call: @@ -2715,11 +2948,16 @@ async def test_get_product_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_product_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_product), "__call__") as call: @@ -2727,7 +2965,9 @@ def test_get_product_flattened(): call.return_value = product_search_service.Product() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_product(name="name_value",) + client.get_product( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2739,13 +2979,16 @@ def test_get_product_flattened(): def test_get_product_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_product( - product_search_service.GetProductRequest(), name="name_value", + product_search_service.GetProductRequest(), + name="name_value", ) @@ -2765,7 +3008,9 @@ async def test_get_product_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_product(name="name_value",) + response = await client.get_product( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2786,16 +3031,22 @@ async def test_get_product_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_product( - product_search_service.GetProductRequest(), name="name_value", + product_search_service.GetProductRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [product_search_service.UpdateProductRequest, dict,] + "request_type", + [ + product_search_service.UpdateProductRequest, + dict, + ], ) def test_update_product(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2830,7 +3081,8 @@ def test_update_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2847,7 +3099,8 @@ async def test_update_product_async( request_type=product_search_service.UpdateProductRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2886,13 +3139,15 @@ async def test_update_product_async_from_dict(): def test_update_product_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.UpdateProductRequest() - request.product.name = "product.name/value" + request.product.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_product), "__call__") as call: @@ -2906,9 +3161,10 @@ def test_update_product_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "product.name=product.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "product.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2921,7 +3177,7 @@ async def test_update_product_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.UpdateProductRequest() - request.product.name = "product.name/value" + request.product.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_product), "__call__") as call: @@ -2937,13 +3193,16 @@ async def test_update_product_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "product.name=product.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "product.name=name_value", + ) in kw["metadata"] def test_update_product_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_product), "__call__") as call: @@ -2969,7 +3228,9 @@ def test_update_product_flattened(): def test_update_product_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3031,11 +3292,16 @@ async def test_update_product_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [product_search_service.DeleteProductRequest, dict,] + "request_type", + [ + product_search_service.DeleteProductRequest, + dict, + ], ) def test_delete_product(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3061,7 +3327,8 @@ def test_delete_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3078,7 +3345,8 @@ async def test_delete_product_async( request_type=product_search_service.DeleteProductRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3106,13 +3374,15 @@ async def test_delete_product_async_from_dict(): def test_delete_product_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.DeleteProductRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_product), "__call__") as call: @@ -3126,7 +3396,10 @@ def test_delete_product_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3139,7 +3412,7 @@ async def test_delete_product_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.DeleteProductRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_product), "__call__") as call: @@ -3153,11 +3426,16 @@ async def test_delete_product_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_product_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_product), "__call__") as call: @@ -3165,8 +3443,10 @@ def test_delete_product_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_product(name="name_value",) - + client.delete_product( + name="name_value", + ) + # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 @@ -3177,13 +3457,16 @@ def test_delete_product_flattened(): def test_delete_product_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_product( - product_search_service.DeleteProductRequest(), name="name_value", + product_search_service.DeleteProductRequest(), + name="name_value", ) @@ -3201,7 +3484,9 @@ async def test_delete_product_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_product(name="name_value",) + response = await client.delete_product( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3222,16 +3507,22 @@ async def test_delete_product_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_product( - product_search_service.DeleteProductRequest(), name="name_value", + product_search_service.DeleteProductRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [product_search_service.CreateReferenceImageRequest, dict,] + "request_type", + [ + product_search_service.CreateReferenceImageRequest, + dict, + ], ) def test_create_reference_image(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3244,7 +3535,8 @@ def test_create_reference_image(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = product_search_service.ReferenceImage( - name="name_value", uri="uri_value", + name="name_value", + uri="uri_value", ) response = client.create_reference_image(request) @@ -3263,7 +3555,8 @@ def test_create_reference_image_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3282,7 +3575,8 @@ async def test_create_reference_image_async( request_type=product_search_service.CreateReferenceImageRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3295,7 +3589,10 @@ async def test_create_reference_image_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - product_search_service.ReferenceImage(name="name_value", uri="uri_value",) + product_search_service.ReferenceImage( + name="name_value", + uri="uri_value", + ) ) response = await client.create_reference_image(request) @@ -3316,13 +3613,15 @@ async def test_create_reference_image_async_from_dict(): def test_create_reference_image_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.CreateReferenceImageRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3338,7 +3637,10 @@ def test_create_reference_image_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3351,7 +3653,7 @@ async def test_create_reference_image_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.CreateReferenceImageRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3369,11 +3671,16 @@ async def test_create_reference_image_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_reference_image_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3405,7 +3712,9 @@ def test_create_reference_image_flattened(): def test_create_reference_image_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3475,11 +3784,16 @@ async def test_create_reference_image_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [product_search_service.DeleteReferenceImageRequest, dict,] + "request_type", + [ + product_search_service.DeleteReferenceImageRequest, + dict, + ], ) def test_delete_reference_image(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3507,7 +3821,8 @@ def test_delete_reference_image_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3526,7 +3841,8 @@ async def test_delete_reference_image_async( request_type=product_search_service.DeleteReferenceImageRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3556,13 +3872,15 @@ async def test_delete_reference_image_async_from_dict(): def test_delete_reference_image_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.DeleteReferenceImageRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3578,7 +3896,10 @@ def test_delete_reference_image_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3591,7 +3912,7 @@ async def test_delete_reference_image_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.DeleteReferenceImageRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3607,11 +3928,16 @@ async def test_delete_reference_image_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_reference_image_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3621,7 +3947,9 @@ def test_delete_reference_image_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_reference_image(name="name_value",) + client.delete_reference_image( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3633,13 +3961,16 @@ def test_delete_reference_image_flattened(): def test_delete_reference_image_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_reference_image( - product_search_service.DeleteReferenceImageRequest(), name="name_value", + product_search_service.DeleteReferenceImageRequest(), + name="name_value", ) @@ -3659,7 +3990,9 @@ async def test_delete_reference_image_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_reference_image(name="name_value",) + response = await client.delete_reference_image( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3680,16 +4013,22 @@ async def test_delete_reference_image_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_reference_image( - product_search_service.DeleteReferenceImageRequest(), name="name_value", + product_search_service.DeleteReferenceImageRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [product_search_service.ListReferenceImagesRequest, dict,] + "request_type", + [ + product_search_service.ListReferenceImagesRequest, + dict, + ], ) def test_list_reference_images(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3702,7 +4041,8 @@ def test_list_reference_images(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = product_search_service.ListReferenceImagesResponse( - page_size=951, next_page_token="next_page_token_value", + page_size=951, + next_page_token="next_page_token_value", ) response = client.list_reference_images(request) @@ -3721,7 +4061,8 @@ def test_list_reference_images_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3740,7 +4081,8 @@ async def test_list_reference_images_async( request_type=product_search_service.ListReferenceImagesRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3754,7 +4096,8 @@ async def test_list_reference_images_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( product_search_service.ListReferenceImagesResponse( - page_size=951, next_page_token="next_page_token_value", + page_size=951, + next_page_token="next_page_token_value", ) ) response = await client.list_reference_images(request) @@ -3776,13 +4119,15 @@ async def test_list_reference_images_async_from_dict(): def test_list_reference_images_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.ListReferenceImagesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3798,7 +4143,10 @@ def test_list_reference_images_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3811,7 +4159,7 @@ async def test_list_reference_images_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.ListReferenceImagesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3829,11 +4177,16 @@ async def test_list_reference_images_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_reference_images_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3843,7 +4196,9 @@ def test_list_reference_images_flattened(): call.return_value = product_search_service.ListReferenceImagesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_reference_images(parent="parent_value",) + client.list_reference_images( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3855,13 +4210,16 @@ def test_list_reference_images_flattened(): def test_list_reference_images_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_reference_images( - product_search_service.ListReferenceImagesRequest(), parent="parent_value", + product_search_service.ListReferenceImagesRequest(), + parent="parent_value", ) @@ -3883,7 +4241,9 @@ async def test_list_reference_images_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_reference_images(parent="parent_value",) + response = await client.list_reference_images( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3904,13 +4264,15 @@ async def test_list_reference_images_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_reference_images( - product_search_service.ListReferenceImagesRequest(), parent="parent_value", + product_search_service.ListReferenceImagesRequest(), + parent="parent_value", ) def test_list_reference_images_pager(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3928,10 +4290,13 @@ def test_list_reference_images_pager(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListReferenceImagesResponse( - reference_images=[], next_page_token="def", + reference_images=[], + next_page_token="def", ), product_search_service.ListReferenceImagesResponse( - reference_images=[product_search_service.ReferenceImage(),], + reference_images=[ + product_search_service.ReferenceImage(), + ], next_page_token="ghi", ), product_search_service.ListReferenceImagesResponse( @@ -3951,7 +4316,7 @@ def test_list_reference_images_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all( isinstance(i, product_search_service.ReferenceImage) for i in results @@ -3960,7 +4325,8 @@ def test_list_reference_images_pager(transport_name: str = "grpc"): def test_list_reference_images_pages(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3978,10 +4344,13 @@ def test_list_reference_images_pages(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListReferenceImagesResponse( - reference_images=[], next_page_token="def", + reference_images=[], + next_page_token="def", ), product_search_service.ListReferenceImagesResponse( - reference_images=[product_search_service.ReferenceImage(),], + reference_images=[ + product_search_service.ReferenceImage(), + ], next_page_token="ghi", ), product_search_service.ListReferenceImagesResponse( @@ -3999,7 +4368,9 @@ def test_list_reference_images_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_reference_images_async_pager(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4018,10 +4389,13 @@ async def test_list_reference_images_async_pager(): next_page_token="abc", ), product_search_service.ListReferenceImagesResponse( - reference_images=[], next_page_token="def", + reference_images=[], + next_page_token="def", ), product_search_service.ListReferenceImagesResponse( - reference_images=[product_search_service.ReferenceImage(),], + reference_images=[ + product_search_service.ReferenceImage(), + ], next_page_token="ghi", ), product_search_service.ListReferenceImagesResponse( @@ -4032,10 +4406,12 @@ async def test_list_reference_images_async_pager(): ), RuntimeError, ) - async_pager = await client.list_reference_images(request={},) + async_pager = await client.list_reference_images( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -4046,7 +4422,9 @@ async def test_list_reference_images_async_pager(): @pytest.mark.asyncio async def test_list_reference_images_async_pages(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4065,10 +4443,13 @@ async def test_list_reference_images_async_pages(): next_page_token="abc", ), product_search_service.ListReferenceImagesResponse( - reference_images=[], next_page_token="def", + reference_images=[], + next_page_token="def", ), product_search_service.ListReferenceImagesResponse( - reference_images=[product_search_service.ReferenceImage(),], + reference_images=[ + product_search_service.ReferenceImage(), + ], next_page_token="ghi", ), product_search_service.ListReferenceImagesResponse( @@ -4080,18 +4461,25 @@ async def test_list_reference_images_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_reference_images(request={})).pages: + async for page_ in ( + await client.list_reference_images(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [product_search_service.GetReferenceImageRequest, dict,] + "request_type", + [ + product_search_service.GetReferenceImageRequest, + dict, + ], ) def test_get_reference_image(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4104,7 +4492,8 @@ def test_get_reference_image(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = product_search_service.ReferenceImage( - name="name_value", uri="uri_value", + name="name_value", + uri="uri_value", ) response = client.get_reference_image(request) @@ -4123,7 +4512,8 @@ def test_get_reference_image_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4142,7 +4532,8 @@ async def test_get_reference_image_async( request_type=product_search_service.GetReferenceImageRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4155,7 +4546,10 @@ async def test_get_reference_image_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - product_search_service.ReferenceImage(name="name_value", uri="uri_value",) + product_search_service.ReferenceImage( + name="name_value", + uri="uri_value", + ) ) response = await client.get_reference_image(request) @@ -4176,13 +4570,15 @@ async def test_get_reference_image_async_from_dict(): def test_get_reference_image_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.GetReferenceImageRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4198,7 +4594,10 @@ def test_get_reference_image_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4211,7 +4610,7 @@ async def test_get_reference_image_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.GetReferenceImageRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4229,11 +4628,16 @@ async def test_get_reference_image_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_reference_image_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4243,7 +4647,9 @@ def test_get_reference_image_flattened(): call.return_value = product_search_service.ReferenceImage() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_reference_image(name="name_value",) + client.get_reference_image( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4255,13 +4661,16 @@ def test_get_reference_image_flattened(): def test_get_reference_image_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_reference_image( - product_search_service.GetReferenceImageRequest(), name="name_value", + product_search_service.GetReferenceImageRequest(), + name="name_value", ) @@ -4283,7 +4692,9 @@ async def test_get_reference_image_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_reference_image(name="name_value",) + response = await client.get_reference_image( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4304,16 +4715,22 @@ async def test_get_reference_image_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_reference_image( - product_search_service.GetReferenceImageRequest(), name="name_value", + product_search_service.GetReferenceImageRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [product_search_service.AddProductToProductSetRequest, dict,] + "request_type", + [ + product_search_service.AddProductToProductSetRequest, + dict, + ], ) def test_add_product_to_product_set(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4341,7 +4758,8 @@ def test_add_product_to_product_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4360,7 +4778,8 @@ async def test_add_product_to_product_set_async( request_type=product_search_service.AddProductToProductSetRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4390,13 +4809,15 @@ async def test_add_product_to_product_set_async_from_dict(): def test_add_product_to_product_set_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.AddProductToProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4412,7 +4833,10 @@ def test_add_product_to_product_set_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4425,7 +4849,7 @@ async def test_add_product_to_product_set_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.AddProductToProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4441,11 +4865,16 @@ async def test_add_product_to_product_set_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_add_product_to_product_set_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4456,7 +4885,8 @@ def test_add_product_to_product_set_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.add_product_to_product_set( - name="name_value", product="product_value", + name="name_value", + product="product_value", ) # Establish that the underlying call was made with the expected @@ -4472,7 +4902,9 @@ def test_add_product_to_product_set_flattened(): def test_add_product_to_product_set_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4501,7 +4933,8 @@ async def test_add_product_to_product_set_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.add_product_to_product_set( - name="name_value", product="product_value", + name="name_value", + product="product_value", ) # Establish that the underlying call was made with the expected @@ -4533,11 +4966,16 @@ async def test_add_product_to_product_set_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [product_search_service.RemoveProductFromProductSetRequest, dict,] + "request_type", + [ + product_search_service.RemoveProductFromProductSetRequest, + dict, + ], ) def test_remove_product_from_product_set(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4565,7 +5003,8 @@ def test_remove_product_from_product_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4584,7 +5023,8 @@ async def test_remove_product_from_product_set_async( request_type=product_search_service.RemoveProductFromProductSetRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4614,13 +5054,15 @@ async def test_remove_product_from_product_set_async_from_dict(): def test_remove_product_from_product_set_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.RemoveProductFromProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4636,7 +5078,10 @@ def test_remove_product_from_product_set_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4649,7 +5094,7 @@ async def test_remove_product_from_product_set_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.RemoveProductFromProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4665,11 +5110,16 @@ async def test_remove_product_from_product_set_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_remove_product_from_product_set_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4680,7 +5130,8 @@ def test_remove_product_from_product_set_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.remove_product_from_product_set( - name="name_value", product="product_value", + name="name_value", + product="product_value", ) # Establish that the underlying call was made with the expected @@ -4696,7 +5147,9 @@ def test_remove_product_from_product_set_flattened(): def test_remove_product_from_product_set_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4725,7 +5178,8 @@ async def test_remove_product_from_product_set_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.remove_product_from_product_set( - name="name_value", product="product_value", + name="name_value", + product="product_value", ) # Establish that the underlying call was made with the expected @@ -4757,11 +5211,16 @@ async def test_remove_product_from_product_set_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [product_search_service.ListProductsInProductSetRequest, dict,] + "request_type", + [ + product_search_service.ListProductsInProductSetRequest, + dict, + ], ) def test_list_products_in_product_set(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4792,7 +5251,8 @@ def test_list_products_in_product_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4811,7 +5271,8 @@ async def test_list_products_in_product_set_async( request_type=product_search_service.ListProductsInProductSetRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4846,13 +5307,15 @@ async def test_list_products_in_product_set_async_from_dict(): def test_list_products_in_product_set_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.ListProductsInProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4868,7 +5331,10 @@ def test_list_products_in_product_set_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4881,7 +5347,7 @@ async def test_list_products_in_product_set_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.ListProductsInProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4899,11 +5365,16 @@ async def test_list_products_in_product_set_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_list_products_in_product_set_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4913,7 +5384,9 @@ def test_list_products_in_product_set_flattened(): call.return_value = product_search_service.ListProductsInProductSetResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_products_in_product_set(name="name_value",) + client.list_products_in_product_set( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4925,13 +5398,16 @@ def test_list_products_in_product_set_flattened(): def test_list_products_in_product_set_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_products_in_product_set( - product_search_service.ListProductsInProductSetRequest(), name="name_value", + product_search_service.ListProductsInProductSetRequest(), + name="name_value", ) @@ -4953,7 +5429,9 @@ async def test_list_products_in_product_set_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_products_in_product_set(name="name_value",) + response = await client.list_products_in_product_set( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4974,13 +5452,15 @@ async def test_list_products_in_product_set_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_products_in_product_set( - product_search_service.ListProductsInProductSetRequest(), name="name_value", + product_search_service.ListProductsInProductSetRequest(), + name="name_value", ) def test_list_products_in_product_set_pager(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4998,10 +5478,14 @@ def test_list_products_in_product_set_pager(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListProductsInProductSetResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsInProductSetResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsInProductSetResponse( products=[ @@ -5020,14 +5504,15 @@ def test_list_products_in_product_set_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, product_search_service.Product) for i in results) def test_list_products_in_product_set_pages(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5045,10 +5530,14 @@ def test_list_products_in_product_set_pages(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListProductsInProductSetResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsInProductSetResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsInProductSetResponse( products=[ @@ -5065,7 +5554,9 @@ def test_list_products_in_product_set_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_products_in_product_set_async_pager(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5084,10 +5575,14 @@ async def test_list_products_in_product_set_async_pager(): next_page_token="abc", ), product_search_service.ListProductsInProductSetResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsInProductSetResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsInProductSetResponse( products=[ @@ -5097,10 +5592,12 @@ async def test_list_products_in_product_set_async_pager(): ), RuntimeError, ) - async_pager = await client.list_products_in_product_set(request={},) + async_pager = await client.list_products_in_product_set( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -5109,7 +5606,9 @@ async def test_list_products_in_product_set_async_pager(): @pytest.mark.asyncio async def test_list_products_in_product_set_async_pages(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5128,10 +5627,14 @@ async def test_list_products_in_product_set_async_pages(): next_page_token="abc", ), product_search_service.ListProductsInProductSetResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsInProductSetResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsInProductSetResponse( products=[ @@ -5144,18 +5647,23 @@ async def test_list_products_in_product_set_async_pages(): pages = [] async for page_ in ( await client.list_products_in_product_set(request={}) - ).pages: + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [product_search_service.ImportProductSetsRequest, dict,] + "request_type", + [ + product_search_service.ImportProductSetsRequest, + dict, + ], ) def test_import_product_sets(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5183,7 +5691,8 @@ def test_import_product_sets_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5202,7 +5711,8 @@ async def test_import_product_sets_async( request_type=product_search_service.ImportProductSetsRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5234,13 +5744,15 @@ async def test_import_product_sets_async_from_dict(): def test_import_product_sets_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.ImportProductSetsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5256,7 +5768,10 @@ def test_import_product_sets_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -5269,7 +5784,7 @@ async def test_import_product_sets_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.ImportProductSetsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5287,11 +5802,16 @@ async def test_import_product_sets_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_import_product_sets_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5327,7 +5847,9 @@ def test_import_product_sets_flattened(): def test_import_product_sets_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -5407,11 +5929,16 @@ async def test_import_product_sets_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [product_search_service.PurgeProductsRequest, dict,] + "request_type", + [ + product_search_service.PurgeProductsRequest, + dict, + ], ) def test_purge_products(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5437,7 +5964,8 @@ def test_purge_products_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5454,7 +5982,8 @@ async def test_purge_products_async( request_type=product_search_service.PurgeProductsRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5484,13 +6013,15 @@ async def test_purge_products_async_from_dict(): def test_purge_products_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.PurgeProductsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.purge_products), "__call__") as call: @@ -5504,7 +6035,10 @@ def test_purge_products_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -5517,7 +6051,7 @@ async def test_purge_products_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.PurgeProductsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.purge_products), "__call__") as call: @@ -5533,11 +6067,16 @@ async def test_purge_products_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_purge_products_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.purge_products), "__call__") as call: @@ -5545,7 +6084,9 @@ def test_purge_products_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.purge_products(parent="parent_value",) + client.purge_products( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5557,13 +6098,16 @@ def test_purge_products_flattened(): def test_purge_products_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.purge_products( - product_search_service.PurgeProductsRequest(), parent="parent_value", + product_search_service.PurgeProductsRequest(), + parent="parent_value", ) @@ -5583,7 +6127,9 @@ async def test_purge_products_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.purge_products(parent="parent_value",) + response = await client.purge_products( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5604,7 +6150,8 @@ async def test_purge_products_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.purge_products( - product_search_service.PurgeProductsRequest(), parent="parent_value", + product_search_service.PurgeProductsRequest(), + parent="parent_value", ) @@ -5615,7 +6162,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -5635,7 +6183,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ProductSearchClient(client_options=options, transport=transport,) + client = ProductSearchClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -5651,7 +6202,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ProductSearchClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -5694,10 +6246,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = ProductSearchClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.ProductSearchGrpcTransport,) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.ProductSearchGrpcTransport, + ) def test_product_search_base_transport_error(): @@ -5754,6 +6324,14 @@ def test_product_search_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_product_search_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -5765,7 +6343,8 @@ def test_product_search_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ProductSearchTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -5910,24 +6489,40 @@ def test_product_search_grpc_transport_client_cert_source_for_mtls(transport_cla ) -def test_product_search_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_product_search_host_no_port(transport_name): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="vision.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") -def test_product_search_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_product_search_host_with_port(transport_name): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="vision.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "vision.googleapis.com:8000" + assert client.transport._host == ("vision.googleapis.com:8000") def test_product_search_grpc_transport_channel(): @@ -5935,7 +6530,8 @@ def test_product_search_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.ProductSearchGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -5947,7 +6543,8 @@ def test_product_search_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.ProductSearchGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -6054,12 +6651,16 @@ def test_product_search_transport_channel_mtls_with_adc(transport_class): def test_product_search_grpc_lro_client(): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -6067,12 +6668,16 @@ def test_product_search_grpc_lro_client(): def test_product_search_grpc_lro_async_client(): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -6083,7 +6688,9 @@ def test_product_path(): location = "clam" product = "whelk" expected = "projects/{project}/locations/{location}/products/{product}".format( - project=project, location=location, product=product, + project=project, + location=location, + product=product, ) actual = ProductSearchClient.product_path(project, location, product) assert expected == actual @@ -6106,8 +6713,12 @@ def test_product_set_path(): project = "cuttlefish" location = "mussel" product_set = "winkle" - expected = "projects/{project}/locations/{location}/productSets/{product_set}".format( - project=project, location=location, product_set=product_set, + expected = ( + "projects/{project}/locations/{location}/productSets/{product_set}".format( + project=project, + location=location, + product_set=product_set, + ) ) actual = ProductSearchClient.product_set_path(project, location, product_set) assert expected == actual @@ -6179,7 +6790,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "scallop" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ProductSearchClient.common_folder_path(folder) assert expected == actual @@ -6197,7 +6810,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "squid" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ProductSearchClient.common_organization_path(organization) assert expected == actual @@ -6215,7 +6830,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "whelk" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ProductSearchClient.common_project_path(project) assert expected == actual @@ -6235,7 +6852,8 @@ def test_common_location_path(): project = "oyster" location = "nudibranch" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ProductSearchClient.common_location_path(project, location) assert expected == actual @@ -6260,7 +6878,8 @@ def test_client_with_default_client_info(): transports.ProductSearchTransport, "_prep_wrapped_messages" ) as prep: client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6269,7 +6888,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ProductSearchClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6277,7 +6897,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.py b/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.py index ef8fe094..b9b5ee27 100644 --- a/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1p1beta1/test_image_annotator.py @@ -87,20 +87,24 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] + "client_class,transport_name", + [ + (ImageAnnotatorClient, "grpc"), + (ImageAnnotatorAsyncClient, "grpc_asyncio"), + ], ) -def test_image_annotator_client_from_service_account_info(client_class): +def test_image_annotator_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") @pytest.mark.parametrize( @@ -129,23 +133,31 @@ def test_image_annotator_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] + "client_class,transport_name", + [ + (ImageAnnotatorClient, "grpc"), + (ImageAnnotatorAsyncClient, "grpc_asyncio"), + ], ) -def test_image_annotator_client_from_service_account_file(client_class): +def test_image_annotator_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") def test_image_annotator_client_get_transport_class(): @@ -493,7 +505,9 @@ def test_image_annotator_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -637,11 +651,16 @@ def test_image_annotator_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [image_annotator.BatchAnnotateImagesRequest, dict,] + "request_type", + [ + image_annotator.BatchAnnotateImagesRequest, + dict, + ], ) def test_batch_annotate_images(request_type, transport: str = "grpc"): client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -669,7 +688,8 @@ def test_batch_annotate_images_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -688,7 +708,8 @@ async def test_batch_annotate_images_async( request_type=image_annotator.BatchAnnotateImagesRequest, ): client = ImageAnnotatorAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -720,7 +741,9 @@ async def test_batch_annotate_images_async_from_dict(): def test_batch_annotate_images_flattened(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -752,7 +775,9 @@ def test_batch_annotate_images_flattened(): def test_batch_annotate_images_flattened_error(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -832,7 +857,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -852,7 +878,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ImageAnnotatorClient(client_options=options, transport=transport,) + client = ImageAnnotatorClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -868,7 +897,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ImageAnnotatorClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -911,10 +941,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = ImageAnnotatorClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.ImageAnnotatorGrpcTransport,) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.ImageAnnotatorGrpcTransport, + ) def test_image_annotator_base_transport_error(): @@ -946,6 +994,14 @@ def test_image_annotator_base_transport(): with pytest.raises(NotImplementedError): transport.close() + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_image_annotator_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -957,7 +1013,8 @@ def test_image_annotator_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ImageAnnotatorTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1102,24 +1159,40 @@ def test_image_annotator_grpc_transport_client_cert_source_for_mtls(transport_cl ) -def test_image_annotator_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_image_annotator_host_no_port(transport_name): client = ImageAnnotatorClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="vision.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") -def test_image_annotator_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_image_annotator_host_with_port(transport_name): client = ImageAnnotatorClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="vision.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "vision.googleapis.com:8000" + assert client.transport._host == ("vision.googleapis.com:8000") def test_image_annotator_grpc_transport_channel(): @@ -1127,7 +1200,8 @@ def test_image_annotator_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1139,7 +1213,8 @@ def test_image_annotator_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1268,7 +1343,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ImageAnnotatorClient.common_folder_path(folder) assert expected == actual @@ -1286,7 +1363,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ImageAnnotatorClient.common_organization_path(organization) assert expected == actual @@ -1304,7 +1383,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ImageAnnotatorClient.common_project_path(project) assert expected == actual @@ -1324,7 +1405,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ImageAnnotatorClient.common_location_path(project, location) assert expected == actual @@ -1349,7 +1431,8 @@ def test_client_with_default_client_info(): transports.ImageAnnotatorTransport, "_prep_wrapped_messages" ) as prep: client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1358,7 +1441,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ImageAnnotatorClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1366,7 +1450,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ImageAnnotatorAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.py b/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.py index 69690556..022ef7bd 100644 --- a/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1p2beta1/test_image_annotator.py @@ -92,20 +92,24 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] + "client_class,transport_name", + [ + (ImageAnnotatorClient, "grpc"), + (ImageAnnotatorAsyncClient, "grpc_asyncio"), + ], ) -def test_image_annotator_client_from_service_account_info(client_class): +def test_image_annotator_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") @pytest.mark.parametrize( @@ -134,23 +138,31 @@ def test_image_annotator_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] + "client_class,transport_name", + [ + (ImageAnnotatorClient, "grpc"), + (ImageAnnotatorAsyncClient, "grpc_asyncio"), + ], ) -def test_image_annotator_client_from_service_account_file(client_class): +def test_image_annotator_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") def test_image_annotator_client_get_transport_class(): @@ -498,7 +510,9 @@ def test_image_annotator_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -642,11 +656,16 @@ def test_image_annotator_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [image_annotator.BatchAnnotateImagesRequest, dict,] + "request_type", + [ + image_annotator.BatchAnnotateImagesRequest, + dict, + ], ) def test_batch_annotate_images(request_type, transport: str = "grpc"): client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -674,7 +693,8 @@ def test_batch_annotate_images_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -693,7 +713,8 @@ async def test_batch_annotate_images_async( request_type=image_annotator.BatchAnnotateImagesRequest, ): client = ImageAnnotatorAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -725,7 +746,9 @@ async def test_batch_annotate_images_async_from_dict(): def test_batch_annotate_images_flattened(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -757,7 +780,9 @@ def test_batch_annotate_images_flattened(): def test_batch_annotate_images_flattened_error(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -831,11 +856,16 @@ async def test_batch_annotate_images_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [image_annotator.AsyncBatchAnnotateFilesRequest, dict,] + "request_type", + [ + image_annotator.AsyncBatchAnnotateFilesRequest, + dict, + ], ) def test_async_batch_annotate_files(request_type, transport: str = "grpc"): client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -863,7 +893,8 @@ def test_async_batch_annotate_files_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -882,7 +913,8 @@ async def test_async_batch_annotate_files_async( request_type=image_annotator.AsyncBatchAnnotateFilesRequest, ): client = ImageAnnotatorAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -914,7 +946,9 @@ async def test_async_batch_annotate_files_async_from_dict(): def test_async_batch_annotate_files_flattened(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -950,7 +984,9 @@ def test_async_batch_annotate_files_flattened(): def test_async_batch_annotate_files_flattened_error(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1038,7 +1074,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1058,7 +1095,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ImageAnnotatorClient(client_options=options, transport=transport,) + client = ImageAnnotatorClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1074,7 +1114,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ImageAnnotatorClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1117,10 +1158,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = ImageAnnotatorClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.ImageAnnotatorGrpcTransport,) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.ImageAnnotatorGrpcTransport, + ) def test_image_annotator_base_transport_error(): @@ -1160,6 +1219,14 @@ def test_image_annotator_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_image_annotator_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1171,7 +1238,8 @@ def test_image_annotator_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ImageAnnotatorTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1316,24 +1384,40 @@ def test_image_annotator_grpc_transport_client_cert_source_for_mtls(transport_cl ) -def test_image_annotator_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_image_annotator_host_no_port(transport_name): client = ImageAnnotatorClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="vision.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") -def test_image_annotator_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_image_annotator_host_with_port(transport_name): client = ImageAnnotatorClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="vision.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "vision.googleapis.com:8000" + assert client.transport._host == ("vision.googleapis.com:8000") def test_image_annotator_grpc_transport_channel(): @@ -1341,7 +1425,8 @@ def test_image_annotator_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1353,7 +1438,8 @@ def test_image_annotator_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1462,12 +1548,16 @@ def test_image_annotator_transport_channel_mtls_with_adc(transport_class): def test_image_annotator_grpc_lro_client(): client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -1475,12 +1565,16 @@ def test_image_annotator_grpc_lro_client(): def test_image_annotator_grpc_lro_async_client(): client = ImageAnnotatorAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -1508,7 +1602,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ImageAnnotatorClient.common_folder_path(folder) assert expected == actual @@ -1526,7 +1622,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ImageAnnotatorClient.common_organization_path(organization) assert expected == actual @@ -1544,7 +1642,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ImageAnnotatorClient.common_project_path(project) assert expected == actual @@ -1564,7 +1664,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ImageAnnotatorClient.common_location_path(project, location) assert expected == actual @@ -1589,7 +1690,8 @@ def test_client_with_default_client_info(): transports.ImageAnnotatorTransport, "_prep_wrapped_messages" ) as prep: client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1598,7 +1700,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ImageAnnotatorClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1606,7 +1709,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ImageAnnotatorAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.py b/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.py index 58d0f99c..1c94502f 100644 --- a/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1p3beta1/test_image_annotator.py @@ -94,20 +94,24 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] + "client_class,transport_name", + [ + (ImageAnnotatorClient, "grpc"), + (ImageAnnotatorAsyncClient, "grpc_asyncio"), + ], ) -def test_image_annotator_client_from_service_account_info(client_class): +def test_image_annotator_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") @pytest.mark.parametrize( @@ -136,23 +140,31 @@ def test_image_annotator_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] + "client_class,transport_name", + [ + (ImageAnnotatorClient, "grpc"), + (ImageAnnotatorAsyncClient, "grpc_asyncio"), + ], ) -def test_image_annotator_client_from_service_account_file(client_class): +def test_image_annotator_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") def test_image_annotator_client_get_transport_class(): @@ -500,7 +512,9 @@ def test_image_annotator_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -644,11 +658,16 @@ def test_image_annotator_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [image_annotator.BatchAnnotateImagesRequest, dict,] + "request_type", + [ + image_annotator.BatchAnnotateImagesRequest, + dict, + ], ) def test_batch_annotate_images(request_type, transport: str = "grpc"): client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -676,7 +695,8 @@ def test_batch_annotate_images_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -695,7 +715,8 @@ async def test_batch_annotate_images_async( request_type=image_annotator.BatchAnnotateImagesRequest, ): client = ImageAnnotatorAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -727,7 +748,9 @@ async def test_batch_annotate_images_async_from_dict(): def test_batch_annotate_images_flattened(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -759,7 +782,9 @@ def test_batch_annotate_images_flattened(): def test_batch_annotate_images_flattened_error(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -833,11 +858,16 @@ async def test_batch_annotate_images_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [image_annotator.AsyncBatchAnnotateFilesRequest, dict,] + "request_type", + [ + image_annotator.AsyncBatchAnnotateFilesRequest, + dict, + ], ) def test_async_batch_annotate_files(request_type, transport: str = "grpc"): client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -865,7 +895,8 @@ def test_async_batch_annotate_files_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -884,7 +915,8 @@ async def test_async_batch_annotate_files_async( request_type=image_annotator.AsyncBatchAnnotateFilesRequest, ): client = ImageAnnotatorAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -916,7 +948,9 @@ async def test_async_batch_annotate_files_async_from_dict(): def test_async_batch_annotate_files_flattened(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -952,7 +986,9 @@ def test_async_batch_annotate_files_flattened(): def test_async_batch_annotate_files_flattened_error(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1040,7 +1076,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1060,7 +1097,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ImageAnnotatorClient(client_options=options, transport=transport,) + client = ImageAnnotatorClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1076,7 +1116,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ImageAnnotatorClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1119,10 +1160,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = ImageAnnotatorClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.ImageAnnotatorGrpcTransport,) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.ImageAnnotatorGrpcTransport, + ) def test_image_annotator_base_transport_error(): @@ -1162,6 +1221,14 @@ def test_image_annotator_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_image_annotator_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1173,7 +1240,8 @@ def test_image_annotator_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ImageAnnotatorTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1318,24 +1386,40 @@ def test_image_annotator_grpc_transport_client_cert_source_for_mtls(transport_cl ) -def test_image_annotator_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_image_annotator_host_no_port(transport_name): client = ImageAnnotatorClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="vision.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") -def test_image_annotator_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_image_annotator_host_with_port(transport_name): client = ImageAnnotatorClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="vision.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "vision.googleapis.com:8000" + assert client.transport._host == ("vision.googleapis.com:8000") def test_image_annotator_grpc_transport_channel(): @@ -1343,7 +1427,8 @@ def test_image_annotator_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1355,7 +1440,8 @@ def test_image_annotator_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1464,12 +1550,16 @@ def test_image_annotator_transport_channel_mtls_with_adc(transport_class): def test_image_annotator_grpc_lro_client(): client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -1477,12 +1567,16 @@ def test_image_annotator_grpc_lro_client(): def test_image_annotator_grpc_lro_async_client(): client = ImageAnnotatorAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -1493,7 +1587,9 @@ def test_product_path(): location = "clam" product = "whelk" expected = "projects/{project}/locations/{location}/products/{product}".format( - project=project, location=location, product=product, + project=project, + location=location, + product=product, ) actual = ImageAnnotatorClient.product_path(project, location, product) assert expected == actual @@ -1516,8 +1612,12 @@ def test_product_set_path(): project = "cuttlefish" location = "mussel" product_set = "winkle" - expected = "projects/{project}/locations/{location}/productSets/{product_set}".format( - project=project, location=location, product_set=product_set, + expected = ( + "projects/{project}/locations/{location}/productSets/{product_set}".format( + project=project, + location=location, + product_set=product_set, + ) ) actual = ImageAnnotatorClient.product_set_path(project, location, product_set) assert expected == actual @@ -1558,7 +1658,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ImageAnnotatorClient.common_folder_path(folder) assert expected == actual @@ -1576,7 +1678,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ImageAnnotatorClient.common_organization_path(organization) assert expected == actual @@ -1594,7 +1698,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ImageAnnotatorClient.common_project_path(project) assert expected == actual @@ -1614,7 +1720,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ImageAnnotatorClient.common_location_path(project, location) assert expected == actual @@ -1639,7 +1746,8 @@ def test_client_with_default_client_info(): transports.ImageAnnotatorTransport, "_prep_wrapped_messages" ) as prep: client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1648,7 +1756,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ImageAnnotatorClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -1656,7 +1765,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ImageAnnotatorAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/vision_v1p3beta1/test_product_search.py b/tests/unit/gapic/vision_v1p3beta1/test_product_search.py index 735d48a6..5ba00d37 100644 --- a/tests/unit/gapic/vision_v1p3beta1/test_product_search.py +++ b/tests/unit/gapic/vision_v1p3beta1/test_product_search.py @@ -97,20 +97,24 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [ProductSearchClient, ProductSearchAsyncClient,] + "client_class,transport_name", + [ + (ProductSearchClient, "grpc"), + (ProductSearchAsyncClient, "grpc_asyncio"), + ], ) -def test_product_search_client_from_service_account_info(client_class): +def test_product_search_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") @pytest.mark.parametrize( @@ -139,23 +143,31 @@ def test_product_search_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [ProductSearchClient, ProductSearchAsyncClient,] + "client_class,transport_name", + [ + (ProductSearchClient, "grpc"), + (ProductSearchAsyncClient, "grpc_asyncio"), + ], ) -def test_product_search_client_from_service_account_file(client_class): +def test_product_search_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") def test_product_search_client_get_transport_class(): @@ -503,7 +515,9 @@ def test_product_search_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -647,11 +661,16 @@ def test_product_search_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [product_search_service.CreateProductSetRequest, dict,] + "request_type", + [ + product_search_service.CreateProductSetRequest, + dict, + ], ) def test_create_product_set(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -664,7 +683,8 @@ def test_create_product_set(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = product_search_service.ProductSet( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) response = client.create_product_set(request) @@ -683,7 +703,8 @@ def test_create_product_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -702,7 +723,8 @@ async def test_create_product_set_async( request_type=product_search_service.CreateProductSetRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -716,7 +738,8 @@ async def test_create_product_set_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( product_search_service.ProductSet( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) ) response = await client.create_product_set(request) @@ -738,13 +761,15 @@ async def test_create_product_set_async_from_dict(): def test_create_product_set_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.CreateProductSetRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -760,7 +785,10 @@ def test_create_product_set_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -773,7 +801,7 @@ async def test_create_product_set_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.CreateProductSetRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -791,11 +819,16 @@ async def test_create_product_set_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_product_set_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -827,7 +860,9 @@ def test_create_product_set_flattened(): def test_create_product_set_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -897,11 +932,16 @@ async def test_create_product_set_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [product_search_service.ListProductSetsRequest, dict,] + "request_type", + [ + product_search_service.ListProductSetsRequest, + dict, + ], ) def test_list_product_sets(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -932,7 +972,8 @@ def test_list_product_sets_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -951,7 +992,8 @@ async def test_list_product_sets_async( request_type=product_search_service.ListProductSetsRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -986,13 +1028,15 @@ async def test_list_product_sets_async_from_dict(): def test_list_product_sets_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.ListProductSetsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1008,7 +1052,10 @@ def test_list_product_sets_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1021,7 +1068,7 @@ async def test_list_product_sets_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.ListProductSetsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1039,11 +1086,16 @@ async def test_list_product_sets_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_product_sets_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1053,7 +1105,9 @@ def test_list_product_sets_flattened(): call.return_value = product_search_service.ListProductSetsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_product_sets(parent="parent_value",) + client.list_product_sets( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1065,13 +1119,16 @@ def test_list_product_sets_flattened(): def test_list_product_sets_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_product_sets( - product_search_service.ListProductSetsRequest(), parent="parent_value", + product_search_service.ListProductSetsRequest(), + parent="parent_value", ) @@ -1093,7 +1150,9 @@ async def test_list_product_sets_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_product_sets(parent="parent_value",) + response = await client.list_product_sets( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1114,13 +1173,15 @@ async def test_list_product_sets_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_product_sets( - product_search_service.ListProductSetsRequest(), parent="parent_value", + product_search_service.ListProductSetsRequest(), + parent="parent_value", ) def test_list_product_sets_pager(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1138,10 +1199,13 @@ def test_list_product_sets_pager(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListProductSetsResponse( - product_sets=[], next_page_token="def", + product_sets=[], + next_page_token="def", ), product_search_service.ListProductSetsResponse( - product_sets=[product_search_service.ProductSet(),], + product_sets=[ + product_search_service.ProductSet(), + ], next_page_token="ghi", ), product_search_service.ListProductSetsResponse( @@ -1161,14 +1225,15 @@ def test_list_product_sets_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, product_search_service.ProductSet) for i in results) def test_list_product_sets_pages(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1186,10 +1251,13 @@ def test_list_product_sets_pages(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListProductSetsResponse( - product_sets=[], next_page_token="def", + product_sets=[], + next_page_token="def", ), product_search_service.ListProductSetsResponse( - product_sets=[product_search_service.ProductSet(),], + product_sets=[ + product_search_service.ProductSet(), + ], next_page_token="ghi", ), product_search_service.ListProductSetsResponse( @@ -1207,7 +1275,9 @@ def test_list_product_sets_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_product_sets_async_pager(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1226,10 +1296,13 @@ async def test_list_product_sets_async_pager(): next_page_token="abc", ), product_search_service.ListProductSetsResponse( - product_sets=[], next_page_token="def", + product_sets=[], + next_page_token="def", ), product_search_service.ListProductSetsResponse( - product_sets=[product_search_service.ProductSet(),], + product_sets=[ + product_search_service.ProductSet(), + ], next_page_token="ghi", ), product_search_service.ListProductSetsResponse( @@ -1240,10 +1313,12 @@ async def test_list_product_sets_async_pager(): ), RuntimeError, ) - async_pager = await client.list_product_sets(request={},) + async_pager = await client.list_product_sets( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1252,7 +1327,9 @@ async def test_list_product_sets_async_pager(): @pytest.mark.asyncio async def test_list_product_sets_async_pages(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1271,10 +1348,13 @@ async def test_list_product_sets_async_pages(): next_page_token="abc", ), product_search_service.ListProductSetsResponse( - product_sets=[], next_page_token="def", + product_sets=[], + next_page_token="def", ), product_search_service.ListProductSetsResponse( - product_sets=[product_search_service.ProductSet(),], + product_sets=[ + product_search_service.ProductSet(), + ], next_page_token="ghi", ), product_search_service.ListProductSetsResponse( @@ -1286,18 +1366,25 @@ async def test_list_product_sets_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_product_sets(request={})).pages: + async for page_ in ( + await client.list_product_sets(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [product_search_service.GetProductSetRequest, dict,] + "request_type", + [ + product_search_service.GetProductSetRequest, + dict, + ], ) def test_get_product_set(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1308,7 +1395,8 @@ def test_get_product_set(request_type, transport: str = "grpc"): with mock.patch.object(type(client.transport.get_product_set), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = product_search_service.ProductSet( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) response = client.get_product_set(request) @@ -1327,7 +1415,8 @@ def test_get_product_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1344,7 +1433,8 @@ async def test_get_product_set_async( request_type=product_search_service.GetProductSetRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1356,7 +1446,8 @@ async def test_get_product_set_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( product_search_service.ProductSet( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) ) response = await client.get_product_set(request) @@ -1378,13 +1469,15 @@ async def test_get_product_set_async_from_dict(): def test_get_product_set_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.GetProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_product_set), "__call__") as call: @@ -1398,7 +1491,10 @@ def test_get_product_set_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1411,7 +1507,7 @@ async def test_get_product_set_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.GetProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_product_set), "__call__") as call: @@ -1427,11 +1523,16 @@ async def test_get_product_set_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_product_set_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_product_set), "__call__") as call: @@ -1439,7 +1540,9 @@ def test_get_product_set_flattened(): call.return_value = product_search_service.ProductSet() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_product_set(name="name_value",) + client.get_product_set( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1451,13 +1554,16 @@ def test_get_product_set_flattened(): def test_get_product_set_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_product_set( - product_search_service.GetProductSetRequest(), name="name_value", + product_search_service.GetProductSetRequest(), + name="name_value", ) @@ -1477,7 +1583,9 @@ async def test_get_product_set_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_product_set(name="name_value",) + response = await client.get_product_set( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1498,16 +1606,22 @@ async def test_get_product_set_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_product_set( - product_search_service.GetProductSetRequest(), name="name_value", + product_search_service.GetProductSetRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [product_search_service.UpdateProductSetRequest, dict,] + "request_type", + [ + product_search_service.UpdateProductSetRequest, + dict, + ], ) def test_update_product_set(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1520,7 +1634,8 @@ def test_update_product_set(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = product_search_service.ProductSet( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) response = client.update_product_set(request) @@ -1539,7 +1654,8 @@ def test_update_product_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1558,7 +1674,8 @@ async def test_update_product_set_async( request_type=product_search_service.UpdateProductSetRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1572,7 +1689,8 @@ async def test_update_product_set_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( product_search_service.ProductSet( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) ) response = await client.update_product_set(request) @@ -1594,13 +1712,15 @@ async def test_update_product_set_async_from_dict(): def test_update_product_set_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.UpdateProductSetRequest() - request.product_set.name = "product_set.name/value" + request.product_set.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1616,9 +1736,10 @@ def test_update_product_set_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "product_set.name=product_set.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "product_set.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1631,7 +1752,7 @@ async def test_update_product_set_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.UpdateProductSetRequest() - request.product_set.name = "product_set.name/value" + request.product_set.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1649,13 +1770,16 @@ async def test_update_product_set_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "product_set.name=product_set.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "product_set.name=name_value", + ) in kw["metadata"] def test_update_product_set_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1683,7 +1807,9 @@ def test_update_product_set_flattened(): def test_update_product_set_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1747,11 +1873,16 @@ async def test_update_product_set_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [product_search_service.DeleteProductSetRequest, dict,] + "request_type", + [ + product_search_service.DeleteProductSetRequest, + dict, + ], ) def test_delete_product_set(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1779,7 +1910,8 @@ def test_delete_product_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1798,7 +1930,8 @@ async def test_delete_product_set_async( request_type=product_search_service.DeleteProductSetRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1828,13 +1961,15 @@ async def test_delete_product_set_async_from_dict(): def test_delete_product_set_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.DeleteProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1850,7 +1985,10 @@ def test_delete_product_set_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1863,7 +2001,7 @@ async def test_delete_product_set_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.DeleteProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1879,11 +2017,16 @@ async def test_delete_product_set_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_product_set_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1893,7 +2036,9 @@ def test_delete_product_set_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_product_set(name="name_value",) + client.delete_product_set( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1905,13 +2050,16 @@ def test_delete_product_set_flattened(): def test_delete_product_set_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_product_set( - product_search_service.DeleteProductSetRequest(), name="name_value", + product_search_service.DeleteProductSetRequest(), + name="name_value", ) @@ -1931,7 +2079,9 @@ async def test_delete_product_set_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_product_set(name="name_value",) + response = await client.delete_product_set( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1952,16 +2102,22 @@ async def test_delete_product_set_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_product_set( - product_search_service.DeleteProductSetRequest(), name="name_value", + product_search_service.DeleteProductSetRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [product_search_service.CreateProductRequest, dict,] + "request_type", + [ + product_search_service.CreateProductRequest, + dict, + ], ) def test_create_product(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1996,7 +2152,8 @@ def test_create_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2013,7 +2170,8 @@ async def test_create_product_async( request_type=product_search_service.CreateProductRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2052,13 +2210,15 @@ async def test_create_product_async_from_dict(): def test_create_product_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.CreateProductRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_product), "__call__") as call: @@ -2072,7 +2232,10 @@ def test_create_product_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2085,7 +2248,7 @@ async def test_create_product_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.CreateProductRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_product), "__call__") as call: @@ -2101,11 +2264,16 @@ async def test_create_product_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_product_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_product), "__call__") as call: @@ -2135,7 +2303,9 @@ def test_create_product_flattened(): def test_create_product_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2203,11 +2373,16 @@ async def test_create_product_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [product_search_service.ListProductsRequest, dict,] + "request_type", + [ + product_search_service.ListProductsRequest, + dict, + ], ) def test_list_products(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2236,7 +2411,8 @@ def test_list_products_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2253,7 +2429,8 @@ async def test_list_products_async( request_type=product_search_service.ListProductsRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2286,13 +2463,15 @@ async def test_list_products_async_from_dict(): def test_list_products_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.ListProductsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_products), "__call__") as call: @@ -2306,7 +2485,10 @@ def test_list_products_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2319,7 +2501,7 @@ async def test_list_products_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.ListProductsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_products), "__call__") as call: @@ -2335,11 +2517,16 @@ async def test_list_products_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_products_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_products), "__call__") as call: @@ -2347,7 +2534,9 @@ def test_list_products_flattened(): call.return_value = product_search_service.ListProductsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_products(parent="parent_value",) + client.list_products( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2359,13 +2548,16 @@ def test_list_products_flattened(): def test_list_products_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_products( - product_search_service.ListProductsRequest(), parent="parent_value", + product_search_service.ListProductsRequest(), + parent="parent_value", ) @@ -2385,7 +2577,9 @@ async def test_list_products_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_products(parent="parent_value",) + response = await client.list_products( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2406,13 +2600,15 @@ async def test_list_products_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_products( - product_search_service.ListProductsRequest(), parent="parent_value", + product_search_service.ListProductsRequest(), + parent="parent_value", ) def test_list_products_pager(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2428,10 +2624,14 @@ def test_list_products_pager(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListProductsResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsResponse( products=[ @@ -2450,14 +2650,15 @@ def test_list_products_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, product_search_service.Product) for i in results) def test_list_products_pages(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2473,10 +2674,14 @@ def test_list_products_pages(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListProductsResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsResponse( products=[ @@ -2493,7 +2698,9 @@ def test_list_products_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_products_async_pager(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2510,10 +2717,14 @@ async def test_list_products_async_pager(): next_page_token="abc", ), product_search_service.ListProductsResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsResponse( products=[ @@ -2523,10 +2734,12 @@ async def test_list_products_async_pager(): ), RuntimeError, ) - async_pager = await client.list_products(request={},) + async_pager = await client.list_products( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -2535,7 +2748,9 @@ async def test_list_products_async_pager(): @pytest.mark.asyncio async def test_list_products_async_pages(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2552,10 +2767,14 @@ async def test_list_products_async_pages(): next_page_token="abc", ), product_search_service.ListProductsResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsResponse( products=[ @@ -2566,18 +2785,25 @@ async def test_list_products_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_products(request={})).pages: + async for page_ in ( + await client.list_products(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [product_search_service.GetProductRequest, dict,] + "request_type", + [ + product_search_service.GetProductRequest, + dict, + ], ) def test_get_product(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2612,7 +2838,8 @@ def test_get_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2629,7 +2856,8 @@ async def test_get_product_async( request_type=product_search_service.GetProductRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2668,13 +2896,15 @@ async def test_get_product_async_from_dict(): def test_get_product_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.GetProductRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_product), "__call__") as call: @@ -2688,7 +2918,10 @@ def test_get_product_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2701,7 +2934,7 @@ async def test_get_product_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.GetProductRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_product), "__call__") as call: @@ -2717,11 +2950,16 @@ async def test_get_product_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_product_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_product), "__call__") as call: @@ -2729,7 +2967,9 @@ def test_get_product_flattened(): call.return_value = product_search_service.Product() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_product(name="name_value",) + client.get_product( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2741,13 +2981,16 @@ def test_get_product_flattened(): def test_get_product_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_product( - product_search_service.GetProductRequest(), name="name_value", + product_search_service.GetProductRequest(), + name="name_value", ) @@ -2767,7 +3010,9 @@ async def test_get_product_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_product(name="name_value",) + response = await client.get_product( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2788,16 +3033,22 @@ async def test_get_product_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_product( - product_search_service.GetProductRequest(), name="name_value", + product_search_service.GetProductRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [product_search_service.UpdateProductRequest, dict,] + "request_type", + [ + product_search_service.UpdateProductRequest, + dict, + ], ) def test_update_product(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2832,7 +3083,8 @@ def test_update_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2849,7 +3101,8 @@ async def test_update_product_async( request_type=product_search_service.UpdateProductRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2888,13 +3141,15 @@ async def test_update_product_async_from_dict(): def test_update_product_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.UpdateProductRequest() - request.product.name = "product.name/value" + request.product.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_product), "__call__") as call: @@ -2908,9 +3163,10 @@ def test_update_product_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "product.name=product.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "product.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2923,7 +3179,7 @@ async def test_update_product_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.UpdateProductRequest() - request.product.name = "product.name/value" + request.product.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_product), "__call__") as call: @@ -2939,13 +3195,16 @@ async def test_update_product_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "product.name=product.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "product.name=name_value", + ) in kw["metadata"] def test_update_product_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_product), "__call__") as call: @@ -2971,7 +3230,9 @@ def test_update_product_flattened(): def test_update_product_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3033,11 +3294,16 @@ async def test_update_product_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [product_search_service.DeleteProductRequest, dict,] + "request_type", + [ + product_search_service.DeleteProductRequest, + dict, + ], ) def test_delete_product(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3063,7 +3329,8 @@ def test_delete_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3080,7 +3347,8 @@ async def test_delete_product_async( request_type=product_search_service.DeleteProductRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3108,13 +3376,15 @@ async def test_delete_product_async_from_dict(): def test_delete_product_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.DeleteProductRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_product), "__call__") as call: @@ -3128,7 +3398,10 @@ def test_delete_product_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3141,7 +3414,7 @@ async def test_delete_product_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.DeleteProductRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_product), "__call__") as call: @@ -3155,11 +3428,16 @@ async def test_delete_product_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_product_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_product), "__call__") as call: @@ -3167,8 +3445,10 @@ def test_delete_product_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_product(name="name_value",) - + client.delete_product( + name="name_value", + ) + # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 @@ -3179,13 +3459,16 @@ def test_delete_product_flattened(): def test_delete_product_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_product( - product_search_service.DeleteProductRequest(), name="name_value", + product_search_service.DeleteProductRequest(), + name="name_value", ) @@ -3203,7 +3486,9 @@ async def test_delete_product_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_product(name="name_value",) + response = await client.delete_product( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3224,16 +3509,22 @@ async def test_delete_product_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_product( - product_search_service.DeleteProductRequest(), name="name_value", + product_search_service.DeleteProductRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [product_search_service.CreateReferenceImageRequest, dict,] + "request_type", + [ + product_search_service.CreateReferenceImageRequest, + dict, + ], ) def test_create_reference_image(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3246,7 +3537,8 @@ def test_create_reference_image(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = product_search_service.ReferenceImage( - name="name_value", uri="uri_value", + name="name_value", + uri="uri_value", ) response = client.create_reference_image(request) @@ -3265,7 +3557,8 @@ def test_create_reference_image_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3284,7 +3577,8 @@ async def test_create_reference_image_async( request_type=product_search_service.CreateReferenceImageRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3297,7 +3591,10 @@ async def test_create_reference_image_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - product_search_service.ReferenceImage(name="name_value", uri="uri_value",) + product_search_service.ReferenceImage( + name="name_value", + uri="uri_value", + ) ) response = await client.create_reference_image(request) @@ -3318,13 +3615,15 @@ async def test_create_reference_image_async_from_dict(): def test_create_reference_image_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.CreateReferenceImageRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3340,7 +3639,10 @@ def test_create_reference_image_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3353,7 +3655,7 @@ async def test_create_reference_image_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.CreateReferenceImageRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3371,11 +3673,16 @@ async def test_create_reference_image_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_reference_image_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3407,7 +3714,9 @@ def test_create_reference_image_flattened(): def test_create_reference_image_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3477,11 +3786,16 @@ async def test_create_reference_image_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [product_search_service.DeleteReferenceImageRequest, dict,] + "request_type", + [ + product_search_service.DeleteReferenceImageRequest, + dict, + ], ) def test_delete_reference_image(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3509,7 +3823,8 @@ def test_delete_reference_image_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3528,7 +3843,8 @@ async def test_delete_reference_image_async( request_type=product_search_service.DeleteReferenceImageRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3558,13 +3874,15 @@ async def test_delete_reference_image_async_from_dict(): def test_delete_reference_image_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.DeleteReferenceImageRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3580,7 +3898,10 @@ def test_delete_reference_image_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3593,7 +3914,7 @@ async def test_delete_reference_image_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.DeleteReferenceImageRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3609,11 +3930,16 @@ async def test_delete_reference_image_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_reference_image_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3623,7 +3949,9 @@ def test_delete_reference_image_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_reference_image(name="name_value",) + client.delete_reference_image( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3635,13 +3963,16 @@ def test_delete_reference_image_flattened(): def test_delete_reference_image_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_reference_image( - product_search_service.DeleteReferenceImageRequest(), name="name_value", + product_search_service.DeleteReferenceImageRequest(), + name="name_value", ) @@ -3661,7 +3992,9 @@ async def test_delete_reference_image_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_reference_image(name="name_value",) + response = await client.delete_reference_image( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3682,16 +4015,22 @@ async def test_delete_reference_image_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_reference_image( - product_search_service.DeleteReferenceImageRequest(), name="name_value", + product_search_service.DeleteReferenceImageRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [product_search_service.ListReferenceImagesRequest, dict,] + "request_type", + [ + product_search_service.ListReferenceImagesRequest, + dict, + ], ) def test_list_reference_images(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3704,7 +4043,8 @@ def test_list_reference_images(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = product_search_service.ListReferenceImagesResponse( - page_size=951, next_page_token="next_page_token_value", + page_size=951, + next_page_token="next_page_token_value", ) response = client.list_reference_images(request) @@ -3723,7 +4063,8 @@ def test_list_reference_images_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3742,7 +4083,8 @@ async def test_list_reference_images_async( request_type=product_search_service.ListReferenceImagesRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3756,7 +4098,8 @@ async def test_list_reference_images_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( product_search_service.ListReferenceImagesResponse( - page_size=951, next_page_token="next_page_token_value", + page_size=951, + next_page_token="next_page_token_value", ) ) response = await client.list_reference_images(request) @@ -3778,13 +4121,15 @@ async def test_list_reference_images_async_from_dict(): def test_list_reference_images_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.ListReferenceImagesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3800,7 +4145,10 @@ def test_list_reference_images_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3813,7 +4161,7 @@ async def test_list_reference_images_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.ListReferenceImagesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3831,11 +4179,16 @@ async def test_list_reference_images_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_reference_images_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3845,7 +4198,9 @@ def test_list_reference_images_flattened(): call.return_value = product_search_service.ListReferenceImagesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_reference_images(parent="parent_value",) + client.list_reference_images( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3857,13 +4212,16 @@ def test_list_reference_images_flattened(): def test_list_reference_images_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_reference_images( - product_search_service.ListReferenceImagesRequest(), parent="parent_value", + product_search_service.ListReferenceImagesRequest(), + parent="parent_value", ) @@ -3885,7 +4243,9 @@ async def test_list_reference_images_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_reference_images(parent="parent_value",) + response = await client.list_reference_images( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3906,13 +4266,15 @@ async def test_list_reference_images_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_reference_images( - product_search_service.ListReferenceImagesRequest(), parent="parent_value", + product_search_service.ListReferenceImagesRequest(), + parent="parent_value", ) def test_list_reference_images_pager(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3930,10 +4292,13 @@ def test_list_reference_images_pager(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListReferenceImagesResponse( - reference_images=[], next_page_token="def", + reference_images=[], + next_page_token="def", ), product_search_service.ListReferenceImagesResponse( - reference_images=[product_search_service.ReferenceImage(),], + reference_images=[ + product_search_service.ReferenceImage(), + ], next_page_token="ghi", ), product_search_service.ListReferenceImagesResponse( @@ -3953,7 +4318,7 @@ def test_list_reference_images_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all( isinstance(i, product_search_service.ReferenceImage) for i in results @@ -3962,7 +4327,8 @@ def test_list_reference_images_pager(transport_name: str = "grpc"): def test_list_reference_images_pages(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3980,10 +4346,13 @@ def test_list_reference_images_pages(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListReferenceImagesResponse( - reference_images=[], next_page_token="def", + reference_images=[], + next_page_token="def", ), product_search_service.ListReferenceImagesResponse( - reference_images=[product_search_service.ReferenceImage(),], + reference_images=[ + product_search_service.ReferenceImage(), + ], next_page_token="ghi", ), product_search_service.ListReferenceImagesResponse( @@ -4001,7 +4370,9 @@ def test_list_reference_images_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_reference_images_async_pager(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4020,10 +4391,13 @@ async def test_list_reference_images_async_pager(): next_page_token="abc", ), product_search_service.ListReferenceImagesResponse( - reference_images=[], next_page_token="def", + reference_images=[], + next_page_token="def", ), product_search_service.ListReferenceImagesResponse( - reference_images=[product_search_service.ReferenceImage(),], + reference_images=[ + product_search_service.ReferenceImage(), + ], next_page_token="ghi", ), product_search_service.ListReferenceImagesResponse( @@ -4034,10 +4408,12 @@ async def test_list_reference_images_async_pager(): ), RuntimeError, ) - async_pager = await client.list_reference_images(request={},) + async_pager = await client.list_reference_images( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -4048,7 +4424,9 @@ async def test_list_reference_images_async_pager(): @pytest.mark.asyncio async def test_list_reference_images_async_pages(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4067,10 +4445,13 @@ async def test_list_reference_images_async_pages(): next_page_token="abc", ), product_search_service.ListReferenceImagesResponse( - reference_images=[], next_page_token="def", + reference_images=[], + next_page_token="def", ), product_search_service.ListReferenceImagesResponse( - reference_images=[product_search_service.ReferenceImage(),], + reference_images=[ + product_search_service.ReferenceImage(), + ], next_page_token="ghi", ), product_search_service.ListReferenceImagesResponse( @@ -4082,18 +4463,25 @@ async def test_list_reference_images_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_reference_images(request={})).pages: + async for page_ in ( + await client.list_reference_images(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [product_search_service.GetReferenceImageRequest, dict,] + "request_type", + [ + product_search_service.GetReferenceImageRequest, + dict, + ], ) def test_get_reference_image(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4106,7 +4494,8 @@ def test_get_reference_image(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = product_search_service.ReferenceImage( - name="name_value", uri="uri_value", + name="name_value", + uri="uri_value", ) response = client.get_reference_image(request) @@ -4125,7 +4514,8 @@ def test_get_reference_image_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4144,7 +4534,8 @@ async def test_get_reference_image_async( request_type=product_search_service.GetReferenceImageRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4157,7 +4548,10 @@ async def test_get_reference_image_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - product_search_service.ReferenceImage(name="name_value", uri="uri_value",) + product_search_service.ReferenceImage( + name="name_value", + uri="uri_value", + ) ) response = await client.get_reference_image(request) @@ -4178,13 +4572,15 @@ async def test_get_reference_image_async_from_dict(): def test_get_reference_image_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.GetReferenceImageRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4200,7 +4596,10 @@ def test_get_reference_image_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4213,7 +4612,7 @@ async def test_get_reference_image_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.GetReferenceImageRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4231,11 +4630,16 @@ async def test_get_reference_image_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_reference_image_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4245,7 +4649,9 @@ def test_get_reference_image_flattened(): call.return_value = product_search_service.ReferenceImage() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_reference_image(name="name_value",) + client.get_reference_image( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4257,13 +4663,16 @@ def test_get_reference_image_flattened(): def test_get_reference_image_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_reference_image( - product_search_service.GetReferenceImageRequest(), name="name_value", + product_search_service.GetReferenceImageRequest(), + name="name_value", ) @@ -4285,7 +4694,9 @@ async def test_get_reference_image_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_reference_image(name="name_value",) + response = await client.get_reference_image( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4306,16 +4717,22 @@ async def test_get_reference_image_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_reference_image( - product_search_service.GetReferenceImageRequest(), name="name_value", + product_search_service.GetReferenceImageRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [product_search_service.AddProductToProductSetRequest, dict,] + "request_type", + [ + product_search_service.AddProductToProductSetRequest, + dict, + ], ) def test_add_product_to_product_set(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4343,7 +4760,8 @@ def test_add_product_to_product_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4362,7 +4780,8 @@ async def test_add_product_to_product_set_async( request_type=product_search_service.AddProductToProductSetRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4392,13 +4811,15 @@ async def test_add_product_to_product_set_async_from_dict(): def test_add_product_to_product_set_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.AddProductToProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4414,7 +4835,10 @@ def test_add_product_to_product_set_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4427,7 +4851,7 @@ async def test_add_product_to_product_set_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.AddProductToProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4443,11 +4867,16 @@ async def test_add_product_to_product_set_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_add_product_to_product_set_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4458,7 +4887,8 @@ def test_add_product_to_product_set_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.add_product_to_product_set( - name="name_value", product="product_value", + name="name_value", + product="product_value", ) # Establish that the underlying call was made with the expected @@ -4474,7 +4904,9 @@ def test_add_product_to_product_set_flattened(): def test_add_product_to_product_set_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4503,7 +4935,8 @@ async def test_add_product_to_product_set_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.add_product_to_product_set( - name="name_value", product="product_value", + name="name_value", + product="product_value", ) # Establish that the underlying call was made with the expected @@ -4535,11 +4968,16 @@ async def test_add_product_to_product_set_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [product_search_service.RemoveProductFromProductSetRequest, dict,] + "request_type", + [ + product_search_service.RemoveProductFromProductSetRequest, + dict, + ], ) def test_remove_product_from_product_set(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4567,7 +5005,8 @@ def test_remove_product_from_product_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4586,7 +5025,8 @@ async def test_remove_product_from_product_set_async( request_type=product_search_service.RemoveProductFromProductSetRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4616,13 +5056,15 @@ async def test_remove_product_from_product_set_async_from_dict(): def test_remove_product_from_product_set_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.RemoveProductFromProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4638,7 +5080,10 @@ def test_remove_product_from_product_set_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4651,7 +5096,7 @@ async def test_remove_product_from_product_set_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.RemoveProductFromProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4667,11 +5112,16 @@ async def test_remove_product_from_product_set_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_remove_product_from_product_set_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4682,7 +5132,8 @@ def test_remove_product_from_product_set_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.remove_product_from_product_set( - name="name_value", product="product_value", + name="name_value", + product="product_value", ) # Establish that the underlying call was made with the expected @@ -4698,7 +5149,9 @@ def test_remove_product_from_product_set_flattened(): def test_remove_product_from_product_set_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4727,7 +5180,8 @@ async def test_remove_product_from_product_set_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.remove_product_from_product_set( - name="name_value", product="product_value", + name="name_value", + product="product_value", ) # Establish that the underlying call was made with the expected @@ -4759,11 +5213,16 @@ async def test_remove_product_from_product_set_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [product_search_service.ListProductsInProductSetRequest, dict,] + "request_type", + [ + product_search_service.ListProductsInProductSetRequest, + dict, + ], ) def test_list_products_in_product_set(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4794,7 +5253,8 @@ def test_list_products_in_product_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4813,7 +5273,8 @@ async def test_list_products_in_product_set_async( request_type=product_search_service.ListProductsInProductSetRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4848,13 +5309,15 @@ async def test_list_products_in_product_set_async_from_dict(): def test_list_products_in_product_set_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.ListProductsInProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4870,7 +5333,10 @@ def test_list_products_in_product_set_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4883,7 +5349,7 @@ async def test_list_products_in_product_set_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.ListProductsInProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4901,11 +5367,16 @@ async def test_list_products_in_product_set_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_list_products_in_product_set_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4915,7 +5386,9 @@ def test_list_products_in_product_set_flattened(): call.return_value = product_search_service.ListProductsInProductSetResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_products_in_product_set(name="name_value",) + client.list_products_in_product_set( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4927,13 +5400,16 @@ def test_list_products_in_product_set_flattened(): def test_list_products_in_product_set_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_products_in_product_set( - product_search_service.ListProductsInProductSetRequest(), name="name_value", + product_search_service.ListProductsInProductSetRequest(), + name="name_value", ) @@ -4955,7 +5431,9 @@ async def test_list_products_in_product_set_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_products_in_product_set(name="name_value",) + response = await client.list_products_in_product_set( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4976,13 +5454,15 @@ async def test_list_products_in_product_set_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_products_in_product_set( - product_search_service.ListProductsInProductSetRequest(), name="name_value", + product_search_service.ListProductsInProductSetRequest(), + name="name_value", ) def test_list_products_in_product_set_pager(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5000,10 +5480,14 @@ def test_list_products_in_product_set_pager(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListProductsInProductSetResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsInProductSetResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsInProductSetResponse( products=[ @@ -5022,14 +5506,15 @@ def test_list_products_in_product_set_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, product_search_service.Product) for i in results) def test_list_products_in_product_set_pages(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5047,10 +5532,14 @@ def test_list_products_in_product_set_pages(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListProductsInProductSetResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsInProductSetResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsInProductSetResponse( products=[ @@ -5067,7 +5556,9 @@ def test_list_products_in_product_set_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_products_in_product_set_async_pager(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5086,10 +5577,14 @@ async def test_list_products_in_product_set_async_pager(): next_page_token="abc", ), product_search_service.ListProductsInProductSetResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsInProductSetResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsInProductSetResponse( products=[ @@ -5099,10 +5594,12 @@ async def test_list_products_in_product_set_async_pager(): ), RuntimeError, ) - async_pager = await client.list_products_in_product_set(request={},) + async_pager = await client.list_products_in_product_set( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -5111,7 +5608,9 @@ async def test_list_products_in_product_set_async_pager(): @pytest.mark.asyncio async def test_list_products_in_product_set_async_pages(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5130,10 +5629,14 @@ async def test_list_products_in_product_set_async_pages(): next_page_token="abc", ), product_search_service.ListProductsInProductSetResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsInProductSetResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsInProductSetResponse( products=[ @@ -5146,18 +5649,23 @@ async def test_list_products_in_product_set_async_pages(): pages = [] async for page_ in ( await client.list_products_in_product_set(request={}) - ).pages: + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [product_search_service.ImportProductSetsRequest, dict,] + "request_type", + [ + product_search_service.ImportProductSetsRequest, + dict, + ], ) def test_import_product_sets(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5185,7 +5693,8 @@ def test_import_product_sets_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5204,7 +5713,8 @@ async def test_import_product_sets_async( request_type=product_search_service.ImportProductSetsRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5236,13 +5746,15 @@ async def test_import_product_sets_async_from_dict(): def test_import_product_sets_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.ImportProductSetsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5258,7 +5770,10 @@ def test_import_product_sets_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -5271,7 +5786,7 @@ async def test_import_product_sets_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.ImportProductSetsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5289,11 +5804,16 @@ async def test_import_product_sets_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_import_product_sets_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5329,7 +5849,9 @@ def test_import_product_sets_flattened(): def test_import_product_sets_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -5415,7 +5937,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -5435,7 +5958,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ProductSearchClient(client_options=options, transport=transport,) + client = ProductSearchClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -5451,7 +5977,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ProductSearchClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -5494,10 +6021,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = ProductSearchClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.ProductSearchGrpcTransport,) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.ProductSearchGrpcTransport, + ) def test_product_search_base_transport_error(): @@ -5553,6 +6098,14 @@ def test_product_search_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_product_search_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -5564,7 +6117,8 @@ def test_product_search_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ProductSearchTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -5709,24 +6263,40 @@ def test_product_search_grpc_transport_client_cert_source_for_mtls(transport_cla ) -def test_product_search_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_product_search_host_no_port(transport_name): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="vision.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") -def test_product_search_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_product_search_host_with_port(transport_name): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="vision.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "vision.googleapis.com:8000" + assert client.transport._host == ("vision.googleapis.com:8000") def test_product_search_grpc_transport_channel(): @@ -5734,7 +6304,8 @@ def test_product_search_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.ProductSearchGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -5746,7 +6317,8 @@ def test_product_search_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.ProductSearchGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -5853,12 +6425,16 @@ def test_product_search_transport_channel_mtls_with_adc(transport_class): def test_product_search_grpc_lro_client(): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -5866,12 +6442,16 @@ def test_product_search_grpc_lro_client(): def test_product_search_grpc_lro_async_client(): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -5882,7 +6462,9 @@ def test_product_path(): location = "clam" product = "whelk" expected = "projects/{project}/locations/{location}/products/{product}".format( - project=project, location=location, product=product, + project=project, + location=location, + product=product, ) actual = ProductSearchClient.product_path(project, location, product) assert expected == actual @@ -5905,8 +6487,12 @@ def test_product_set_path(): project = "cuttlefish" location = "mussel" product_set = "winkle" - expected = "projects/{project}/locations/{location}/productSets/{product_set}".format( - project=project, location=location, product_set=product_set, + expected = ( + "projects/{project}/locations/{location}/productSets/{product_set}".format( + project=project, + location=location, + product_set=product_set, + ) ) actual = ProductSearchClient.product_set_path(project, location, product_set) assert expected == actual @@ -5978,7 +6564,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "scallop" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ProductSearchClient.common_folder_path(folder) assert expected == actual @@ -5996,7 +6584,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "squid" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ProductSearchClient.common_organization_path(organization) assert expected == actual @@ -6014,7 +6604,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "whelk" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ProductSearchClient.common_project_path(project) assert expected == actual @@ -6034,7 +6626,8 @@ def test_common_location_path(): project = "oyster" location = "nudibranch" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ProductSearchClient.common_location_path(project, location) assert expected == actual @@ -6059,7 +6652,8 @@ def test_client_with_default_client_info(): transports.ProductSearchTransport, "_prep_wrapped_messages" ) as prep: client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6068,7 +6662,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ProductSearchClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6076,7 +6671,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.py b/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.py index ab3810a9..ac5667ab 100644 --- a/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.py +++ b/tests/unit/gapic/vision_v1p4beta1/test_image_annotator.py @@ -95,20 +95,24 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] + "client_class,transport_name", + [ + (ImageAnnotatorClient, "grpc"), + (ImageAnnotatorAsyncClient, "grpc_asyncio"), + ], ) -def test_image_annotator_client_from_service_account_info(client_class): +def test_image_annotator_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") @pytest.mark.parametrize( @@ -137,23 +141,31 @@ def test_image_annotator_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [ImageAnnotatorClient, ImageAnnotatorAsyncClient,] + "client_class,transport_name", + [ + (ImageAnnotatorClient, "grpc"), + (ImageAnnotatorAsyncClient, "grpc_asyncio"), + ], ) -def test_image_annotator_client_from_service_account_file(client_class): +def test_image_annotator_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") def test_image_annotator_client_get_transport_class(): @@ -501,7 +513,9 @@ def test_image_annotator_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -645,11 +659,16 @@ def test_image_annotator_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [image_annotator.BatchAnnotateImagesRequest, dict,] + "request_type", + [ + image_annotator.BatchAnnotateImagesRequest, + dict, + ], ) def test_batch_annotate_images(request_type, transport: str = "grpc"): client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -677,7 +696,8 @@ def test_batch_annotate_images_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -696,7 +716,8 @@ async def test_batch_annotate_images_async( request_type=image_annotator.BatchAnnotateImagesRequest, ): client = ImageAnnotatorAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -728,7 +749,9 @@ async def test_batch_annotate_images_async_from_dict(): def test_batch_annotate_images_flattened(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -760,7 +783,9 @@ def test_batch_annotate_images_flattened(): def test_batch_annotate_images_flattened_error(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -834,11 +859,16 @@ async def test_batch_annotate_images_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [image_annotator.BatchAnnotateFilesRequest, dict,] + "request_type", + [ + image_annotator.BatchAnnotateFilesRequest, + dict, + ], ) def test_batch_annotate_files(request_type, transport: str = "grpc"): client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -866,7 +896,8 @@ def test_batch_annotate_files_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -885,7 +916,8 @@ async def test_batch_annotate_files_async( request_type=image_annotator.BatchAnnotateFilesRequest, ): client = ImageAnnotatorAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -917,7 +949,9 @@ async def test_batch_annotate_files_async_from_dict(): def test_batch_annotate_files_flattened(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -953,7 +987,9 @@ def test_batch_annotate_files_flattened(): def test_batch_annotate_files_flattened_error(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1035,11 +1071,16 @@ async def test_batch_annotate_files_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [image_annotator.AsyncBatchAnnotateImagesRequest, dict,] + "request_type", + [ + image_annotator.AsyncBatchAnnotateImagesRequest, + dict, + ], ) def test_async_batch_annotate_images(request_type, transport: str = "grpc"): client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1067,7 +1108,8 @@ def test_async_batch_annotate_images_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1086,7 +1128,8 @@ async def test_async_batch_annotate_images_async( request_type=image_annotator.AsyncBatchAnnotateImagesRequest, ): client = ImageAnnotatorAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1118,7 +1161,9 @@ async def test_async_batch_annotate_images_async_from_dict(): def test_async_batch_annotate_images_flattened(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1158,7 +1203,9 @@ def test_async_batch_annotate_images_flattened(): def test_async_batch_annotate_images_flattened_error(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1246,11 +1293,16 @@ async def test_async_batch_annotate_images_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [image_annotator.AsyncBatchAnnotateFilesRequest, dict,] + "request_type", + [ + image_annotator.AsyncBatchAnnotateFilesRequest, + dict, + ], ) def test_async_batch_annotate_files(request_type, transport: str = "grpc"): client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1278,7 +1330,8 @@ def test_async_batch_annotate_files_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1297,7 +1350,8 @@ async def test_async_batch_annotate_files_async( request_type=image_annotator.AsyncBatchAnnotateFilesRequest, ): client = ImageAnnotatorAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1329,7 +1383,9 @@ async def test_async_batch_annotate_files_async_from_dict(): def test_async_batch_annotate_files_flattened(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1365,7 +1421,9 @@ def test_async_batch_annotate_files_flattened(): def test_async_batch_annotate_files_flattened_error(): - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1453,7 +1511,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -1473,7 +1532,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ImageAnnotatorClient(client_options=options, transport=transport,) + client = ImageAnnotatorClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -1489,7 +1551,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ImageAnnotatorClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -1532,10 +1595,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = ImageAnnotatorClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = ImageAnnotatorClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.ImageAnnotatorGrpcTransport,) + client = ImageAnnotatorClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.ImageAnnotatorGrpcTransport, + ) def test_image_annotator_base_transport_error(): @@ -1577,6 +1658,14 @@ def test_image_annotator_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_image_annotator_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -1588,7 +1677,8 @@ def test_image_annotator_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ImageAnnotatorTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -1733,24 +1823,40 @@ def test_image_annotator_grpc_transport_client_cert_source_for_mtls(transport_cl ) -def test_image_annotator_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_image_annotator_host_no_port(transport_name): client = ImageAnnotatorClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="vision.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") -def test_image_annotator_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_image_annotator_host_with_port(transport_name): client = ImageAnnotatorClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="vision.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "vision.googleapis.com:8000" + assert client.transport._host == ("vision.googleapis.com:8000") def test_image_annotator_grpc_transport_channel(): @@ -1758,7 +1864,8 @@ def test_image_annotator_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1770,7 +1877,8 @@ def test_image_annotator_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.ImageAnnotatorGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -1879,12 +1987,16 @@ def test_image_annotator_transport_channel_mtls_with_adc(transport_class): def test_image_annotator_grpc_lro_client(): client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -1892,12 +2004,16 @@ def test_image_annotator_grpc_lro_client(): def test_image_annotator_grpc_lro_async_client(): client = ImageAnnotatorAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -1908,7 +2024,9 @@ def test_product_path(): location = "clam" product = "whelk" expected = "projects/{project}/locations/{location}/products/{product}".format( - project=project, location=location, product=product, + project=project, + location=location, + product=product, ) actual = ImageAnnotatorClient.product_path(project, location, product) assert expected == actual @@ -1931,8 +2049,12 @@ def test_product_set_path(): project = "cuttlefish" location = "mussel" product_set = "winkle" - expected = "projects/{project}/locations/{location}/productSets/{product_set}".format( - project=project, location=location, product_set=product_set, + expected = ( + "projects/{project}/locations/{location}/productSets/{product_set}".format( + project=project, + location=location, + product_set=product_set, + ) ) actual = ImageAnnotatorClient.product_set_path(project, location, product_set) assert expected == actual @@ -1973,7 +2095,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "whelk" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ImageAnnotatorClient.common_folder_path(folder) assert expected == actual @@ -1991,7 +2115,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "oyster" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ImageAnnotatorClient.common_organization_path(organization) assert expected == actual @@ -2009,7 +2135,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "cuttlefish" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ImageAnnotatorClient.common_project_path(project) assert expected == actual @@ -2029,7 +2157,8 @@ def test_common_location_path(): project = "winkle" location = "nautilus" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ImageAnnotatorClient.common_location_path(project, location) assert expected == actual @@ -2054,7 +2183,8 @@ def test_client_with_default_client_info(): transports.ImageAnnotatorTransport, "_prep_wrapped_messages" ) as prep: client = ImageAnnotatorClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2063,7 +2193,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ImageAnnotatorClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -2071,7 +2202,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ImageAnnotatorAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close" diff --git a/tests/unit/gapic/vision_v1p4beta1/test_product_search.py b/tests/unit/gapic/vision_v1p4beta1/test_product_search.py index 73f016a4..7cfe68b3 100644 --- a/tests/unit/gapic/vision_v1p4beta1/test_product_search.py +++ b/tests/unit/gapic/vision_v1p4beta1/test_product_search.py @@ -97,20 +97,24 @@ def test__get_default_mtls_endpoint(): @pytest.mark.parametrize( - "client_class", [ProductSearchClient, ProductSearchAsyncClient,] + "client_class,transport_name", + [ + (ProductSearchClient, "grpc"), + (ProductSearchAsyncClient, "grpc_asyncio"), + ], ) -def test_product_search_client_from_service_account_info(client_class): +def test_product_search_client_from_service_account_info(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_info" ) as factory: factory.return_value = creds info = {"valid": True} - client = client_class.from_service_account_info(info) + client = client_class.from_service_account_info(info, transport=transport_name) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") @pytest.mark.parametrize( @@ -139,23 +143,31 @@ def test_product_search_client_service_account_always_use_jwt( @pytest.mark.parametrize( - "client_class", [ProductSearchClient, ProductSearchAsyncClient,] + "client_class,transport_name", + [ + (ProductSearchClient, "grpc"), + (ProductSearchAsyncClient, "grpc_asyncio"), + ], ) -def test_product_search_client_from_service_account_file(client_class): +def test_product_search_client_from_service_account_file(client_class, transport_name): creds = ga_credentials.AnonymousCredentials() with mock.patch.object( service_account.Credentials, "from_service_account_file" ) as factory: factory.return_value = creds - client = client_class.from_service_account_file("dummy/file/path.json") + client = client_class.from_service_account_file( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - client = client_class.from_service_account_json("dummy/file/path.json") + client = client_class.from_service_account_json( + "dummy/file/path.json", transport=transport_name + ) assert client.transport._credentials == creds assert isinstance(client, client_class) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") def test_product_search_client_get_transport_class(): @@ -503,7 +515,9 @@ def test_product_search_client_client_options_scopes( client_class, transport_class, transport_name ): # Check the case scopes are provided. - options = client_options.ClientOptions(scopes=["1", "2"],) + options = client_options.ClientOptions( + scopes=["1", "2"], + ) with mock.patch.object(transport_class, "__init__") as patched: patched.return_value = None client = client_class(client_options=options, transport=transport_name) @@ -647,11 +661,16 @@ def test_product_search_client_create_channel_credentials_file( @pytest.mark.parametrize( - "request_type", [product_search_service.CreateProductSetRequest, dict,] + "request_type", + [ + product_search_service.CreateProductSetRequest, + dict, + ], ) def test_create_product_set(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -664,7 +683,8 @@ def test_create_product_set(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = product_search_service.ProductSet( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) response = client.create_product_set(request) @@ -683,7 +703,8 @@ def test_create_product_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -702,7 +723,8 @@ async def test_create_product_set_async( request_type=product_search_service.CreateProductSetRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -716,7 +738,8 @@ async def test_create_product_set_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( product_search_service.ProductSet( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) ) response = await client.create_product_set(request) @@ -738,13 +761,15 @@ async def test_create_product_set_async_from_dict(): def test_create_product_set_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.CreateProductSetRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -760,7 +785,10 @@ def test_create_product_set_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -773,7 +801,7 @@ async def test_create_product_set_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.CreateProductSetRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -791,11 +819,16 @@ async def test_create_product_set_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_product_set_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -827,7 +860,9 @@ def test_create_product_set_flattened(): def test_create_product_set_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -897,11 +932,16 @@ async def test_create_product_set_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [product_search_service.ListProductSetsRequest, dict,] + "request_type", + [ + product_search_service.ListProductSetsRequest, + dict, + ], ) def test_list_product_sets(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -932,7 +972,8 @@ def test_list_product_sets_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -951,7 +992,8 @@ async def test_list_product_sets_async( request_type=product_search_service.ListProductSetsRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -986,13 +1028,15 @@ async def test_list_product_sets_async_from_dict(): def test_list_product_sets_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.ListProductSetsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1008,7 +1052,10 @@ def test_list_product_sets_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1021,7 +1068,7 @@ async def test_list_product_sets_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.ListProductSetsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1039,11 +1086,16 @@ async def test_list_product_sets_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_product_sets_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1053,7 +1105,9 @@ def test_list_product_sets_flattened(): call.return_value = product_search_service.ListProductSetsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_product_sets(parent="parent_value",) + client.list_product_sets( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1065,13 +1119,16 @@ def test_list_product_sets_flattened(): def test_list_product_sets_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_product_sets( - product_search_service.ListProductSetsRequest(), parent="parent_value", + product_search_service.ListProductSetsRequest(), + parent="parent_value", ) @@ -1093,7 +1150,9 @@ async def test_list_product_sets_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_product_sets(parent="parent_value",) + response = await client.list_product_sets( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1114,13 +1173,15 @@ async def test_list_product_sets_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_product_sets( - product_search_service.ListProductSetsRequest(), parent="parent_value", + product_search_service.ListProductSetsRequest(), + parent="parent_value", ) def test_list_product_sets_pager(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1138,10 +1199,13 @@ def test_list_product_sets_pager(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListProductSetsResponse( - product_sets=[], next_page_token="def", + product_sets=[], + next_page_token="def", ), product_search_service.ListProductSetsResponse( - product_sets=[product_search_service.ProductSet(),], + product_sets=[ + product_search_service.ProductSet(), + ], next_page_token="ghi", ), product_search_service.ListProductSetsResponse( @@ -1161,14 +1225,15 @@ def test_list_product_sets_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, product_search_service.ProductSet) for i in results) def test_list_product_sets_pages(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1186,10 +1251,13 @@ def test_list_product_sets_pages(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListProductSetsResponse( - product_sets=[], next_page_token="def", + product_sets=[], + next_page_token="def", ), product_search_service.ListProductSetsResponse( - product_sets=[product_search_service.ProductSet(),], + product_sets=[ + product_search_service.ProductSet(), + ], next_page_token="ghi", ), product_search_service.ListProductSetsResponse( @@ -1207,7 +1275,9 @@ def test_list_product_sets_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_product_sets_async_pager(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1226,10 +1296,13 @@ async def test_list_product_sets_async_pager(): next_page_token="abc", ), product_search_service.ListProductSetsResponse( - product_sets=[], next_page_token="def", + product_sets=[], + next_page_token="def", ), product_search_service.ListProductSetsResponse( - product_sets=[product_search_service.ProductSet(),], + product_sets=[ + product_search_service.ProductSet(), + ], next_page_token="ghi", ), product_search_service.ListProductSetsResponse( @@ -1240,10 +1313,12 @@ async def test_list_product_sets_async_pager(): ), RuntimeError, ) - async_pager = await client.list_product_sets(request={},) + async_pager = await client.list_product_sets( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -1252,7 +1327,9 @@ async def test_list_product_sets_async_pager(): @pytest.mark.asyncio async def test_list_product_sets_async_pages(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1271,10 +1348,13 @@ async def test_list_product_sets_async_pages(): next_page_token="abc", ), product_search_service.ListProductSetsResponse( - product_sets=[], next_page_token="def", + product_sets=[], + next_page_token="def", ), product_search_service.ListProductSetsResponse( - product_sets=[product_search_service.ProductSet(),], + product_sets=[ + product_search_service.ProductSet(), + ], next_page_token="ghi", ), product_search_service.ListProductSetsResponse( @@ -1286,18 +1366,25 @@ async def test_list_product_sets_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_product_sets(request={})).pages: + async for page_ in ( + await client.list_product_sets(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [product_search_service.GetProductSetRequest, dict,] + "request_type", + [ + product_search_service.GetProductSetRequest, + dict, + ], ) def test_get_product_set(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1308,7 +1395,8 @@ def test_get_product_set(request_type, transport: str = "grpc"): with mock.patch.object(type(client.transport.get_product_set), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = product_search_service.ProductSet( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) response = client.get_product_set(request) @@ -1327,7 +1415,8 @@ def test_get_product_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1344,7 +1433,8 @@ async def test_get_product_set_async( request_type=product_search_service.GetProductSetRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1356,7 +1446,8 @@ async def test_get_product_set_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( product_search_service.ProductSet( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) ) response = await client.get_product_set(request) @@ -1378,13 +1469,15 @@ async def test_get_product_set_async_from_dict(): def test_get_product_set_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.GetProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_product_set), "__call__") as call: @@ -1398,7 +1491,10 @@ def test_get_product_set_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1411,7 +1507,7 @@ async def test_get_product_set_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.GetProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_product_set), "__call__") as call: @@ -1427,11 +1523,16 @@ async def test_get_product_set_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_product_set_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_product_set), "__call__") as call: @@ -1439,7 +1540,9 @@ def test_get_product_set_flattened(): call.return_value = product_search_service.ProductSet() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_product_set(name="name_value",) + client.get_product_set( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1451,13 +1554,16 @@ def test_get_product_set_flattened(): def test_get_product_set_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_product_set( - product_search_service.GetProductSetRequest(), name="name_value", + product_search_service.GetProductSetRequest(), + name="name_value", ) @@ -1477,7 +1583,9 @@ async def test_get_product_set_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_product_set(name="name_value",) + response = await client.get_product_set( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1498,16 +1606,22 @@ async def test_get_product_set_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_product_set( - product_search_service.GetProductSetRequest(), name="name_value", + product_search_service.GetProductSetRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [product_search_service.UpdateProductSetRequest, dict,] + "request_type", + [ + product_search_service.UpdateProductSetRequest, + dict, + ], ) def test_update_product_set(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1520,7 +1634,8 @@ def test_update_product_set(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = product_search_service.ProductSet( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) response = client.update_product_set(request) @@ -1539,7 +1654,8 @@ def test_update_product_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1558,7 +1674,8 @@ async def test_update_product_set_async( request_type=product_search_service.UpdateProductSetRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1572,7 +1689,8 @@ async def test_update_product_set_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( product_search_service.ProductSet( - name="name_value", display_name="display_name_value", + name="name_value", + display_name="display_name_value", ) ) response = await client.update_product_set(request) @@ -1594,13 +1712,15 @@ async def test_update_product_set_async_from_dict(): def test_update_product_set_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.UpdateProductSetRequest() - request.product_set.name = "product_set.name/value" + request.product_set.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1616,9 +1736,10 @@ def test_update_product_set_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "product_set.name=product_set.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "product_set.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1631,7 +1752,7 @@ async def test_update_product_set_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.UpdateProductSetRequest() - request.product_set.name = "product_set.name/value" + request.product_set.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1649,13 +1770,16 @@ async def test_update_product_set_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "product_set.name=product_set.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "product_set.name=name_value", + ) in kw["metadata"] def test_update_product_set_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1683,7 +1807,9 @@ def test_update_product_set_flattened(): def test_update_product_set_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -1747,11 +1873,16 @@ async def test_update_product_set_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [product_search_service.DeleteProductSetRequest, dict,] + "request_type", + [ + product_search_service.DeleteProductSetRequest, + dict, + ], ) def test_delete_product_set(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1779,7 +1910,8 @@ def test_delete_product_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -1798,7 +1930,8 @@ async def test_delete_product_set_async( request_type=product_search_service.DeleteProductSetRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1828,13 +1961,15 @@ async def test_delete_product_set_async_from_dict(): def test_delete_product_set_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.DeleteProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1850,7 +1985,10 @@ def test_delete_product_set_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -1863,7 +2001,7 @@ async def test_delete_product_set_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.DeleteProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1879,11 +2017,16 @@ async def test_delete_product_set_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_product_set_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -1893,7 +2036,9 @@ def test_delete_product_set_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_product_set(name="name_value",) + client.delete_product_set( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1905,13 +2050,16 @@ def test_delete_product_set_flattened(): def test_delete_product_set_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_product_set( - product_search_service.DeleteProductSetRequest(), name="name_value", + product_search_service.DeleteProductSetRequest(), + name="name_value", ) @@ -1931,7 +2079,9 @@ async def test_delete_product_set_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_product_set(name="name_value",) + response = await client.delete_product_set( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -1952,16 +2102,22 @@ async def test_delete_product_set_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_product_set( - product_search_service.DeleteProductSetRequest(), name="name_value", + product_search_service.DeleteProductSetRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [product_search_service.CreateProductRequest, dict,] + "request_type", + [ + product_search_service.CreateProductRequest, + dict, + ], ) def test_create_product(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -1996,7 +2152,8 @@ def test_create_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2013,7 +2170,8 @@ async def test_create_product_async( request_type=product_search_service.CreateProductRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2052,13 +2210,15 @@ async def test_create_product_async_from_dict(): def test_create_product_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.CreateProductRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_product), "__call__") as call: @@ -2072,7 +2232,10 @@ def test_create_product_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2085,7 +2248,7 @@ async def test_create_product_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.CreateProductRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_product), "__call__") as call: @@ -2101,11 +2264,16 @@ async def test_create_product_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_product_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.create_product), "__call__") as call: @@ -2135,7 +2303,9 @@ def test_create_product_flattened(): def test_create_product_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -2203,11 +2373,16 @@ async def test_create_product_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [product_search_service.ListProductsRequest, dict,] + "request_type", + [ + product_search_service.ListProductsRequest, + dict, + ], ) def test_list_products(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2236,7 +2411,8 @@ def test_list_products_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2253,7 +2429,8 @@ async def test_list_products_async( request_type=product_search_service.ListProductsRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2286,13 +2463,15 @@ async def test_list_products_async_from_dict(): def test_list_products_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.ListProductsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_products), "__call__") as call: @@ -2306,7 +2485,10 @@ def test_list_products_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2319,7 +2501,7 @@ async def test_list_products_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.ListProductsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_products), "__call__") as call: @@ -2335,11 +2517,16 @@ async def test_list_products_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_products_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.list_products), "__call__") as call: @@ -2347,7 +2534,9 @@ def test_list_products_flattened(): call.return_value = product_search_service.ListProductsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_products(parent="parent_value",) + client.list_products( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2359,13 +2548,16 @@ def test_list_products_flattened(): def test_list_products_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_products( - product_search_service.ListProductsRequest(), parent="parent_value", + product_search_service.ListProductsRequest(), + parent="parent_value", ) @@ -2385,7 +2577,9 @@ async def test_list_products_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_products(parent="parent_value",) + response = await client.list_products( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2406,13 +2600,15 @@ async def test_list_products_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_products( - product_search_service.ListProductsRequest(), parent="parent_value", + product_search_service.ListProductsRequest(), + parent="parent_value", ) def test_list_products_pager(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2428,10 +2624,14 @@ def test_list_products_pager(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListProductsResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsResponse( products=[ @@ -2450,14 +2650,15 @@ def test_list_products_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, product_search_service.Product) for i in results) def test_list_products_pages(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2473,10 +2674,14 @@ def test_list_products_pages(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListProductsResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsResponse( products=[ @@ -2493,7 +2698,9 @@ def test_list_products_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_products_async_pager(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2510,10 +2717,14 @@ async def test_list_products_async_pager(): next_page_token="abc", ), product_search_service.ListProductsResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsResponse( products=[ @@ -2523,10 +2734,12 @@ async def test_list_products_async_pager(): ), RuntimeError, ) - async_pager = await client.list_products(request={},) + async_pager = await client.list_products( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -2535,7 +2748,9 @@ async def test_list_products_async_pager(): @pytest.mark.asyncio async def test_list_products_async_pages(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -2552,10 +2767,14 @@ async def test_list_products_async_pages(): next_page_token="abc", ), product_search_service.ListProductsResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsResponse( products=[ @@ -2566,18 +2785,25 @@ async def test_list_products_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_products(request={})).pages: + async for page_ in ( + await client.list_products(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [product_search_service.GetProductRequest, dict,] + "request_type", + [ + product_search_service.GetProductRequest, + dict, + ], ) def test_get_product(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2612,7 +2838,8 @@ def test_get_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2629,7 +2856,8 @@ async def test_get_product_async( request_type=product_search_service.GetProductRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2668,13 +2896,15 @@ async def test_get_product_async_from_dict(): def test_get_product_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.GetProductRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_product), "__call__") as call: @@ -2688,7 +2918,10 @@ def test_get_product_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2701,7 +2934,7 @@ async def test_get_product_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.GetProductRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_product), "__call__") as call: @@ -2717,11 +2950,16 @@ async def test_get_product_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_product_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.get_product), "__call__") as call: @@ -2729,7 +2967,9 @@ def test_get_product_flattened(): call.return_value = product_search_service.Product() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_product(name="name_value",) + client.get_product( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2741,13 +2981,16 @@ def test_get_product_flattened(): def test_get_product_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_product( - product_search_service.GetProductRequest(), name="name_value", + product_search_service.GetProductRequest(), + name="name_value", ) @@ -2767,7 +3010,9 @@ async def test_get_product_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_product(name="name_value",) + response = await client.get_product( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -2788,16 +3033,22 @@ async def test_get_product_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_product( - product_search_service.GetProductRequest(), name="name_value", + product_search_service.GetProductRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [product_search_service.UpdateProductRequest, dict,] + "request_type", + [ + product_search_service.UpdateProductRequest, + dict, + ], ) def test_update_product(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2832,7 +3083,8 @@ def test_update_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -2849,7 +3101,8 @@ async def test_update_product_async( request_type=product_search_service.UpdateProductRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -2888,13 +3141,15 @@ async def test_update_product_async_from_dict(): def test_update_product_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.UpdateProductRequest() - request.product.name = "product.name/value" + request.product.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_product), "__call__") as call: @@ -2908,9 +3163,10 @@ def test_update_product_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "product.name=product.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "product.name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -2923,7 +3179,7 @@ async def test_update_product_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.UpdateProductRequest() - request.product.name = "product.name/value" + request.product.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_product), "__call__") as call: @@ -2939,13 +3195,16 @@ async def test_update_product_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "product.name=product.name/value",) in kw[ - "metadata" - ] + assert ( + "x-goog-request-params", + "product.name=name_value", + ) in kw["metadata"] def test_update_product_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.update_product), "__call__") as call: @@ -2971,7 +3230,9 @@ def test_update_product_flattened(): def test_update_product_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3033,11 +3294,16 @@ async def test_update_product_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [product_search_service.DeleteProductRequest, dict,] + "request_type", + [ + product_search_service.DeleteProductRequest, + dict, + ], ) def test_delete_product(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3063,7 +3329,8 @@ def test_delete_product_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3080,7 +3347,8 @@ async def test_delete_product_async( request_type=product_search_service.DeleteProductRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3108,13 +3376,15 @@ async def test_delete_product_async_from_dict(): def test_delete_product_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.DeleteProductRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_product), "__call__") as call: @@ -3128,7 +3398,10 @@ def test_delete_product_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3141,7 +3414,7 @@ async def test_delete_product_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.DeleteProductRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_product), "__call__") as call: @@ -3155,11 +3428,16 @@ async def test_delete_product_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_product_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.delete_product), "__call__") as call: @@ -3167,8 +3445,10 @@ def test_delete_product_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_product(name="name_value",) - + client.delete_product( + name="name_value", + ) + # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 @@ -3179,13 +3459,16 @@ def test_delete_product_flattened(): def test_delete_product_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_product( - product_search_service.DeleteProductRequest(), name="name_value", + product_search_service.DeleteProductRequest(), + name="name_value", ) @@ -3203,7 +3486,9 @@ async def test_delete_product_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_product(name="name_value",) + response = await client.delete_product( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3224,16 +3509,22 @@ async def test_delete_product_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_product( - product_search_service.DeleteProductRequest(), name="name_value", + product_search_service.DeleteProductRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [product_search_service.CreateReferenceImageRequest, dict,] + "request_type", + [ + product_search_service.CreateReferenceImageRequest, + dict, + ], ) def test_create_reference_image(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3246,7 +3537,8 @@ def test_create_reference_image(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = product_search_service.ReferenceImage( - name="name_value", uri="uri_value", + name="name_value", + uri="uri_value", ) response = client.create_reference_image(request) @@ -3265,7 +3557,8 @@ def test_create_reference_image_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3284,7 +3577,8 @@ async def test_create_reference_image_async( request_type=product_search_service.CreateReferenceImageRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3297,7 +3591,10 @@ async def test_create_reference_image_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - product_search_service.ReferenceImage(name="name_value", uri="uri_value",) + product_search_service.ReferenceImage( + name="name_value", + uri="uri_value", + ) ) response = await client.create_reference_image(request) @@ -3318,13 +3615,15 @@ async def test_create_reference_image_async_from_dict(): def test_create_reference_image_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.CreateReferenceImageRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3340,7 +3639,10 @@ def test_create_reference_image_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3353,7 +3655,7 @@ async def test_create_reference_image_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.CreateReferenceImageRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3371,11 +3673,16 @@ async def test_create_reference_image_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_create_reference_image_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3407,7 +3714,9 @@ def test_create_reference_image_flattened(): def test_create_reference_image_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -3477,11 +3786,16 @@ async def test_create_reference_image_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [product_search_service.DeleteReferenceImageRequest, dict,] + "request_type", + [ + product_search_service.DeleteReferenceImageRequest, + dict, + ], ) def test_delete_reference_image(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3509,7 +3823,8 @@ def test_delete_reference_image_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3528,7 +3843,8 @@ async def test_delete_reference_image_async( request_type=product_search_service.DeleteReferenceImageRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3558,13 +3874,15 @@ async def test_delete_reference_image_async_from_dict(): def test_delete_reference_image_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.DeleteReferenceImageRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3580,7 +3898,10 @@ def test_delete_reference_image_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3593,7 +3914,7 @@ async def test_delete_reference_image_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.DeleteReferenceImageRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3609,11 +3930,16 @@ async def test_delete_reference_image_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_delete_reference_image_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3623,7 +3949,9 @@ def test_delete_reference_image_flattened(): call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_reference_image(name="name_value",) + client.delete_reference_image( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3635,13 +3963,16 @@ def test_delete_reference_image_flattened(): def test_delete_reference_image_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.delete_reference_image( - product_search_service.DeleteReferenceImageRequest(), name="name_value", + product_search_service.DeleteReferenceImageRequest(), + name="name_value", ) @@ -3661,7 +3992,9 @@ async def test_delete_reference_image_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_reference_image(name="name_value",) + response = await client.delete_reference_image( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3682,16 +4015,22 @@ async def test_delete_reference_image_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.delete_reference_image( - product_search_service.DeleteReferenceImageRequest(), name="name_value", + product_search_service.DeleteReferenceImageRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [product_search_service.ListReferenceImagesRequest, dict,] + "request_type", + [ + product_search_service.ListReferenceImagesRequest, + dict, + ], ) def test_list_reference_images(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3704,7 +4043,8 @@ def test_list_reference_images(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = product_search_service.ListReferenceImagesResponse( - page_size=951, next_page_token="next_page_token_value", + page_size=951, + next_page_token="next_page_token_value", ) response = client.list_reference_images(request) @@ -3723,7 +4063,8 @@ def test_list_reference_images_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3742,7 +4083,8 @@ async def test_list_reference_images_async( request_type=product_search_service.ListReferenceImagesRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -3756,7 +4098,8 @@ async def test_list_reference_images_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( product_search_service.ListReferenceImagesResponse( - page_size=951, next_page_token="next_page_token_value", + page_size=951, + next_page_token="next_page_token_value", ) ) response = await client.list_reference_images(request) @@ -3778,13 +4121,15 @@ async def test_list_reference_images_async_from_dict(): def test_list_reference_images_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.ListReferenceImagesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3800,7 +4145,10 @@ def test_list_reference_images_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -3813,7 +4161,7 @@ async def test_list_reference_images_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.ListReferenceImagesRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3831,11 +4179,16 @@ async def test_list_reference_images_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_list_reference_images_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -3845,7 +4198,9 @@ def test_list_reference_images_flattened(): call.return_value = product_search_service.ListReferenceImagesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_reference_images(parent="parent_value",) + client.list_reference_images( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3857,13 +4212,16 @@ def test_list_reference_images_flattened(): def test_list_reference_images_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_reference_images( - product_search_service.ListReferenceImagesRequest(), parent="parent_value", + product_search_service.ListReferenceImagesRequest(), + parent="parent_value", ) @@ -3885,7 +4243,9 @@ async def test_list_reference_images_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_reference_images(parent="parent_value",) + response = await client.list_reference_images( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -3906,13 +4266,15 @@ async def test_list_reference_images_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_reference_images( - product_search_service.ListReferenceImagesRequest(), parent="parent_value", + product_search_service.ListReferenceImagesRequest(), + parent="parent_value", ) def test_list_reference_images_pager(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3930,10 +4292,13 @@ def test_list_reference_images_pager(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListReferenceImagesResponse( - reference_images=[], next_page_token="def", + reference_images=[], + next_page_token="def", ), product_search_service.ListReferenceImagesResponse( - reference_images=[product_search_service.ReferenceImage(),], + reference_images=[ + product_search_service.ReferenceImage(), + ], next_page_token="ghi", ), product_search_service.ListReferenceImagesResponse( @@ -3953,7 +4318,7 @@ def test_list_reference_images_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all( isinstance(i, product_search_service.ReferenceImage) for i in results @@ -3962,7 +4327,8 @@ def test_list_reference_images_pager(transport_name: str = "grpc"): def test_list_reference_images_pages(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -3980,10 +4346,13 @@ def test_list_reference_images_pages(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListReferenceImagesResponse( - reference_images=[], next_page_token="def", + reference_images=[], + next_page_token="def", ), product_search_service.ListReferenceImagesResponse( - reference_images=[product_search_service.ReferenceImage(),], + reference_images=[ + product_search_service.ReferenceImage(), + ], next_page_token="ghi", ), product_search_service.ListReferenceImagesResponse( @@ -4001,7 +4370,9 @@ def test_list_reference_images_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_reference_images_async_pager(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4020,10 +4391,13 @@ async def test_list_reference_images_async_pager(): next_page_token="abc", ), product_search_service.ListReferenceImagesResponse( - reference_images=[], next_page_token="def", + reference_images=[], + next_page_token="def", ), product_search_service.ListReferenceImagesResponse( - reference_images=[product_search_service.ReferenceImage(),], + reference_images=[ + product_search_service.ReferenceImage(), + ], next_page_token="ghi", ), product_search_service.ListReferenceImagesResponse( @@ -4034,10 +4408,12 @@ async def test_list_reference_images_async_pager(): ), RuntimeError, ) - async_pager = await client.list_reference_images(request={},) + async_pager = await client.list_reference_images( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -4048,7 +4424,9 @@ async def test_list_reference_images_async_pager(): @pytest.mark.asyncio async def test_list_reference_images_async_pages(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4067,10 +4445,13 @@ async def test_list_reference_images_async_pages(): next_page_token="abc", ), product_search_service.ListReferenceImagesResponse( - reference_images=[], next_page_token="def", + reference_images=[], + next_page_token="def", ), product_search_service.ListReferenceImagesResponse( - reference_images=[product_search_service.ReferenceImage(),], + reference_images=[ + product_search_service.ReferenceImage(), + ], next_page_token="ghi", ), product_search_service.ListReferenceImagesResponse( @@ -4082,18 +4463,25 @@ async def test_list_reference_images_async_pages(): RuntimeError, ) pages = [] - async for page_ in (await client.list_reference_images(request={})).pages: + async for page_ in ( + await client.list_reference_images(request={}) + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [product_search_service.GetReferenceImageRequest, dict,] + "request_type", + [ + product_search_service.GetReferenceImageRequest, + dict, + ], ) def test_get_reference_image(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4106,7 +4494,8 @@ def test_get_reference_image(request_type, transport: str = "grpc"): ) as call: # Designate an appropriate return value for the call. call.return_value = product_search_service.ReferenceImage( - name="name_value", uri="uri_value", + name="name_value", + uri="uri_value", ) response = client.get_reference_image(request) @@ -4125,7 +4514,8 @@ def test_get_reference_image_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4144,7 +4534,8 @@ async def test_get_reference_image_async( request_type=product_search_service.GetReferenceImageRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4157,7 +4548,10 @@ async def test_get_reference_image_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - product_search_service.ReferenceImage(name="name_value", uri="uri_value",) + product_search_service.ReferenceImage( + name="name_value", + uri="uri_value", + ) ) response = await client.get_reference_image(request) @@ -4178,13 +4572,15 @@ async def test_get_reference_image_async_from_dict(): def test_get_reference_image_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.GetReferenceImageRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4200,7 +4596,10 @@ def test_get_reference_image_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4213,7 +4612,7 @@ async def test_get_reference_image_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.GetReferenceImageRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4231,11 +4630,16 @@ async def test_get_reference_image_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_get_reference_image_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4245,7 +4649,9 @@ def test_get_reference_image_flattened(): call.return_value = product_search_service.ReferenceImage() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_reference_image(name="name_value",) + client.get_reference_image( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4257,13 +4663,16 @@ def test_get_reference_image_flattened(): def test_get_reference_image_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.get_reference_image( - product_search_service.GetReferenceImageRequest(), name="name_value", + product_search_service.GetReferenceImageRequest(), + name="name_value", ) @@ -4285,7 +4694,9 @@ async def test_get_reference_image_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_reference_image(name="name_value",) + response = await client.get_reference_image( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4306,16 +4717,22 @@ async def test_get_reference_image_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.get_reference_image( - product_search_service.GetReferenceImageRequest(), name="name_value", + product_search_service.GetReferenceImageRequest(), + name="name_value", ) @pytest.mark.parametrize( - "request_type", [product_search_service.AddProductToProductSetRequest, dict,] + "request_type", + [ + product_search_service.AddProductToProductSetRequest, + dict, + ], ) def test_add_product_to_product_set(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4343,7 +4760,8 @@ def test_add_product_to_product_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4362,7 +4780,8 @@ async def test_add_product_to_product_set_async( request_type=product_search_service.AddProductToProductSetRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4392,13 +4811,15 @@ async def test_add_product_to_product_set_async_from_dict(): def test_add_product_to_product_set_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.AddProductToProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4414,7 +4835,10 @@ def test_add_product_to_product_set_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4427,7 +4851,7 @@ async def test_add_product_to_product_set_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.AddProductToProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4443,11 +4867,16 @@ async def test_add_product_to_product_set_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_add_product_to_product_set_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4458,7 +4887,8 @@ def test_add_product_to_product_set_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.add_product_to_product_set( - name="name_value", product="product_value", + name="name_value", + product="product_value", ) # Establish that the underlying call was made with the expected @@ -4474,7 +4904,9 @@ def test_add_product_to_product_set_flattened(): def test_add_product_to_product_set_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4503,7 +4935,8 @@ async def test_add_product_to_product_set_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.add_product_to_product_set( - name="name_value", product="product_value", + name="name_value", + product="product_value", ) # Establish that the underlying call was made with the expected @@ -4535,11 +4968,16 @@ async def test_add_product_to_product_set_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [product_search_service.RemoveProductFromProductSetRequest, dict,] + "request_type", + [ + product_search_service.RemoveProductFromProductSetRequest, + dict, + ], ) def test_remove_product_from_product_set(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4567,7 +5005,8 @@ def test_remove_product_from_product_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4586,7 +5025,8 @@ async def test_remove_product_from_product_set_async( request_type=product_search_service.RemoveProductFromProductSetRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4616,13 +5056,15 @@ async def test_remove_product_from_product_set_async_from_dict(): def test_remove_product_from_product_set_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.RemoveProductFromProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4638,7 +5080,10 @@ def test_remove_product_from_product_set_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4651,7 +5096,7 @@ async def test_remove_product_from_product_set_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.RemoveProductFromProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4667,11 +5112,16 @@ async def test_remove_product_from_product_set_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_remove_product_from_product_set_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4682,7 +5132,8 @@ def test_remove_product_from_product_set_flattened(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. client.remove_product_from_product_set( - name="name_value", product="product_value", + name="name_value", + product="product_value", ) # Establish that the underlying call was made with the expected @@ -4698,7 +5149,9 @@ def test_remove_product_from_product_set_flattened(): def test_remove_product_from_product_set_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -4727,7 +5180,8 @@ async def test_remove_product_from_product_set_flattened_async(): # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. response = await client.remove_product_from_product_set( - name="name_value", product="product_value", + name="name_value", + product="product_value", ) # Establish that the underlying call was made with the expected @@ -4759,11 +5213,16 @@ async def test_remove_product_from_product_set_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [product_search_service.ListProductsInProductSetRequest, dict,] + "request_type", + [ + product_search_service.ListProductsInProductSetRequest, + dict, + ], ) def test_list_products_in_product_set(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4794,7 +5253,8 @@ def test_list_products_in_product_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -4813,7 +5273,8 @@ async def test_list_products_in_product_set_async( request_type=product_search_service.ListProductsInProductSetRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -4848,13 +5309,15 @@ async def test_list_products_in_product_set_async_from_dict(): def test_list_products_in_product_set_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.ListProductsInProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4870,7 +5333,10 @@ def test_list_products_in_product_set_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -4883,7 +5349,7 @@ async def test_list_products_in_product_set_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.ListProductsInProductSetRequest() - request.name = "name/value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4901,11 +5367,16 @@ async def test_list_products_in_product_set_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] def test_list_products_in_product_set_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -4915,7 +5386,9 @@ def test_list_products_in_product_set_flattened(): call.return_value = product_search_service.ListProductsInProductSetResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_products_in_product_set(name="name_value",) + client.list_products_in_product_set( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4927,13 +5400,16 @@ def test_list_products_in_product_set_flattened(): def test_list_products_in_product_set_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.list_products_in_product_set( - product_search_service.ListProductsInProductSetRequest(), name="name_value", + product_search_service.ListProductsInProductSetRequest(), + name="name_value", ) @@ -4955,7 +5431,9 @@ async def test_list_products_in_product_set_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_products_in_product_set(name="name_value",) + response = await client.list_products_in_product_set( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -4976,13 +5454,15 @@ async def test_list_products_in_product_set_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.list_products_in_product_set( - product_search_service.ListProductsInProductSetRequest(), name="name_value", + product_search_service.ListProductsInProductSetRequest(), + name="name_value", ) def test_list_products_in_product_set_pager(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5000,10 +5480,14 @@ def test_list_products_in_product_set_pager(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListProductsInProductSetResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsInProductSetResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsInProductSetResponse( products=[ @@ -5022,14 +5506,15 @@ def test_list_products_in_product_set_pager(transport_name: str = "grpc"): assert pager._metadata == metadata - results = [i for i in pager] + results = list(pager) assert len(results) == 6 assert all(isinstance(i, product_search_service.Product) for i in results) def test_list_products_in_product_set_pages(transport_name: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials, transport=transport_name, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5047,10 +5532,14 @@ def test_list_products_in_product_set_pages(transport_name: str = "grpc"): next_page_token="abc", ), product_search_service.ListProductsInProductSetResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsInProductSetResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsInProductSetResponse( products=[ @@ -5067,7 +5556,9 @@ def test_list_products_in_product_set_pages(transport_name: str = "grpc"): @pytest.mark.asyncio async def test_list_products_in_product_set_async_pager(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5086,10 +5577,14 @@ async def test_list_products_in_product_set_async_pager(): next_page_token="abc", ), product_search_service.ListProductsInProductSetResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsInProductSetResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsInProductSetResponse( products=[ @@ -5099,10 +5594,12 @@ async def test_list_products_in_product_set_async_pager(): ), RuntimeError, ) - async_pager = await client.list_products_in_product_set(request={},) + async_pager = await client.list_products_in_product_set( + request={}, + ) assert async_pager.next_page_token == "abc" responses = [] - async for response in async_pager: + async for response in async_pager: # pragma: no branch responses.append(response) assert len(responses) == 6 @@ -5111,7 +5608,9 @@ async def test_list_products_in_product_set_async_pager(): @pytest.mark.asyncio async def test_list_products_in_product_set_async_pages(): - client = ProductSearchAsyncClient(credentials=ga_credentials.AnonymousCredentials,) + client = ProductSearchAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5130,10 +5629,14 @@ async def test_list_products_in_product_set_async_pages(): next_page_token="abc", ), product_search_service.ListProductsInProductSetResponse( - products=[], next_page_token="def", + products=[], + next_page_token="def", ), product_search_service.ListProductsInProductSetResponse( - products=[product_search_service.Product(),], next_page_token="ghi", + products=[ + product_search_service.Product(), + ], + next_page_token="ghi", ), product_search_service.ListProductsInProductSetResponse( products=[ @@ -5146,18 +5649,23 @@ async def test_list_products_in_product_set_async_pages(): pages = [] async for page_ in ( await client.list_products_in_product_set(request={}) - ).pages: + ).pages: # pragma: no branch pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( - "request_type", [product_search_service.ImportProductSetsRequest, dict,] + "request_type", + [ + product_search_service.ImportProductSetsRequest, + dict, + ], ) def test_import_product_sets(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5185,7 +5693,8 @@ def test_import_product_sets_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5204,7 +5713,8 @@ async def test_import_product_sets_async( request_type=product_search_service.ImportProductSetsRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5236,13 +5746,15 @@ async def test_import_product_sets_async_from_dict(): def test_import_product_sets_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.ImportProductSetsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5258,7 +5770,10 @@ def test_import_product_sets_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -5271,7 +5786,7 @@ async def test_import_product_sets_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.ImportProductSetsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5289,11 +5804,16 @@ async def test_import_product_sets_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_import_product_sets_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( @@ -5329,7 +5849,9 @@ def test_import_product_sets_flattened(): def test_import_product_sets_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. @@ -5409,11 +5931,16 @@ async def test_import_product_sets_flattened_error_async(): @pytest.mark.parametrize( - "request_type", [product_search_service.PurgeProductsRequest, dict,] + "request_type", + [ + product_search_service.PurgeProductsRequest, + dict, + ], ) def test_purge_products(request_type, transport: str = "grpc"): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5439,7 +5966,8 @@ def test_purge_products_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. @@ -5456,7 +5984,8 @@ async def test_purge_products_async( request_type=product_search_service.PurgeProductsRequest, ): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # Everything is optional in proto3 as far as the runtime is concerned, @@ -5486,13 +6015,15 @@ async def test_purge_products_async_from_dict(): def test_purge_products_field_headers(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. request = product_search_service.PurgeProductsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.purge_products), "__call__") as call: @@ -5506,7 +6037,10 @@ def test_purge_products_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.asyncio @@ -5519,7 +6053,7 @@ async def test_purge_products_field_headers_async(): # a field header. Set these to a non-empty value. request = product_search_service.PurgeProductsRequest() - request.parent = "parent/value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.purge_products), "__call__") as call: @@ -5535,11 +6069,16 @@ async def test_purge_products_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] def test_purge_products_flattened(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object(type(client.transport.purge_products), "__call__") as call: @@ -5547,7 +6086,9 @@ def test_purge_products_flattened(): call.return_value = operations_pb2.Operation(name="operations/op") # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.purge_products(parent="parent_value",) + client.purge_products( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5559,13 +6100,16 @@ def test_purge_products_flattened(): def test_purge_products_flattened_error(): - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): client.purge_products( - product_search_service.PurgeProductsRequest(), parent="parent_value", + product_search_service.PurgeProductsRequest(), + parent="parent_value", ) @@ -5585,7 +6129,9 @@ async def test_purge_products_flattened_async(): ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.purge_products(parent="parent_value",) + response = await client.purge_products( + parent="parent_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -5606,7 +6152,8 @@ async def test_purge_products_flattened_error_async(): # fields is an error. with pytest.raises(ValueError): await client.purge_products( - product_search_service.PurgeProductsRequest(), parent="parent_value", + product_search_service.PurgeProductsRequest(), + parent="parent_value", ) @@ -5617,7 +6164,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) # It is an error to provide a credentials file and a transport instance. @@ -5637,7 +6185,10 @@ def test_credentials_transport_error(): options = client_options.ClientOptions() options.api_key = "api_key" with pytest.raises(ValueError): - client = ProductSearchClient(client_options=options, transport=transport,) + client = ProductSearchClient( + client_options=options, + transport=transport, + ) # It is an error to provide an api_key and a credential. options = mock.Mock() @@ -5653,7 +6204,8 @@ def test_credentials_transport_error(): ) with pytest.raises(ValueError): client = ProductSearchClient( - client_options={"scopes": ["1", "2"]}, transport=transport, + client_options={"scopes": ["1", "2"]}, + transport=transport, ) @@ -5696,10 +6248,28 @@ def test_transport_adc(transport_class): adc.assert_called_once() +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + ], +) +def test_transport_kind(transport_name): + transport = ProductSearchClient.get_transport_class(transport_name)( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert transport.kind == transport_name + + def test_transport_grpc_default(): # A client should use the gRPC transport by default. - client = ProductSearchClient(credentials=ga_credentials.AnonymousCredentials(),) - assert isinstance(client.transport, transports.ProductSearchGrpcTransport,) + client = ProductSearchClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + assert isinstance( + client.transport, + transports.ProductSearchGrpcTransport, + ) def test_product_search_base_transport_error(): @@ -5756,6 +6326,14 @@ def test_product_search_base_transport(): with pytest.raises(NotImplementedError): transport.operations_client + # Catch all for all remaining methods and properties + remainder = [ + "kind", + ] + for r in remainder: + with pytest.raises(NotImplementedError): + getattr(transport, r)() + def test_product_search_base_transport_with_credentials_file(): # Instantiate the base transport with a credentials file @@ -5767,7 +6345,8 @@ def test_product_search_base_transport_with_credentials_file(): Transport.return_value = None load_creds.return_value = (ga_credentials.AnonymousCredentials(), None) transport = transports.ProductSearchTransport( - credentials_file="credentials.json", quota_project_id="octopus", + credentials_file="credentials.json", + quota_project_id="octopus", ) load_creds.assert_called_once_with( "credentials.json", @@ -5912,24 +6491,40 @@ def test_product_search_grpc_transport_client_cert_source_for_mtls(transport_cla ) -def test_product_search_host_no_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_product_search_host_no_port(transport_name): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="vision.googleapis.com" ), + transport=transport_name, ) - assert client.transport._host == "vision.googleapis.com:443" + assert client.transport._host == ("vision.googleapis.com:443") -def test_product_search_host_with_port(): +@pytest.mark.parametrize( + "transport_name", + [ + "grpc", + "grpc_asyncio", + ], +) +def test_product_search_host_with_port(transport_name): client = ProductSearchClient( credentials=ga_credentials.AnonymousCredentials(), client_options=client_options.ClientOptions( api_endpoint="vision.googleapis.com:8000" ), + transport=transport_name, ) - assert client.transport._host == "vision.googleapis.com:8000" + assert client.transport._host == ("vision.googleapis.com:8000") def test_product_search_grpc_transport_channel(): @@ -5937,7 +6532,8 @@ def test_product_search_grpc_transport_channel(): # Check that channel is used if provided. transport = transports.ProductSearchGrpcTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -5949,7 +6545,8 @@ def test_product_search_grpc_asyncio_transport_channel(): # Check that channel is used if provided. transport = transports.ProductSearchGrpcAsyncIOTransport( - host="squid.clam.whelk", channel=channel, + host="squid.clam.whelk", + channel=channel, ) assert transport.grpc_channel == channel assert transport._host == "squid.clam.whelk:443" @@ -6056,12 +6653,16 @@ def test_product_search_transport_channel_mtls_with_adc(transport_class): def test_product_search_grpc_lro_client(): client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -6069,12 +6670,16 @@ def test_product_search_grpc_lro_client(): def test_product_search_grpc_lro_async_client(): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) transport = client.transport # Ensure that we have a api-core operations client. - assert isinstance(transport.operations_client, operations_v1.OperationsAsyncClient,) + assert isinstance( + transport.operations_client, + operations_v1.OperationsAsyncClient, + ) # Ensure that subsequent calls to the property send the exact same object. assert transport.operations_client is transport.operations_client @@ -6085,7 +6690,9 @@ def test_product_path(): location = "clam" product = "whelk" expected = "projects/{project}/locations/{location}/products/{product}".format( - project=project, location=location, product=product, + project=project, + location=location, + product=product, ) actual = ProductSearchClient.product_path(project, location, product) assert expected == actual @@ -6108,8 +6715,12 @@ def test_product_set_path(): project = "cuttlefish" location = "mussel" product_set = "winkle" - expected = "projects/{project}/locations/{location}/productSets/{product_set}".format( - project=project, location=location, product_set=product_set, + expected = ( + "projects/{project}/locations/{location}/productSets/{product_set}".format( + project=project, + location=location, + product_set=product_set, + ) ) actual = ProductSearchClient.product_set_path(project, location, product_set) assert expected == actual @@ -6181,7 +6792,9 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): folder = "scallop" - expected = "folders/{folder}".format(folder=folder,) + expected = "folders/{folder}".format( + folder=folder, + ) actual = ProductSearchClient.common_folder_path(folder) assert expected == actual @@ -6199,7 +6812,9 @@ def test_parse_common_folder_path(): def test_common_organization_path(): organization = "squid" - expected = "organizations/{organization}".format(organization=organization,) + expected = "organizations/{organization}".format( + organization=organization, + ) actual = ProductSearchClient.common_organization_path(organization) assert expected == actual @@ -6217,7 +6832,9 @@ def test_parse_common_organization_path(): def test_common_project_path(): project = "whelk" - expected = "projects/{project}".format(project=project,) + expected = "projects/{project}".format( + project=project, + ) actual = ProductSearchClient.common_project_path(project) assert expected == actual @@ -6237,7 +6854,8 @@ def test_common_location_path(): project = "oyster" location = "nudibranch" expected = "projects/{project}/locations/{location}".format( - project=project, location=location, + project=project, + location=location, ) actual = ProductSearchClient.common_location_path(project, location) assert expected == actual @@ -6262,7 +6880,8 @@ def test_client_with_default_client_info(): transports.ProductSearchTransport, "_prep_wrapped_messages" ) as prep: client = ProductSearchClient( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6271,7 +6890,8 @@ def test_client_with_default_client_info(): ) as prep: transport_class = ProductSearchClient.get_transport_class() transport = transport_class( - credentials=ga_credentials.AnonymousCredentials(), client_info=client_info, + credentials=ga_credentials.AnonymousCredentials(), + client_info=client_info, ) prep.assert_called_once_with(client_info) @@ -6279,7 +6899,8 @@ def test_client_with_default_client_info(): @pytest.mark.asyncio async def test_transport_close_async(): client = ProductSearchAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc_asyncio", + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc_asyncio", ) with mock.patch.object( type(getattr(client.transport, "grpc_channel")), "close"