diff --git a/.librarian/generate-request.json b/.librarian/generate-request.json new file mode 100644 index 000000000000..31b573bd01da --- /dev/null +++ b/.librarian/generate-request.json @@ -0,0 +1,40 @@ +{ + "id": "google-cloud-vision", + "version": "3.12.0", + "apis": [ + { + "path": "google/cloud/vision/v1p3beta1", + "service_config": "vision_v1p3beta1.yaml" + }, + { + "path": "google/cloud/vision/v1", + "service_config": "vision_v1.yaml" + }, + { + "path": "google/cloud/vision/v1p1beta1", + "service_config": "vision_v1p1beta1.yaml" + }, + { + "path": "google/cloud/vision/v1p2beta1", + "service_config": "vision_v1p2beta1.yaml" + }, + { + "path": "google/cloud/vision/v1p4beta1", + "service_config": "vision_v1p4beta1.yaml" + } + ], + "source_roots": [ + "packages/google-cloud-vision" + ], + "preserve_regex": [ + "packages/google-cloud-vision/CHANGELOG.md", + "docs/CHANGELOG.md", + "samples/README.txt", + "samples/snippets/README.rst", + "tests/system" + ], + "remove_regex": [ + "packages/google-cloud-vision/" + ], + "tag_format": "{id}-v{version}" +} \ No newline at end of file diff --git a/packages/google-cloud-vision/google/cloud/vision_v1/services/image_annotator/async_client.py b/packages/google-cloud-vision/google/cloud/vision_v1/services/image_annotator/async_client.py index 6efcecc5173a..2f6b52e4a5df 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1/services/image_annotator/async_client.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1/services/image_annotator/async_client.py @@ -536,11 +536,9 @@ async def async_batch_annotate_images( r"""Run asynchronous image detection and annotation for a list of images. - Progress and results can be retrieved through the - ``google.longrunning.Operations`` interface. - ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains - ``AsyncBatchAnnotateImagesResponse`` (results). + Progress and results can be retrieved through the ``google.longrunning.Operations`` + interface. ``Operation.metadata`` contains ``OperationMetadata`` (metadata). + ``Operation.response`` contains ``AsyncBatchAnnotateImagesResponse`` (results). This service will write image annotation outputs to json files in customer GCS bucket, each json file containing @@ -679,9 +677,8 @@ async def async_batch_annotate_files( r"""Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be - retrieved through the ``google.longrunning.Operations`` - interface. ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains + retrieved through the ``google.longrunning.Operations`` interface. ``Operation.metadata`` + contains ``OperationMetadata`` (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` (results). .. code-block:: python diff --git a/packages/google-cloud-vision/google/cloud/vision_v1/services/image_annotator/client.py b/packages/google-cloud-vision/google/cloud/vision_v1/services/image_annotator/client.py index 76fbff8ab683..5e6a6e287e94 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1/services/image_annotator/client.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1/services/image_annotator/client.py @@ -993,11 +993,9 @@ def async_batch_annotate_images( r"""Run asynchronous image detection and annotation for a list of images. - Progress and results can be retrieved through the - ``google.longrunning.Operations`` interface. - ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains - ``AsyncBatchAnnotateImagesResponse`` (results). + Progress and results can be retrieved through the ``google.longrunning.Operations`` + interface. ``Operation.metadata`` contains ``OperationMetadata`` (metadata). + ``Operation.response`` contains ``AsyncBatchAnnotateImagesResponse`` (results). This service will write image annotation outputs to json files in customer GCS bucket, each json file containing @@ -1135,9 +1133,8 @@ def async_batch_annotate_files( r"""Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be - retrieved through the ``google.longrunning.Operations`` - interface. ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains + retrieved through the ``google.longrunning.Operations`` interface. ``Operation.metadata`` + contains ``OperationMetadata`` (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` (results). .. code-block:: python diff --git a/packages/google-cloud-vision/google/cloud/vision_v1/services/image_annotator/transports/base.py b/packages/google-cloud-vision/google/cloud/vision_v1/services/image_annotator/transports/base.py index 6444874ad13b..62943d99c81a 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1/services/image_annotator/transports/base.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1/services/image_annotator/transports/base.py @@ -86,8 +86,6 @@ def __init__( be used for service account credentials. """ - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} - # Save the scopes. self._scopes = scopes if not hasattr(self, "_ignore_credentials"): @@ -102,11 +100,16 @@ def __init__( if credentials_file is not None: credentials, _ = google.auth.load_credentials_from_file( - credentials_file, **scopes_kwargs, quota_project_id=quota_project_id + credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + default_scopes=self.AUTH_SCOPES, ) elif credentials is None and not self._ignore_credentials: credentials, _ = google.auth.default( - **scopes_kwargs, quota_project_id=quota_project_id + scopes=scopes, + quota_project_id=quota_project_id, + default_scopes=self.AUTH_SCOPES, ) # Don't apply audience if the credentials file passed from user. if hasattr(credentials, "with_gdch_audience"): diff --git a/packages/google-cloud-vision/google/cloud/vision_v1/services/image_annotator/transports/grpc.py b/packages/google-cloud-vision/google/cloud/vision_v1/services/image_annotator/transports/grpc.py index a4f87b772d49..1d6dfda01d67 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1/services/image_annotator/transports/grpc.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1/services/image_annotator/transports/grpc.py @@ -420,11 +420,9 @@ def async_batch_annotate_images( Run asynchronous image detection and annotation for a list of images. - Progress and results can be retrieved through the - ``google.longrunning.Operations`` interface. - ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains - ``AsyncBatchAnnotateImagesResponse`` (results). + Progress and results can be retrieved through the ``google.longrunning.Operations`` + interface. ``Operation.metadata`` contains ``OperationMetadata`` (metadata). + ``Operation.response`` contains ``AsyncBatchAnnotateImagesResponse`` (results). This service will write image annotation outputs to json files in customer GCS bucket, each json file containing @@ -461,9 +459,8 @@ def async_batch_annotate_files( Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be - retrieved through the ``google.longrunning.Operations`` - interface. ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains + retrieved through the ``google.longrunning.Operations`` interface. ``Operation.metadata`` + contains ``OperationMetadata`` (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` (results). Returns: diff --git a/packages/google-cloud-vision/google/cloud/vision_v1/services/image_annotator/transports/grpc_asyncio.py b/packages/google-cloud-vision/google/cloud/vision_v1/services/image_annotator/transports/grpc_asyncio.py index 1c8c7a631000..16166cfb6daa 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1/services/image_annotator/transports/grpc_asyncio.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1/services/image_annotator/transports/grpc_asyncio.py @@ -429,11 +429,9 @@ def async_batch_annotate_images( Run asynchronous image detection and annotation for a list of images. - Progress and results can be retrieved through the - ``google.longrunning.Operations`` interface. - ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains - ``AsyncBatchAnnotateImagesResponse`` (results). + Progress and results can be retrieved through the ``google.longrunning.Operations`` + interface. ``Operation.metadata`` contains ``OperationMetadata`` (metadata). + ``Operation.response`` contains ``AsyncBatchAnnotateImagesResponse`` (results). This service will write image annotation outputs to json files in customer GCS bucket, each json file containing @@ -471,9 +469,8 @@ def async_batch_annotate_files( Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be - retrieved through the ``google.longrunning.Operations`` - interface. ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains + retrieved through the ``google.longrunning.Operations`` interface. ``Operation.metadata`` + contains ``OperationMetadata`` (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` (results). Returns: diff --git a/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/async_client.py b/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/async_client.py index bf2a1db0a73a..6dae1e4fd412 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/async_client.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/async_client.py @@ -73,20 +73,20 @@ class ProductSearchAsyncClient: """Manages Products and ProductSets of reference images for use in product search. It uses the following resource model: - - The API has a collection of - [ProductSet][google.cloud.vision.v1.ProductSet] resources, named - ``projects/*/locations/*/productSets/*``, which acts as a way to - put different products into groups to limit identification. + - The API has a collection of `ProductSet `__ + + resources, named ``projects/*/locations/*/productSets/*``, which acts as a way to put different + products into groups to limit identification. In parallel, - - The API has a collection of - [Product][google.cloud.vision.v1.Product] resources, named - ``projects/*/locations/*/products/*`` + - The API has a collection of `Product `__ + + resources, named ``projects/*/locations/*/products/*`` + + - Each `Product `__ has a collection of - - Each [Product][google.cloud.vision.v1.Product] has a collection of - [ReferenceImage][google.cloud.vision.v1.ReferenceImage] resources, - named ``projects/*/locations/*/products/*/referenceImages/*`` + `ReferenceImage `__ resources, named ``projects/*/locations/*/products/*/referenceImages/*`` """ _client: ProductSearchClient @@ -335,7 +335,7 @@ async def create_product_set( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing, or is + * Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters. .. code-block:: python @@ -386,7 +386,8 @@ async def sample_create_product_set(): the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 - characters long. It cannot contain the character ``/``. + characters long. It cannot contain the character + ``/``. This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this @@ -476,7 +477,7 @@ async def list_product_sets( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100, or + * Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1. .. code-block:: python @@ -528,7 +529,7 @@ async def sample_list_product_sets(): Returns: google.cloud.vision_v1.services.product_search.pagers.ListProductSetsAsyncPager: - Response message for the ListProductSets method. + Response message for the ``ListProductSets`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -609,7 +610,7 @@ async def get_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. + * Returns NOT_FOUND if the ProductSet does not exist. .. code-block:: python @@ -643,8 +644,7 @@ async def sample_get_product_set(): name (:class:`str`): Required. Resource name of the ProductSet to get. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -732,8 +732,9 @@ async def update_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the ProductSet does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but missing from the request or longer than 4096 characters. @@ -773,10 +774,9 @@ async def sample_update_product_set(): on the ``request`` instance; if ``request`` is provided, this should not be set. update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - The [FieldMask][google.protobuf.FieldMask] that - specifies which fields to update. If update_mask isn't - specified, all mutable fields are to be updated. Valid - mask path is ``display_name``. + The `FieldMask `__ that specifies which fields to update. + If update_mask isn't specified, all mutable fields are + to be updated. Valid mask path is ``display_name``. This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this @@ -897,8 +897,7 @@ async def sample_delete_product_set(): name (:class:`str`): Required. Resource name of the ProductSet to delete. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -974,11 +973,13 @@ async def create_product( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing or longer + * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is longer than 4096 + + * Returns INVALID_ARGUMENT if description is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is missing or + + * Returns INVALID_ARGUMENT if product_category is missing or invalid. .. code-block:: python @@ -1029,7 +1030,8 @@ async def sample_create_product(): the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 - characters long. It cannot contain the character ``/``. + characters long. It cannot contain the character + ``/``. This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this @@ -1114,7 +1116,7 @@ async def list_products( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. .. code-block:: python @@ -1166,7 +1168,7 @@ async def sample_list_products(): Returns: google.cloud.vision_v1.services.product_search.pagers.ListProductsAsyncPager: - Response message for the ListProducts method. + Response message for the ``ListProducts`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1245,7 +1247,7 @@ async def get_product( Possible errors: - - Returns NOT_FOUND if the Product does not exist. + * Returns NOT_FOUND if the Product does not exist. .. code-block:: python @@ -1279,8 +1281,7 @@ async def sample_get_product(): name (:class:`str`): Required. Resource name of the Product to get. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -1359,20 +1360,24 @@ async def update_product( metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> product_search_service.Product: r"""Makes changes to a Product resource. Only the ``display_name``, - ``description``, and ``labels`` fields can be updated right now. + ``description``, and ``labels`` fields can be updated right + now. If labels are updated, the change will not be reflected in queries until the next index time. Possible errors: - - Returns NOT_FOUND if the Product does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the Product does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from the request or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is present in + + * Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is present in + + * Returns INVALID_ARGUMENT if product_category is present in update_mask. .. code-block:: python @@ -1412,11 +1417,10 @@ async def sample_update_product(): on the ``request`` instance; if ``request`` is provided, this should not be set. update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - The [FieldMask][google.protobuf.FieldMask] that - specifies which fields to update. If update_mask isn't - specified, all mutable fields are to be updated. Valid - mask paths include ``product_labels``, ``display_name``, - and ``description``. + The `FieldMask `__ that specifies which fields to update. + If update_mask isn't specified, all mutable fields are + to be updated. Valid mask paths include ``product_labels``, + ``display_name``, and ``description``. This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this @@ -1533,8 +1537,7 @@ async def sample_delete_product(): name (:class:`str`): Required. Resource name of product to delete. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -1608,25 +1611,27 @@ async def create_reference_image( ) -> product_search_service.ReferenceImage: r"""Creates and returns a new ReferenceImage resource. - The ``bounding_poly`` field is optional. If ``bounding_poly`` is - not specified, the system will try to detect regions of interest - in the image that are compatible with the product_category on - the parent product. If it is specified, detection is ALWAYS - skipped. The system converts polygons into non-rotated - rectangles. + The ``bounding_poly`` field is optional. If ``bounding_poly`` is not + specified, the system will try to detect regions of interest in + the image that are compatible with the product_category on the + parent product. If it is specified, detection is ALWAYS skipped. + The system converts polygons into non-rotated rectangles. Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP). Possible errors: - - Returns INVALID_ARGUMENT if the image_uri is missing or longer + * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if the product does not exist. - - Returns INVALID_ARGUMENT if bounding_poly is not provided, and + + * Returns INVALID_ARGUMENT if the product does not exist. + + * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with the parent product's product_category is detected. - - Returns INVALID_ARGUMENT if bounding_poly contains more than + + * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. .. code-block:: python @@ -1666,8 +1671,7 @@ async def sample_create_reference_image(): Required. Resource name of the product in which to create the reference image. - Format is - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this @@ -1685,7 +1689,8 @@ async def sample_create_reference_image(): added. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 - characters long. It cannot contain the character ``/``. + characters long. It cannot contain the character + ``/``. This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this @@ -1700,8 +1705,8 @@ async def sample_create_reference_image(): Returns: google.cloud.vision_v1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1807,8 +1812,7 @@ async def sample_delete_reference_image(): Required. The resource name of the reference image to delete. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -1882,8 +1886,9 @@ async def list_reference_images( Possible errors: - - Returns NOT_FOUND if the parent product does not exist. - - Returns INVALID_ARGUMENT if the page_size is greater than 100, + * Returns NOT_FOUND if the parent product does not exist. + + * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1. .. code-block:: python @@ -1920,8 +1925,7 @@ async def sample_list_reference_images(): Required. Resource name of the product containing the reference images. - Format is - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this @@ -1936,7 +1940,7 @@ async def sample_list_reference_images(): Returns: google.cloud.vision_v1.services.product_search.pagers.ListReferenceImagesAsyncPager: - Response message for the ListReferenceImages method. + Response message for the ``ListReferenceImages`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -2017,7 +2021,7 @@ async def get_reference_image( Possible errors: - - Returns NOT_FOUND if the specified image does not exist. + * Returns NOT_FOUND if the specified image does not exist. .. code-block:: python @@ -2052,8 +2056,7 @@ async def sample_get_reference_image(): Required. The resource name of the ReferenceImage to get. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2068,8 +2071,8 @@ async def sample_get_reference_image(): Returns: google.cloud.vision_v1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -2140,7 +2143,7 @@ async def add_product_to_product_set( Possible errors: - - Returns NOT_FOUND if the Product or the ProductSet doesn't + * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. .. code-block:: python @@ -2169,14 +2172,12 @@ async def sample_add_product_to_product_set(): Args: request (Optional[Union[google.cloud.vision_v1.types.AddProductToProductSetRequest, dict]]): - The request object. Request message for the ``AddProductToProductSet`` - method. + The request object. Request message for the ``AddProductToProductSet`` method. name (:class:`str`): Required. The resource name for the ProductSet to modify. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2185,8 +2186,7 @@ async def sample_add_product_to_product_set(): Required. The resource name for the Product to be added to this ProductSet. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this @@ -2289,14 +2289,12 @@ async def sample_remove_product_from_product_set(): Args: request (Optional[Union[google.cloud.vision_v1.types.RemoveProductFromProductSetRequest, dict]]): - The request object. Request message for the ``RemoveProductFromProductSet`` - method. + The request object. Request message for the ``RemoveProductFromProductSet`` method. name (:class:`str`): Required. The resource name for the ProductSet to modify. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2305,8 +2303,7 @@ async def sample_remove_product_from_product_set(): Required. The resource name for the Product to be removed from this ProductSet. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this @@ -2386,7 +2383,7 @@ async def list_products_in_product_set( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. .. code-block:: python @@ -2418,14 +2415,12 @@ async def sample_list_products_in_product_set(): Args: request (Optional[Union[google.cloud.vision_v1.types.ListProductsInProductSetRequest, dict]]): - The request object. Request message for the ``ListProductsInProductSet`` - method. + The request object. Request message for the ``ListProductsInProductSet`` method. name (:class:`str`): Required. The ProductSet resource for which to retrieve Products. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2440,8 +2435,7 @@ async def sample_list_products_in_product_set(): Returns: google.cloud.vision_v1.services.product_search.pagers.ListProductsInProductSetAsyncPager: - Response message for the ListProductsInProductSet - method. + Response message for the ``ListProductsInProductSet`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -2526,15 +2520,14 @@ async def import_product_sets( r"""Asynchronous API that imports a list of reference images to specified product sets based on a list of image information. - The [google.longrunning.Operation][google.longrunning.Operation] - API can be used to keep track of the progress and results of the - request. ``Operation.metadata`` contains - ``BatchOperationMetadata``. (progress) ``Operation.response`` - contains ``ImportProductSetsResponse``. (results) + The `google.longrunning.Operation `__ API can be used to keep track of the progress + and results of the request. ``Operation.metadata`` contains + ``BatchOperationMetadata``. (progress) ``Operation.response`` contains ``ImportProductSetsResponse``. + (results) The input source of this method is a csv file on Google Cloud Storage. For the format of the csv file please see - [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri]. + `ImportProductSetsGcsSource.csv_file_uri `__. .. code-block:: python @@ -2598,14 +2591,11 @@ async def sample_import_product_sets(): An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1.types.ImportProductSetsResponse` - Response message for the ImportProductSets method. + :class:`google.cloud.vision_v1.types.ImportProductSetsResponse`` Response message for the ``ImportProductSets` + method. - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + This message is returned by the `google.longrunning.Operations.GetOperation `__ method in + the returned `google.longrunning.Operation.response `__ field. """ # Create or coerce a protobuf request object. @@ -2701,9 +2691,8 @@ async def purge_products( into the empty ProductSet, you must wait until the PurgeProducts operation has finished for that ProductSet. - The [google.longrunning.Operation][google.longrunning.Operation] - API can be used to keep track of the progress and results of the - request. ``Operation.metadata`` contains + The `google.longrunning.Operation `__ API can be used to keep track of the progress + and results of the request. ``Operation.metadata`` contains ``BatchOperationMetadata``. (progress) .. code-block:: python @@ -2760,16 +2749,16 @@ async def sample_purge_products(): google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } + The result type for the operation will be + :class:`google.protobuf.empty_pb2.Empty` A generic empty + message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to use + it as the request or the response type of an API method. + For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } """ # Create or coerce a protobuf request object. diff --git a/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/client.py b/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/client.py index 9419a8f2769c..94c8bb947d15 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/client.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/client.py @@ -117,20 +117,20 @@ class ProductSearchClient(metaclass=ProductSearchClientMeta): """Manages Products and ProductSets of reference images for use in product search. It uses the following resource model: - - The API has a collection of - [ProductSet][google.cloud.vision.v1.ProductSet] resources, named - ``projects/*/locations/*/productSets/*``, which acts as a way to - put different products into groups to limit identification. + - The API has a collection of `ProductSet `__ + + resources, named ``projects/*/locations/*/productSets/*``, which acts as a way to put different + products into groups to limit identification. In parallel, - - The API has a collection of - [Product][google.cloud.vision.v1.Product] resources, named - ``projects/*/locations/*/products/*`` + - The API has a collection of `Product `__ + + resources, named ``projects/*/locations/*/products/*`` + + - Each `Product `__ has a collection of - - Each [Product][google.cloud.vision.v1.Product] has a collection of - [ReferenceImage][google.cloud.vision.v1.ReferenceImage] resources, - named ``projects/*/locations/*/products/*/referenceImages/*`` + `ReferenceImage `__ resources, named ``projects/*/locations/*/products/*/referenceImages/*`` """ @staticmethod @@ -816,7 +816,7 @@ def create_product_set( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing, or is + * Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters. .. code-block:: python @@ -867,7 +867,8 @@ def sample_create_product_set(): the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 - characters long. It cannot contain the character ``/``. + characters long. It cannot contain the character + ``/``. This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this @@ -954,7 +955,7 @@ def list_product_sets( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100, or + * Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1. .. code-block:: python @@ -1006,7 +1007,7 @@ def sample_list_product_sets(): Returns: google.cloud.vision_v1.services.product_search.pagers.ListProductSetsPager: - Response message for the ListProductSets method. + Response message for the ``ListProductSets`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1084,7 +1085,7 @@ def get_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. + * Returns NOT_FOUND if the ProductSet does not exist. .. code-block:: python @@ -1118,8 +1119,7 @@ def sample_get_product_set(): name (str): Required. Resource name of the ProductSet to get. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -1204,8 +1204,9 @@ def update_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the ProductSet does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but missing from the request or longer than 4096 characters. @@ -1245,10 +1246,9 @@ def sample_update_product_set(): on the ``request`` instance; if ``request`` is provided, this should not be set. update_mask (google.protobuf.field_mask_pb2.FieldMask): - The [FieldMask][google.protobuf.FieldMask] that - specifies which fields to update. If update_mask isn't - specified, all mutable fields are to be updated. Valid - mask path is ``display_name``. + The `FieldMask `__ that specifies which fields to update. + If update_mask isn't specified, all mutable fields are + to be updated. Valid mask path is ``display_name``. This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this @@ -1366,8 +1366,7 @@ def sample_delete_product_set(): name (str): Required. Resource name of the ProductSet to delete. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -1440,11 +1439,13 @@ def create_product( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing or longer + * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is longer than 4096 + + * Returns INVALID_ARGUMENT if description is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is missing or + + * Returns INVALID_ARGUMENT if product_category is missing or invalid. .. code-block:: python @@ -1495,7 +1496,8 @@ def sample_create_product(): the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 - characters long. It cannot contain the character ``/``. + characters long. It cannot contain the character + ``/``. This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this @@ -1577,7 +1579,7 @@ def list_products( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. .. code-block:: python @@ -1629,7 +1631,7 @@ def sample_list_products(): Returns: google.cloud.vision_v1.services.product_search.pagers.ListProductsPager: - Response message for the ListProducts method. + Response message for the ``ListProducts`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1705,7 +1707,7 @@ def get_product( Possible errors: - - Returns NOT_FOUND if the Product does not exist. + * Returns NOT_FOUND if the Product does not exist. .. code-block:: python @@ -1739,8 +1741,7 @@ def sample_get_product(): name (str): Required. Resource name of the Product to get. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -1816,20 +1817,24 @@ def update_product( metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> product_search_service.Product: r"""Makes changes to a Product resource. Only the ``display_name``, - ``description``, and ``labels`` fields can be updated right now. + ``description``, and ``labels`` fields can be updated right + now. If labels are updated, the change will not be reflected in queries until the next index time. Possible errors: - - Returns NOT_FOUND if the Product does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the Product does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from the request or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is present in + + * Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is present in + + * Returns INVALID_ARGUMENT if product_category is present in update_mask. .. code-block:: python @@ -1869,11 +1874,10 @@ def sample_update_product(): on the ``request`` instance; if ``request`` is provided, this should not be set. update_mask (google.protobuf.field_mask_pb2.FieldMask): - The [FieldMask][google.protobuf.FieldMask] that - specifies which fields to update. If update_mask isn't - specified, all mutable fields are to be updated. Valid - mask paths include ``product_labels``, ``display_name``, - and ``description``. + The `FieldMask `__ that specifies which fields to update. + If update_mask isn't specified, all mutable fields are + to be updated. Valid mask paths include ``product_labels``, + ``display_name``, and ``description``. This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this @@ -1987,8 +1991,7 @@ def sample_delete_product(): name (str): Required. Resource name of product to delete. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2059,25 +2062,27 @@ def create_reference_image( ) -> product_search_service.ReferenceImage: r"""Creates and returns a new ReferenceImage resource. - The ``bounding_poly`` field is optional. If ``bounding_poly`` is - not specified, the system will try to detect regions of interest - in the image that are compatible with the product_category on - the parent product. If it is specified, detection is ALWAYS - skipped. The system converts polygons into non-rotated - rectangles. + The ``bounding_poly`` field is optional. If ``bounding_poly`` is not + specified, the system will try to detect regions of interest in + the image that are compatible with the product_category on the + parent product. If it is specified, detection is ALWAYS skipped. + The system converts polygons into non-rotated rectangles. Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP). Possible errors: - - Returns INVALID_ARGUMENT if the image_uri is missing or longer + * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if the product does not exist. - - Returns INVALID_ARGUMENT if bounding_poly is not provided, and + + * Returns INVALID_ARGUMENT if the product does not exist. + + * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with the parent product's product_category is detected. - - Returns INVALID_ARGUMENT if bounding_poly contains more than + + * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. .. code-block:: python @@ -2117,8 +2122,7 @@ def sample_create_reference_image(): Required. Resource name of the product in which to create the reference image. - Format is - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this @@ -2136,7 +2140,8 @@ def sample_create_reference_image(): added. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 - characters long. It cannot contain the character ``/``. + characters long. It cannot contain the character + ``/``. This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this @@ -2151,8 +2156,8 @@ def sample_create_reference_image(): Returns: google.cloud.vision_v1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -2255,8 +2260,7 @@ def sample_delete_reference_image(): Required. The resource name of the reference image to delete. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2327,8 +2331,9 @@ def list_reference_images( Possible errors: - - Returns NOT_FOUND if the parent product does not exist. - - Returns INVALID_ARGUMENT if the page_size is greater than 100, + * Returns NOT_FOUND if the parent product does not exist. + + * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1. .. code-block:: python @@ -2365,8 +2370,7 @@ def sample_list_reference_images(): Required. Resource name of the product containing the reference images. - Format is - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this @@ -2381,7 +2385,7 @@ def sample_list_reference_images(): Returns: google.cloud.vision_v1.services.product_search.pagers.ListReferenceImagesPager: - Response message for the ListReferenceImages method. + Response message for the ``ListReferenceImages`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -2459,7 +2463,7 @@ def get_reference_image( Possible errors: - - Returns NOT_FOUND if the specified image does not exist. + * Returns NOT_FOUND if the specified image does not exist. .. code-block:: python @@ -2494,8 +2498,7 @@ def sample_get_reference_image(): Required. The resource name of the ReferenceImage to get. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2510,8 +2513,8 @@ def sample_get_reference_image(): Returns: google.cloud.vision_v1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -2579,7 +2582,7 @@ def add_product_to_product_set( Possible errors: - - Returns NOT_FOUND if the Product or the ProductSet doesn't + * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. .. code-block:: python @@ -2608,14 +2611,12 @@ def sample_add_product_to_product_set(): Args: request (Union[google.cloud.vision_v1.types.AddProductToProductSetRequest, dict]): - The request object. Request message for the ``AddProductToProductSet`` - method. + The request object. Request message for the ``AddProductToProductSet`` method. name (str): Required. The resource name for the ProductSet to modify. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2624,8 +2625,7 @@ def sample_add_product_to_product_set(): Required. The resource name for the Product to be added to this ProductSet. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this @@ -2727,14 +2727,12 @@ def sample_remove_product_from_product_set(): Args: request (Union[google.cloud.vision_v1.types.RemoveProductFromProductSetRequest, dict]): - The request object. Request message for the ``RemoveProductFromProductSet`` - method. + The request object. Request message for the ``RemoveProductFromProductSet`` method. name (str): Required. The resource name for the ProductSet to modify. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2743,8 +2741,7 @@ def sample_remove_product_from_product_set(): Required. The resource name for the Product to be removed from this ProductSet. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this @@ -2823,7 +2820,7 @@ def list_products_in_product_set( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. .. code-block:: python @@ -2855,14 +2852,12 @@ def sample_list_products_in_product_set(): Args: request (Union[google.cloud.vision_v1.types.ListProductsInProductSetRequest, dict]): - The request object. Request message for the ``ListProductsInProductSet`` - method. + The request object. Request message for the ``ListProductsInProductSet`` method. name (str): Required. The ProductSet resource for which to retrieve Products. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2877,8 +2872,7 @@ def sample_list_products_in_product_set(): Returns: google.cloud.vision_v1.services.product_search.pagers.ListProductsInProductSetPager: - Response message for the ListProductsInProductSet - method. + Response message for the ``ListProductsInProductSet`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -2962,15 +2956,14 @@ def import_product_sets( r"""Asynchronous API that imports a list of reference images to specified product sets based on a list of image information. - The [google.longrunning.Operation][google.longrunning.Operation] - API can be used to keep track of the progress and results of the - request. ``Operation.metadata`` contains - ``BatchOperationMetadata``. (progress) ``Operation.response`` - contains ``ImportProductSetsResponse``. (results) + The `google.longrunning.Operation `__ API can be used to keep track of the progress + and results of the request. ``Operation.metadata`` contains + ``BatchOperationMetadata``. (progress) ``Operation.response`` contains ``ImportProductSetsResponse``. + (results) The input source of this method is a csv file on Google Cloud Storage. For the format of the csv file please see - [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri]. + `ImportProductSetsGcsSource.csv_file_uri `__. .. code-block:: python @@ -3034,14 +3027,11 @@ def sample_import_product_sets(): An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1.types.ImportProductSetsResponse` - Response message for the ImportProductSets method. + :class:`google.cloud.vision_v1.types.ImportProductSetsResponse`` Response message for the ``ImportProductSets` + method. - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + This message is returned by the `google.longrunning.Operations.GetOperation `__ method in + the returned `google.longrunning.Operation.response `__ field. """ # Create or coerce a protobuf request object. @@ -3134,9 +3124,8 @@ def purge_products( into the empty ProductSet, you must wait until the PurgeProducts operation has finished for that ProductSet. - The [google.longrunning.Operation][google.longrunning.Operation] - API can be used to keep track of the progress and results of the - request. ``Operation.metadata`` contains + The `google.longrunning.Operation `__ API can be used to keep track of the progress + and results of the request. ``Operation.metadata`` contains ``BatchOperationMetadata``. (progress) .. code-block:: python @@ -3193,16 +3182,16 @@ def sample_purge_products(): google.api_core.operation.Operation: An object representing a long-running operation. - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } + The result type for the operation will be + :class:`google.protobuf.empty_pb2.Empty` A generic empty + message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to use + it as the request or the response type of an API method. + For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } """ # Create or coerce a protobuf request object. diff --git a/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/transports/base.py b/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/transports/base.py index 68aa99040a97..fcf2ce051155 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/transports/base.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/transports/base.py @@ -87,8 +87,6 @@ def __init__( be used for service account credentials. """ - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} - # Save the scopes. self._scopes = scopes if not hasattr(self, "_ignore_credentials"): @@ -103,11 +101,16 @@ def __init__( if credentials_file is not None: credentials, _ = google.auth.load_credentials_from_file( - credentials_file, **scopes_kwargs, quota_project_id=quota_project_id + credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + default_scopes=self.AUTH_SCOPES, ) elif credentials is None and not self._ignore_credentials: credentials, _ = google.auth.default( - **scopes_kwargs, quota_project_id=quota_project_id + scopes=scopes, + quota_project_id=quota_project_id, + default_scopes=self.AUTH_SCOPES, ) # Don't apply audience if the credentials file passed from user. if hasattr(credentials, "with_gdch_audience"): diff --git a/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/transports/grpc.py b/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/transports/grpc.py index e75e8b70e142..dc69fe1f8d61 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/transports/grpc.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/transports/grpc.py @@ -115,20 +115,20 @@ class ProductSearchGrpcTransport(ProductSearchTransport): Manages Products and ProductSets of reference images for use in product search. It uses the following resource model: - - The API has a collection of - [ProductSet][google.cloud.vision.v1.ProductSet] resources, named - ``projects/*/locations/*/productSets/*``, which acts as a way to - put different products into groups to limit identification. + - The API has a collection of `ProductSet `__ + + resources, named ``projects/*/locations/*/productSets/*``, which acts as a way to put different + products into groups to limit identification. In parallel, - - The API has a collection of - [Product][google.cloud.vision.v1.Product] resources, named - ``projects/*/locations/*/products/*`` + - The API has a collection of `Product `__ + + resources, named ``projects/*/locations/*/products/*`` - - Each [Product][google.cloud.vision.v1.Product] has a collection of - [ReferenceImage][google.cloud.vision.v1.ReferenceImage] resources, - named ``projects/*/locations/*/products/*/referenceImages/*`` + - Each `Product `__ has a collection of + + `ReferenceImage `__ resources, named ``projects/*/locations/*/products/*/referenceImages/*`` This class defines the same methods as the primary client, so the primary client can load the underlying transport implementation @@ -369,7 +369,7 @@ def create_product_set( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing, or is + * Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters. Returns: @@ -403,7 +403,7 @@ def list_product_sets( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100, or + * Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1. Returns: @@ -436,7 +436,7 @@ def get_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. + * Returns NOT_FOUND if the ProductSet does not exist. Returns: Callable[[~.GetProductSetRequest], @@ -470,8 +470,9 @@ def update_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the ProductSet does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but missing from the request or longer than 4096 characters. @@ -535,11 +536,13 @@ def create_product( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing or longer + * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is longer than 4096 + + * Returns INVALID_ARGUMENT if description is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is missing or + + * Returns INVALID_ARGUMENT if product_category is missing or invalid. Returns: @@ -573,7 +576,7 @@ def list_products( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. Returns: @@ -606,7 +609,7 @@ def get_product( Possible errors: - - Returns NOT_FOUND if the Product does not exist. + * Returns NOT_FOUND if the Product does not exist. Returns: Callable[[~.GetProductRequest], @@ -635,20 +638,24 @@ def update_product( r"""Return a callable for the update product method over gRPC. Makes changes to a Product resource. Only the ``display_name``, - ``description``, and ``labels`` fields can be updated right now. + ``description``, and ``labels`` fields can be updated right + now. If labels are updated, the change will not be reflected in queries until the next index time. Possible errors: - - Returns NOT_FOUND if the Product does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the Product does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from the request or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is present in + + * Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is present in + + * Returns INVALID_ARGUMENT if product_category is present in update_mask. Returns: @@ -711,25 +718,27 @@ def create_reference_image( Creates and returns a new ReferenceImage resource. - The ``bounding_poly`` field is optional. If ``bounding_poly`` is - not specified, the system will try to detect regions of interest - in the image that are compatible with the product_category on - the parent product. If it is specified, detection is ALWAYS - skipped. The system converts polygons into non-rotated - rectangles. + The ``bounding_poly`` field is optional. If ``bounding_poly`` is not + specified, the system will try to detect regions of interest in + the image that are compatible with the product_category on the + parent product. If it is specified, detection is ALWAYS skipped. + The system converts polygons into non-rotated rectangles. Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP). Possible errors: - - Returns INVALID_ARGUMENT if the image_uri is missing or longer + * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if the product does not exist. - - Returns INVALID_ARGUMENT if bounding_poly is not provided, and + + * Returns INVALID_ARGUMENT if the product does not exist. + + * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with the parent product's product_category is detected. - - Returns INVALID_ARGUMENT if bounding_poly contains more than + + * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. Returns: @@ -798,8 +807,9 @@ def list_reference_images( Possible errors: - - Returns NOT_FOUND if the parent product does not exist. - - Returns INVALID_ARGUMENT if the page_size is greater than 100, + * Returns NOT_FOUND if the parent product does not exist. + + * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1. Returns: @@ -833,7 +843,7 @@ def get_reference_image( Possible errors: - - Returns NOT_FOUND if the specified image does not exist. + * Returns NOT_FOUND if the specified image does not exist. Returns: Callable[[~.GetReferenceImageRequest], @@ -868,7 +878,7 @@ def add_product_to_product_set( Possible errors: - - Returns NOT_FOUND if the Product or the ProductSet doesn't + * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. Returns: @@ -937,7 +947,7 @@ def list_products_in_product_set( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. Returns: @@ -971,15 +981,14 @@ def import_product_sets( Asynchronous API that imports a list of reference images to specified product sets based on a list of image information. - The [google.longrunning.Operation][google.longrunning.Operation] - API can be used to keep track of the progress and results of the - request. ``Operation.metadata`` contains - ``BatchOperationMetadata``. (progress) ``Operation.response`` - contains ``ImportProductSetsResponse``. (results) + The `google.longrunning.Operation `__ API can be used to keep track of the progress + and results of the request. ``Operation.metadata`` contains + ``BatchOperationMetadata``. (progress) ``Operation.response`` contains ``ImportProductSetsResponse``. + (results) The input source of this method is a csv file on Google Cloud Storage. For the format of the csv file please see - [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri]. + `ImportProductSetsGcsSource.csv_file_uri `__. Returns: Callable[[~.ImportProductSetsRequest], @@ -1030,9 +1039,8 @@ def purge_products( into the empty ProductSet, you must wait until the PurgeProducts operation has finished for that ProductSet. - The [google.longrunning.Operation][google.longrunning.Operation] - API can be used to keep track of the progress and results of the - request. ``Operation.metadata`` contains + The `google.longrunning.Operation `__ API can be used to keep track of the progress + and results of the request. ``Operation.metadata`` contains ``BatchOperationMetadata``. (progress) Returns: diff --git a/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/transports/grpc_asyncio.py b/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/transports/grpc_asyncio.py index 2d25de74b853..500689e9d04c 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/transports/grpc_asyncio.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/transports/grpc_asyncio.py @@ -121,20 +121,20 @@ class ProductSearchGrpcAsyncIOTransport(ProductSearchTransport): Manages Products and ProductSets of reference images for use in product search. It uses the following resource model: - - The API has a collection of - [ProductSet][google.cloud.vision.v1.ProductSet] resources, named - ``projects/*/locations/*/productSets/*``, which acts as a way to - put different products into groups to limit identification. + - The API has a collection of `ProductSet `__ + + resources, named ``projects/*/locations/*/productSets/*``, which acts as a way to put different + products into groups to limit identification. In parallel, - - The API has a collection of - [Product][google.cloud.vision.v1.Product] resources, named - ``projects/*/locations/*/products/*`` + - The API has a collection of `Product `__ + + resources, named ``projects/*/locations/*/products/*`` - - Each [Product][google.cloud.vision.v1.Product] has a collection of - [ReferenceImage][google.cloud.vision.v1.ReferenceImage] resources, - named ``projects/*/locations/*/products/*/referenceImages/*`` + - Each `Product `__ has a collection of + + `ReferenceImage `__ resources, named ``projects/*/locations/*/products/*/referenceImages/*`` This class defines the same methods as the primary client, so the primary client can load the underlying transport implementation @@ -377,7 +377,7 @@ def create_product_set( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing, or is + * Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters. Returns: @@ -411,7 +411,7 @@ def list_product_sets( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100, or + * Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1. Returns: @@ -445,7 +445,7 @@ def get_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. + * Returns NOT_FOUND if the ProductSet does not exist. Returns: Callable[[~.GetProductSetRequest], @@ -479,8 +479,9 @@ def update_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the ProductSet does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but missing from the request or longer than 4096 characters. @@ -547,11 +548,13 @@ def create_product( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing or longer + * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is longer than 4096 + + * Returns INVALID_ARGUMENT if description is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is missing or + + * Returns INVALID_ARGUMENT if product_category is missing or invalid. Returns: @@ -585,7 +588,7 @@ def list_products( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. Returns: @@ -619,7 +622,7 @@ def get_product( Possible errors: - - Returns NOT_FOUND if the Product does not exist. + * Returns NOT_FOUND if the Product does not exist. Returns: Callable[[~.GetProductRequest], @@ -649,20 +652,24 @@ def update_product( r"""Return a callable for the update product method over gRPC. Makes changes to a Product resource. Only the ``display_name``, - ``description``, and ``labels`` fields can be updated right now. + ``description``, and ``labels`` fields can be updated right + now. If labels are updated, the change will not be reflected in queries until the next index time. Possible errors: - - Returns NOT_FOUND if the Product does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the Product does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from the request or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is present in + + * Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is present in + + * Returns INVALID_ARGUMENT if product_category is present in update_mask. Returns: @@ -727,25 +734,27 @@ def create_reference_image( Creates and returns a new ReferenceImage resource. - The ``bounding_poly`` field is optional. If ``bounding_poly`` is - not specified, the system will try to detect regions of interest - in the image that are compatible with the product_category on - the parent product. If it is specified, detection is ALWAYS - skipped. The system converts polygons into non-rotated - rectangles. + The ``bounding_poly`` field is optional. If ``bounding_poly`` is not + specified, the system will try to detect regions of interest in + the image that are compatible with the product_category on the + parent product. If it is specified, detection is ALWAYS skipped. + The system converts polygons into non-rotated rectangles. Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP). Possible errors: - - Returns INVALID_ARGUMENT if the image_uri is missing or longer + * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if the product does not exist. - - Returns INVALID_ARGUMENT if bounding_poly is not provided, and + + * Returns INVALID_ARGUMENT if the product does not exist. + + * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with the parent product's product_category is detected. - - Returns INVALID_ARGUMENT if bounding_poly contains more than + + * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. Returns: @@ -814,8 +823,9 @@ def list_reference_images( Possible errors: - - Returns NOT_FOUND if the parent product does not exist. - - Returns INVALID_ARGUMENT if the page_size is greater than 100, + * Returns NOT_FOUND if the parent product does not exist. + + * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1. Returns: @@ -849,7 +859,7 @@ def get_reference_image( Possible errors: - - Returns NOT_FOUND if the specified image does not exist. + * Returns NOT_FOUND if the specified image does not exist. Returns: Callable[[~.GetReferenceImageRequest], @@ -885,7 +895,7 @@ def add_product_to_product_set( Possible errors: - - Returns NOT_FOUND if the Product or the ProductSet doesn't + * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. Returns: @@ -955,7 +965,7 @@ def list_products_in_product_set( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. Returns: @@ -990,15 +1000,14 @@ def import_product_sets( Asynchronous API that imports a list of reference images to specified product sets based on a list of image information. - The [google.longrunning.Operation][google.longrunning.Operation] - API can be used to keep track of the progress and results of the - request. ``Operation.metadata`` contains - ``BatchOperationMetadata``. (progress) ``Operation.response`` - contains ``ImportProductSetsResponse``. (results) + The `google.longrunning.Operation `__ API can be used to keep track of the progress + and results of the request. ``Operation.metadata`` contains + ``BatchOperationMetadata``. (progress) ``Operation.response`` contains ``ImportProductSetsResponse``. + (results) The input source of this method is a csv file on Google Cloud Storage. For the format of the csv file please see - [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1.ImportProductSetsGcsSource.csv_file_uri]. + `ImportProductSetsGcsSource.csv_file_uri `__. Returns: Callable[[~.ImportProductSetsRequest], @@ -1050,9 +1059,8 @@ def purge_products( into the empty ProductSet, you must wait until the PurgeProducts operation has finished for that ProductSet. - The [google.longrunning.Operation][google.longrunning.Operation] - API can be used to keep track of the progress and results of the - request. ``Operation.metadata`` contains + The `google.longrunning.Operation `__ API can be used to keep track of the progress + and results of the request. ``Operation.metadata`` contains ``BatchOperationMetadata``. (progress) Returns: diff --git a/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/transports/rest.py b/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/transports/rest.py index 65c13eb81d75..6caaf5a92aa5 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/transports/rest.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1/services/product_search/transports/rest.py @@ -1034,20 +1034,20 @@ class ProductSearchRestTransport(_BaseProductSearchRestTransport): Manages Products and ProductSets of reference images for use in product search. It uses the following resource model: - - The API has a collection of - [ProductSet][google.cloud.vision.v1.ProductSet] resources, named - ``projects/*/locations/*/productSets/*``, which acts as a way to - put different products into groups to limit identification. + - The API has a collection of `ProductSet `__ + + resources, named ``projects/*/locations/*/productSets/*``, which acts as a way to put different + products into groups to limit identification. In parallel, - - The API has a collection of - [Product][google.cloud.vision.v1.Product] resources, named - ``projects/*/locations/*/products/*`` + - The API has a collection of `Product `__ + + resources, named ``projects/*/locations/*/products/*`` - - Each [Product][google.cloud.vision.v1.Product] has a collection of - [ReferenceImage][google.cloud.vision.v1.ReferenceImage] resources, - named ``projects/*/locations/*/products/*/referenceImages/*`` + - Each `Product `__ has a collection of + + `ReferenceImage `__ resources, named ``projects/*/locations/*/products/*/referenceImages/*`` This class defines the same methods as the primary client, so the primary client can load the underlying transport implementation @@ -1214,8 +1214,7 @@ def __call__( Args: request (~.product_search_service.AddProductToProductSetRequest): - The request object. Request message for the ``AddProductToProductSet`` - method. + The request object. Request message for the ``AddProductToProductSet`` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -3013,8 +3012,7 @@ def __call__( Args: request (~.product_search_service.ListProductsInProductSetRequest): - The request object. Request message for the ``ListProductsInProductSet`` - method. + The request object. Request message for the ``ListProductsInProductSet`` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -3025,9 +3023,7 @@ def __call__( Returns: ~.product_search_service.ListProductsInProductSetResponse: - Response message for the ``ListProductsInProductSet`` - method. - + Response message for the ``ListProductsInProductSet`` method. """ http_options = ( @@ -3472,8 +3468,7 @@ def __call__( Args: request (~.product_search_service.RemoveProductFromProductSetRequest): - The request object. Request message for the ``RemoveProductFromProductSet`` - method. + The request object. Request message for the ``RemoveProductFromProductSet`` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/packages/google-cloud-vision/google/cloud/vision_v1/types/image_annotator.py b/packages/google-cloud-vision/google/cloud/vision_v1/types/image_annotator.py index 524c4df5c0c9..6117877784d5 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1/types/image_annotator.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1/types/image_annotator.py @@ -109,14 +109,13 @@ class Feature(proto.Message): The feature type. max_results (int): Maximum number of results of this type. Does not apply to - ``TEXT_DETECTION``, ``DOCUMENT_TEXT_DETECTION``, or - ``CROP_HINTS``. + ``TEXT_DETECTION``, ``DOCUMENT_TEXT_DETECTION``, or ``CROP_HINTS``. model (str): Model to use for the feature. Supported values: "builtin/stable" (the default if unset) and - "builtin/latest". ``DOCUMENT_TEXT_DETECTION`` and - ``TEXT_DETECTION`` also support "builtin/weekly" for the - bleeding edge release updated weekly. + "builtin/latest". ``DOCUMENT_TEXT_DETECTION`` and ``TEXT_DETECTION`` also + support "builtin/weekly" for the bleeding edge release + updated weekly. """ class Type(proto.Enum): @@ -136,12 +135,11 @@ class Type(proto.Enum): TEXT_DETECTION (5): Run text detection / optical character recognition (OCR). Text detection is optimized for areas of text within a - larger image; if the image is a document, use - ``DOCUMENT_TEXT_DETECTION`` instead. + larger image; if the image is a document, use ``DOCUMENT_TEXT_DETECTION`` + instead. DOCUMENT_TEXT_DETECTION (11): Run dense text document OCR. Takes precedence when both - ``DOCUMENT_TEXT_DETECTION`` and ``TEXT_DETECTION`` are - present. + ``DOCUMENT_TEXT_DETECTION`` and ``TEXT_DETECTION`` are present. SAFE_SEARCH_DETECTION (6): Run Safe Search to detect potentially unsafe or undesirable content. @@ -194,28 +192,29 @@ class ImageSource(proto.Message): gcs_image_uri (str): **Use ``image_uri`` instead.** - The Google Cloud Storage URI of the form - ``gs://bucket_name/object_name``. Object versioning is not - supported. See `Google Cloud Storage Request - URIs `__ - for more info. + The Google Cloud Storage URI of the form ``gs://bucket_name/object_name``. + Object versioning is not supported. See `Google Cloud Storage Request URIs `__ for + more info. image_uri (str): The URI of the source image. Can be either: 1. A Google Cloud Storage URI of the form - ``gs://bucket_name/object_name``. Object versioning is - not supported. See `Google Cloud Storage Request - URIs `__ - for more info. + + 1. A Google Cloud Storage URI of the form + ``gs://bucket_name/object_name``. Object versioning is not supported. See + `Google Cloud Storage Request + URIs `__ for more + info. 2. A publicly-accessible image HTTP/HTTPS URL. When fetching - images from HTTP/HTTPS URLs, Google cannot guarantee that - the request will be completed. Your request may fail if - the specified host denies the request (e.g. due to - request throttling or DOS prevention), or if Google - throttles requests to the site for abuse prevention. You - should not depend on externally-hosted images for - production applications. + images from + + 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from + HTTP/HTTPS URLs, Google cannot guarantee that the request will be + completed. Your request may fail if the specified host denies the + request (e.g. due to request throttling or DOS prevention), or if Google + throttles requests to the site for abuse prevention. You should not + depend on externally-hosted images for production applications. When both ``gcs_image_uri`` and ``image_uri`` are specified, ``image_uri`` takes precedence. @@ -237,17 +236,18 @@ class Image(proto.Message): Attributes: content (bytes): Image content, represented as a stream of bytes. Note: As - with all ``bytes`` fields, protobuffers use a pure binary - representation, whereas JSON representations use base64. + with all ``bytes`` fields, protobuffers use a pure + binary representation, whereas JSON representations use + base64. Currently, this field only works for BatchAnnotateImages requests. It does not work for AsyncBatchAnnotateImages requests. source (google.cloud.vision_v1.types.ImageSource): Google Cloud Storage image location, or publicly-accessible - image URL. If both ``content`` and ``source`` are provided - for an image, ``content`` takes precedence and is used to - perform the image annotation request. + image URL. If both ``content`` and ``source`` are + provided for an image, ``content`` takes precedence and is + used to perform the image annotation request. """ content: bytes = proto.Field( @@ -272,16 +272,16 @@ class FaceAnnotation(proto.Message): box is computed to "frame" the face in accordance with human expectations. It is based on the landmarker results. Note that one or more x and/or y coordinates may not be generated - in the ``BoundingPoly`` (the polygon will be unbounded) if - only a partial face appears in the image to be annotated. + in the ``BoundingPoly`` (the polygon will be unbounded) if only + a partial face appears in the image to be annotated. fd_bounding_poly (google.cloud.vision_v1.types.BoundingPoly): - The ``fd_bounding_poly`` bounding polygon is tighter than - the ``boundingPoly``, and encloses only the skin part of the - face. Typically, it is used to eliminate the face from any - image analysis that detects the "amount of skin" visible in - an image. It is not based on the landmarker results, only on - the initial face detection, hence the fd (face detection) - prefix. + The ``fd_bounding_poly`` bounding polygon is tighter than the + ``boundingPoly``, and encloses only the skin part of the face. + Typically, it is used to eliminate the face from any image + analysis that detects the "amount of skin" visible in an + image. It is not based on the landmarker results, only on + the initial face detection, hence the fd (face + detection) prefix. landmarks (MutableSequence[google.cloud.vision_v1.types.FaceAnnotation.Landmark]): Detected face landmarks. roll_angle (float): @@ -577,9 +577,8 @@ class EntityAnnotation(proto.Message): Attributes: mid (str): - Opaque entity ID. Some IDs may be available in `Google - Knowledge Graph Search - API `__. + Opaque entity ID. Some IDs may be available in + `Google Knowledge Graph Search API `__. locale (str): The language code for the locale in which the entity textual ``description`` is expressed. @@ -589,9 +588,9 @@ class EntityAnnotation(proto.Message): score (float): Overall score of the result. Range [0, 1]. confidence (float): - **Deprecated. Use ``score`` instead.** The accuracy of the - entity detection in an image. For example, for an image in - which the "Eiffel Tower" entity is detected, this field + **Deprecated. Use ``score`` instead.** The accuracy of + the entity detection in an image. For example, for an image + in which the "Eiffel Tower" entity is detected, this field represents the confidence that there is a tower in the query image. Range [0, 1]. topicality (float): @@ -606,11 +605,11 @@ class EntityAnnotation(proto.Message): ``LABEL_DETECTION`` features. locations (MutableSequence[google.cloud.vision_v1.types.LocationInfo]): The location information for the detected entity. Multiple - ``LocationInfo`` elements can be present because one - location may indicate the location of the scene in the - image, and another location may indicate the location of the - place where the image was taken. Location information is - usually present for landmarks. + ``LocationInfo`` elements can be present because one location + may indicate the location of the scene in the image, and + another location may indicate the location of the place + where the image was taken. Location information is usually + present for landmarks. properties (MutableSequence[google.cloud.vision_v1.types.Property]): Some entities may have optional user-supplied ``Property`` (name/value) fields, such a score or string that qualifies @@ -852,7 +851,7 @@ class CropHint(proto.Message): coordinates of the bounding box are in the original image's scale. confidence (float): - Confidence of this being a salient region. Range [0, 1]. + Confidence of this being a salient region. Range [0, 1]. importance_fraction (float): Fraction of importance of this salient region with respect to the original image. @@ -937,11 +936,12 @@ class TextDetectionParams(proto.Message): A list of advanced OCR options to further fine-tune OCR behavior. Current valid values are: - - ``legacy_layout``: a heuristics layout detection - algorithm, which serves as an alternative to the current - ML-based layout detection algorithm. Customers can choose - the best suitable layout algorithm based on their - situation. + - ``legacy_layout``: a heuristics layout detection algorithm, + which serves as + + an alternative to the current ML-based layout detection + algorithm. Customers can choose the best suitable layout + algorithm based on their situation. """ enable_text_detection_confidence_score: bool = proto.Field( @@ -964,13 +964,12 @@ class ImageContext(proto.Message): List of languages to use for TEXT_DETECTION. In most cases, an empty value yields the best results since it enables automatic language detection. For languages based on the - Latin alphabet, setting ``language_hints`` is not needed. In - rare cases, when the language of the text in the image is - known, setting a hint will help get better results (although - it will be a significant hindrance if the hint is wrong). - Text detection returns an error if one or more of the - specified languages is not one of the `supported - languages `__. + Latin alphabet, setting ``language_hints`` is not needed. In rare + cases, when the language of the text in the image is known, + setting a hint will help get better results (although it + will be a significant hindrance if the hint is wrong). Text + detection returns an error if one or more of the specified + languages is not one of the `supported languages `__. crop_hints_params (google.cloud.vision_v1.types.CropHintsParams): Parameters for crop hints annotation request. product_search_params (google.cloud.vision_v1.types.ProductSearchParams): @@ -1211,9 +1210,12 @@ class BatchAnnotateImagesRequest(proto.Message): If no parent is specified, a region will be chosen automatically. - Supported location-ids: ``us``: USA country only, ``asia``: - East asia areas, like Japan, Taiwan, ``eu``: The European - Union. + Supported location-ids: + + Supported location-ids: + ``us``: USA country only, + ``asia``: East asia areas, like Japan, Taiwan, + ``eu``: The European Union. Example: ``projects/project-A/locations/eu``. labels (MutableMapping[str, str]): @@ -1371,9 +1373,12 @@ class BatchAnnotateFilesRequest(proto.Message): If no parent is specified, a region will be chosen automatically. - Supported location-ids: ``us``: USA country only, ``asia``: - East asia areas, like Japan, Taiwan, ``eu``: The European - Union. + Supported location-ids: + + Supported location-ids: + ``us``: USA country only, + ``asia``: East asia areas, like Japan, Taiwan, + ``eu``: The European Union. Example: ``projects/project-A/locations/eu``. labels (MutableMapping[str, str]): @@ -1493,9 +1498,12 @@ class AsyncBatchAnnotateImagesRequest(proto.Message): If no parent is specified, a region will be chosen automatically. - Supported location-ids: ``us``: USA country only, ``asia``: - East asia areas, like Japan, Taiwan, ``eu``: The European - Union. + Supported location-ids: + + Supported location-ids: + ``us``: USA country only, + ``asia``: East asia areas, like Japan, Taiwan, + ``eu``: The European Union. Example: ``projects/project-A/locations/eu``. labels (MutableMapping[str, str]): @@ -1562,9 +1570,12 @@ class AsyncBatchAnnotateFilesRequest(proto.Message): If no parent is specified, a region will be chosen automatically. - Supported location-ids: ``us``: USA country only, ``asia``: - East asia areas, like Japan, Taiwan, ``eu``: The European - Union. + Supported location-ids: + + Supported location-ids: + ``us``: USA country only, + ``asia``: East asia areas, like Japan, Taiwan, + ``eu``: The European Union. Example: ``projects/project-A/locations/eu``. labels (MutableMapping[str, str]): @@ -1620,8 +1631,9 @@ class InputConfig(proto.Message): input from. content (bytes): File content, represented as a stream of bytes. Note: As - with all ``bytes`` fields, protobuffers use a pure binary - representation, whereas JSON representations use base64. + with all ``bytes`` fields, protobuffers use a pure + binary representation, whereas JSON representations use + base64. Currently, this field only works for BatchAnnotateFiles requests. It does not work for AsyncBatchAnnotateFiles @@ -1660,9 +1672,9 @@ class OutputConfig(proto.Message): 100]. If not specified, the default value is 20. For example, for one pdf file with 100 pages, 100 response - protos will be generated. If ``batch_size`` = 20, then 5 - json files each containing 20 response protos will be - written under the prefix ``gcs_destination``.\ ``uri``. + protos will be generated. If ``batch_size`` = 20, then 5 json + files each containing 20 response protos will be written + under the prefix ``gcs_destination``.``uri``. Currently, batch_size only applies to GcsDestination, with potential future support for other output configurations. @@ -1712,16 +1724,18 @@ class GcsDestination(proto.Message): Examples: - - File Prefix: gs://bucket-name/here/filenameprefix The - output files will be created in gs://bucket-name/here/ and - the names of the output files will begin with - "filenameprefix". + * File Prefix: gs://bucket-name/here/filenameprefix The + output files + + will be created in gs://bucket-name/here/ and the names of + the output files will begin with "filenameprefix". + + * Directory Prefix: gs://bucket-name/some/location/ The + output files - - Directory Prefix: gs://bucket-name/some/location/ The - output files will be created in - gs://bucket-name/some/location/ and the names of the - output files could be anything because there was no - filename prefix specified. + will be created in gs://bucket-name/some/location/ and the + names of the output files could be anything because there + was no filename prefix specified. If multiple outputs, each response is still AnnotateFileResponse, each of which contains some subset of diff --git a/packages/google-cloud-vision/google/cloud/vision_v1/types/product_search.py b/packages/google-cloud-vision/google/cloud/vision_v1/types/product_search.py index 7b745e9b0bbb..74fbec3e003e 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1/types/product_search.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1/types/product_search.py @@ -40,12 +40,10 @@ class ProductSearchParams(proto.Message): interest in the image. If it is not specified, system discretion will be applied. product_set (str): - The resource name of a - [ProductSet][google.cloud.vision.v1.ProductSet] to be - searched for similar images. + The resource name of a `ProductSet `__ to be searched for + similar images. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID``. + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID``. product_categories (MutableSequence[str]): The list of product categories to search in. Currently, we only consider the first category, diff --git a/packages/google-cloud-vision/google/cloud/vision_v1/types/product_search_service.py b/packages/google-cloud-vision/google/cloud/vision_v1/types/product_search_service.py index 857fe4832ef3..116a5c0471c7 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1/types/product_search_service.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1/types/product_search_service.py @@ -69,8 +69,7 @@ class Product(proto.Message): name (str): The resource name of the product. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. This field is ignored when creating a product. display_name (str): @@ -160,8 +159,7 @@ class ProductSet(proto.Message): name (str): The resource name of the ProductSet. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID``. + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID``. This field is ignored when creating a ProductSet. display_name (str): @@ -208,15 +206,14 @@ class ProductSet(proto.Message): class ReferenceImage(proto.Message): - r"""A ``ReferenceImage`` represents a product image and its associated - metadata, such as bounding boxes. + r"""A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. Attributes: name (str): The resource name of the reference image. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. This field is ignored when creating a reference image. uri (str): @@ -265,11 +262,12 @@ class CreateProductRequest(proto.Message): product (google.cloud.vision_v1.types.Product): Required. The product to create. product_id (str): - A user-supplied resource id for this Product. If set, the - server will attempt to use this value as the resource id. If - it is already in use, an error is returned with code - ALREADY_EXISTS. Must be at most 128 characters long. It - cannot contain the character ``/``. + A user-supplied resource id for this Product. If set, + the server will attempt to use this value as the + resource id. If it is already in use, an error is + returned with code ALREADY_EXISTS. Must be at most 128 + characters long. It cannot contain the character + ``/``. """ parent: str = proto.Field( @@ -352,8 +350,7 @@ class GetProductRequest(proto.Message): name (str): Required. Resource name of the Product to get. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ name: str = proto.Field( @@ -371,10 +368,10 @@ class UpdateProductRequest(proto.Message): the one on the server. product.name is immutable. update_mask (google.protobuf.field_mask_pb2.FieldMask): - The [FieldMask][google.protobuf.FieldMask] that specifies - which fields to update. If update_mask isn't specified, all - mutable fields are to be updated. Valid mask paths include - ``product_labels``, ``display_name``, and ``description``. + The `FieldMask `__ that specifies which fields to update. + If update_mask isn't specified, all mutable fields are + to be updated. Valid mask paths include ``product_labels``, + ``display_name``, and ``description``. """ product: "Product" = proto.Field( @@ -396,8 +393,7 @@ class DeleteProductRequest(proto.Message): name (str): Required. Resource name of product to delete. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ name: str = proto.Field( @@ -418,11 +414,12 @@ class CreateProductSetRequest(proto.Message): product_set (google.cloud.vision_v1.types.ProductSet): Required. The ProductSet to create. product_set_id (str): - A user-supplied resource id for this ProductSet. If set, the - server will attempt to use this value as the resource id. If - it is already in use, an error is returned with code - ALREADY_EXISTS. Must be at most 128 characters long. It - cannot contain the character ``/``. + A user-supplied resource id for this ProductSet. If set, + the server will attempt to use this value as the + resource id. If it is already in use, an error is + returned with code ALREADY_EXISTS. Must be at most 128 + characters long. It cannot contain the character + ``/``. """ parent: str = proto.Field( @@ -505,8 +502,7 @@ class GetProductSetRequest(proto.Message): name (str): Required. Resource name of the ProductSet to get. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` """ name: str = proto.Field( @@ -523,10 +519,9 @@ class UpdateProductSetRequest(proto.Message): Required. The ProductSet resource which replaces the one on the server. update_mask (google.protobuf.field_mask_pb2.FieldMask): - The [FieldMask][google.protobuf.FieldMask] that specifies - which fields to update. If update_mask isn't specified, all - mutable fields are to be updated. Valid mask path is - ``display_name``. + The `FieldMask `__ that specifies which fields to update. + If update_mask isn't specified, all mutable fields are + to be updated. Valid mask path is ``display_name``. """ product_set: "ProductSet" = proto.Field( @@ -548,8 +543,7 @@ class DeleteProductSetRequest(proto.Message): name (str): Required. Resource name of the ProductSet to delete. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` """ name: str = proto.Field( @@ -563,20 +557,20 @@ class CreateReferenceImageRequest(proto.Message): Attributes: parent (str): - Required. Resource name of the product in which to create - the reference image. + Required. Resource name of the product in which to + create the reference image. - Format is - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. reference_image (google.cloud.vision_v1.types.ReferenceImage): Required. The reference image to create. If an image ID is specified, it is ignored. reference_image_id (str): A user-supplied resource id for the ReferenceImage to be - added. If set, the server will attempt to use this value as - the resource id. If it is already in use, an error is + added. If set, the server will attempt to use this value + as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 - characters long. It cannot contain the character ``/``. + characters long. It cannot contain the character + ``/``. """ parent: str = proto.Field( @@ -602,8 +596,7 @@ class ListReferenceImagesRequest(proto.Message): Required. Resource name of the product containing the reference images. - Format is - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. page_size (int): The maximum number of items to return. Default 10, maximum 100. @@ -667,10 +660,10 @@ class GetReferenceImageRequest(proto.Message): Attributes: name (str): - Required. The resource name of the ReferenceImage to get. + Required. The resource name of the ReferenceImage to + get. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID``. """ name: str = proto.Field( @@ -687,8 +680,7 @@ class DeleteReferenceImageRequest(proto.Message): Required. The resource name of the reference image to delete. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID/referenceImages/IMAGE_ID`` """ name: str = proto.Field( @@ -702,16 +694,15 @@ class AddProductToProductSetRequest(proto.Message): Attributes: name (str): - Required. The resource name for the ProductSet to modify. + Required. The resource name for the ProductSet to + modify. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` product (str): - Required. The resource name for the Product to be added to - this ProductSet. + Required. The resource name for the Product to be added + to this ProductSet. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ name: str = proto.Field( @@ -729,16 +720,15 @@ class RemoveProductFromProductSetRequest(proto.Message): Attributes: name (str): - Required. The resource name for the ProductSet to modify. + Required. The resource name for the ProductSet to + modify. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` product (str): - Required. The resource name for the Product to be removed - from this ProductSet. + Required. The resource name for the Product to be + removed from this ProductSet. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ name: str = proto.Field( @@ -759,8 +749,7 @@ class ListProductsInProductSetRequest(proto.Message): Required. The ProductSet resource for which to retrieve Products. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` page_size (int): The maximum number of items to return. Default 10, maximum 100. @@ -823,63 +812,62 @@ class ImportProductSetsGcsSource(proto.Message): The format of the input csv file should be one image per line. In each line, there are 8 columns. - 1. image-uri - 2. image-id - 3. product-set-id - 4. product-id - 5. product-category - 6. product-display-name - 7. labels - 8. bounding-poly + 1. image-uri + + 2. image-id + + 3. product-set-id + + 4. product-id + + 5. product-category + + 6. product-display-name + + 7. labels + + 8. bounding-poly The ``image-uri``, ``product-set-id``, ``product-id``, and - ``product-category`` columns are required. All other columns - are optional. + ``product-category`` columns are required. All other columns are + optional. If the ``ProductSet`` or ``Product`` specified by the - ``product-set-id`` and ``product-id`` values does not exist, - then the system will create a new ``ProductSet`` or - ``Product`` for the image. In this case, the - ``product-display-name`` column refers to - [display_name][google.cloud.vision.v1.Product.display_name], - the ``product-category`` column refers to - [product_category][google.cloud.vision.v1.Product.product_category], - and the ``labels`` column refers to - [product_labels][google.cloud.vision.v1.Product.product_labels]. + ``product-set-id`` and ``product-id`` values does not exist, then + the system will create a new ``ProductSet`` or ``Product`` + for the image. In this case, the ``product-display-name`` column refers + to `display_name `__, the ``product-category`` column refers to + `product_category `__, and the ``labels`` column refers to + `product_labels `__. The ``image-id`` column is optional but must be unique if provided. If it is empty, the system will automatically assign a unique id to the image. - The ``product-display-name`` column is optional. If it is - empty, the system sets the - [display_name][google.cloud.vision.v1.Product.display_name] - field for the product to a space (" "). You can update the - ``display_name`` later by using the API. + The ``product-display-name`` column is optional. If it is empty, the + system sets the `display_name `__ field for the product to a + space (" "). You can update the ``display_name`` later by using + the API. If a ``Product`` with the specified ``product-id`` already - exists, then the system ignores the - ``product-display-name``, ``product-category``, and - ``labels`` columns. - - The ``labels`` column (optional) is a line containing a list - of comma-separated key-value pairs, in the following format: + exists, then the system ignores the ``product-display-name``, + ``product-category``, and ``labels`` columns. - :: + The ``labels`` column (optional) is a line containing a + list of comma-separated key-value pairs, in the following + format: - "key_1=value_1,key_2=value_2,...,key_n=value_n" + "key_1=value_1,key_2=value_2,...,key_n=value_n" - The ``bounding-poly`` column (optional) identifies one - region of interest from the image in the same manner as - ``CreateReferenceImage``. If you do not specify the - ``bounding-poly`` column, then the system will try to detect - regions of interest automatically. + The ``bounding-poly`` column (optional) identifies one region of + interest from the image in the same manner as ``CreateReferenceImage``. + If you do not specify the ``bounding-poly`` column, then the + system will try to detect regions of interest automatically. - At most one ``bounding-poly`` column is allowed per line. If - the image contains multiple regions of interest, add a line - to the CSV file that includes the same product information, - and the ``bounding-poly`` values for each region of - interest. + At most one ``bounding-poly`` column is allowed per line. If the + image contains multiple regions of interest, add a line to + the CSV file that includes the same product information, and + the ``bounding-poly`` values for each region of interest. The ``bounding-poly`` column must contain an even number of comma-separated numbers, in the format @@ -947,11 +935,8 @@ class ImportProductSetsRequest(proto.Message): class ImportProductSetsResponse(proto.Message): r"""Response message for the ``ImportProductSets`` method. - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + This message is returned by the `google.longrunning.Operations.GetOperation `__ method in the returned + `google.longrunning.Operation.response `__ field. Attributes: reference_images (MutableSequence[google.cloud.vision_v1.types.ReferenceImage]): @@ -982,8 +967,7 @@ class BatchOperationMetadata(proto.Message): r"""Metadata for the batch operations such as the current state. This is included in the ``metadata`` field of the ``Operation`` - returned by the ``GetOperation`` call of the - ``google::longrunning::Operations`` service. + returned by the ``GetOperation`` call of the ``google::longrunning::Operations`` service. Attributes: state (google.cloud.vision_v1.types.BatchOperationMetadata.State): @@ -993,8 +977,7 @@ class BatchOperationMetadata(proto.Message): to the server. end_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch request is finished and - [google.longrunning.Operation.done][google.longrunning.Operation.done] - is set to true. + `google.longrunning.Operation.done `__ is set to true. """ class State(proto.Enum): diff --git a/packages/google-cloud-vision/google/cloud/vision_v1/types/text_annotation.py b/packages/google-cloud-vision/google/cloud/vision_v1/types/text_annotation.py index 8461cf71f80f..ae4ab5bffaa8 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1/types/text_annotation.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1/types/text_annotation.py @@ -37,12 +37,18 @@ class TextAnnotation(proto.Message): r"""TextAnnotation contains a structured representation of OCR extracted text. The hierarchy of an OCR extracted text structure is like this: + + TextAnnotation contains a structured representation of OCR extracted text. + The hierarchy of an OCR extracted text structure is like this: + TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol + + TextAnnotation contains a structured representation of OCR extracted + text. The hierarchy of an OCR extracted text structure is like this: TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol Each structural component, starting from Page, may further have their own properties. Properties describe detected languages, breaks etc.. - Please refer to the - [TextAnnotation.TextProperty][google.cloud.vision.v1.TextAnnotation.TextProperty] - message definition below for more detail. + Please refer to the `TextAnnotation.TextProperty `__ message definition below for more + detail. Attributes: pages (MutableSequence[google.cloud.vision_v1.types.Page]): @@ -210,24 +216,20 @@ class Block(proto.Message): is represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example: - - when the text is horizontal it might look like: + * when the text is horizontal it might look like: - :: + 0----1 + | | + 3----2 - 0----1 - | | - 3----2 - - - when it's rotated 180 degrees around the top-left corner + * when it's rotated 180 degrees around the top-left corner it becomes: - :: - - 2----3 - | | - 1----0 + 2----3 + | | + 1----0 - and the vertex order will still be (0, 1, 2, 3). + and the vertex order will still be (0, 1, 2, 3). paragraphs (MutableSequence[google.cloud.vision_v1.types.Paragraph]): List of paragraphs in this block (if this blocks is of type text). @@ -303,11 +305,24 @@ class Paragraph(proto.Message): is represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example: - - when the text is horizontal it might look like: 0----1 \| - \| 3----2 - - when it's rotated 180 degrees around the top-left corner - it becomes: 2----3 \| \| 1----0 and the vertex order will - still be (0, 1, 2, 3). + * when the text is horizontal it might look like: + + * when the text is horizontal it might look like: + 0----1 + | | + 3----2 + + * when it's rotated 180 degrees around the top-left corner + it becomes: + + * when it's rotated 180 degrees around the top-left corner it becomes: + 2----3 + | | + 1----0 + + * when it's rotated 180 degrees around the top-left corner + it becomes: 2----3 | | 1----0 and the vertex order will + still be (0, 1, 2, 3). words (MutableSequence[google.cloud.vision_v1.types.Word]): List of all words in this paragraph. confidence (float): @@ -349,11 +364,24 @@ class Word(proto.Message): represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example: - - when the text is horizontal it might look like: 0----1 \| - \| 3----2 - - when it's rotated 180 degrees around the top-left corner - it becomes: 2----3 \| \| 1----0 and the vertex order will - still be (0, 1, 2, 3). + * when the text is horizontal it might look like: + + * when the text is horizontal it might look like: + 0----1 + | | + 3----2 + + * when it's rotated 180 degrees around the top-left corner + it becomes: + + * when it's rotated 180 degrees around the top-left corner it becomes: + 2----3 + | | + 1----0 + + * when it's rotated 180 degrees around the top-left corner + it becomes: 2----3 | | 1----0 and the vertex order will + still be (0, 1, 2, 3). symbols (MutableSequence[google.cloud.vision_v1.types.Symbol]): List of symbols in the word. The order of the symbols follows the natural @@ -397,11 +425,24 @@ class Symbol(proto.Message): is represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example: - - when the text is horizontal it might look like: 0----1 \| - \| 3----2 - - when it's rotated 180 degrees around the top-left corner - it becomes: 2----3 \| \| 1----0 and the vertex order will - still be (0, 1, 2, 3). + * when the text is horizontal it might look like: + + * when the text is horizontal it might look like: + 0----1 + | | + 3----2 + + * when it's rotated 180 degrees around the top-left corner + it becomes: + + * when it's rotated 180 degrees around the top-left corner it becomes: + 2----3 + | | + 1----0 + + * when it's rotated 180 degrees around the top-left corner + it becomes: 2----3 | | 1----0 and the vertex order will + still be (0, 1, 2, 3). text (str): The actual UTF-8 representation of the symbol. diff --git a/packages/google-cloud-vision/google/cloud/vision_v1/types/web_detection.py b/packages/google-cloud-vision/google/cloud/vision_v1/types/web_detection.py index 11ce1af125ac..f01723b70bf2 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1/types/web_detection.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1/types/web_detection.py @@ -159,8 +159,8 @@ class WebLabel(proto.Message): label (str): Label for extra metadata. language_code (str): - The BCP-47 language code for ``label``, such as "en-US" or - "sr-Latn". For more information, see + The BCP-47 language code for ``label``, such as "en-US" + or "sr-Latn". For more information, see http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. """ diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p1beta1/services/image_annotator/transports/base.py b/packages/google-cloud-vision/google/cloud/vision_v1p1beta1/services/image_annotator/transports/base.py index aaa523f9a02a..8c801f40de89 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p1beta1/services/image_annotator/transports/base.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p1beta1/services/image_annotator/transports/base.py @@ -85,8 +85,6 @@ def __init__( be used for service account credentials. """ - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} - # Save the scopes. self._scopes = scopes if not hasattr(self, "_ignore_credentials"): @@ -101,11 +99,16 @@ def __init__( if credentials_file is not None: credentials, _ = google.auth.load_credentials_from_file( - credentials_file, **scopes_kwargs, quota_project_id=quota_project_id + credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + default_scopes=self.AUTH_SCOPES, ) elif credentials is None and not self._ignore_credentials: credentials, _ = google.auth.default( - **scopes_kwargs, quota_project_id=quota_project_id + scopes=scopes, + quota_project_id=quota_project_id, + default_scopes=self.AUTH_SCOPES, ) # Don't apply audience if the credentials file passed from user. if hasattr(credentials, "with_gdch_audience"): diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p1beta1/types/image_annotator.py b/packages/google-cloud-vision/google/cloud/vision_v1p1beta1/types/image_annotator.py index 5d1e6d68c11e..9527b2ddcd5f 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p1beta1/types/image_annotator.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p1beta1/types/image_annotator.py @@ -88,7 +88,7 @@ class Likelihood(proto.Enum): class Feature(proto.Message): r"""Users describe the type of Google Cloud Vision API tasks to perform - over images by using *Feature*\ s. Each Feature indicates a type of + over images by using *Feature*s. Each Feature indicates a type of image detection task to perform. Features encode the Cloud Vision API vertical to operate on and the number of top-scoring results to return. @@ -101,9 +101,9 @@ class Feature(proto.Message): model (str): Model to use for the feature. Supported values: "builtin/stable" (the default if unset) and - "builtin/latest". ``DOCUMENT_TEXT_DETECTION`` and - ``TEXT_DETECTION`` also support "builtin/weekly" for the - bleeding edge release updated weekly. + "builtin/latest". ``DOCUMENT_TEXT_DETECTION`` and ``TEXT_DETECTION`` also + support "builtin/weekly" for the bleeding edge release + updated weekly. """ class Type(proto.Enum): @@ -170,22 +170,16 @@ class ImageSource(proto.Message): gcs_image_uri (str): NOTE: For new code ``image_uri`` below is preferred. Google Cloud Storage image URI, which must be in the following - form: ``gs://bucket_name/object_name`` (for details, see - `Google Cloud Storage Request - URIs `__). - NOTE: Cloud Storage object versioning is not supported. + form: ``gs://bucket_name/object_name`` (for details, see `Google Cloud Storage Request URIs `__). NOTE: + Cloud Storage object versioning is not supported. image_uri (str): - Image URI which supports: - - 1) Google Cloud Storage image URI, which must be in the - following form: ``gs://bucket_name/object_name`` (for - details, see `Google Cloud Storage Request - URIs `__). - NOTE: Cloud Storage object versioning is not supported. - 2) Publicly accessible image HTTP/HTTPS URL. This is - preferred over the legacy ``gcs_image_uri`` above. When - both ``gcs_image_uri`` and ``image_uri`` are specified, - ``image_uri`` takes precedence. + Image URI which supports: 1) Google Cloud Storage image URI, + which must be in the following form: ``gs://bucket_name/object_name`` (for + details, see `Google Cloud Storage Request URIs `__). NOTE: Cloud Storage object + versioning is not supported. 2) Publicly accessible image + HTTP/HTTPS URL. This is preferred over the legacy + ``gcs_image_uri`` above. When both ``gcs_image_uri`` and + ``image_uri`` are specified, ``image_uri`` takes precedence. """ gcs_image_uri: str = proto.Field( @@ -204,12 +198,13 @@ class Image(proto.Message): Attributes: content (bytes): Image content, represented as a stream of bytes. Note: as - with all ``bytes`` fields, protobuffers use a pure binary - representation, whereas JSON representations use base64. + with all ``bytes`` fields, protobuffers use a pure + binary representation, whereas JSON representations use + base64. source (google.cloud.vision_v1p1beta1.types.ImageSource): - Google Cloud Storage image location. If both ``content`` and - ``source`` are provided for an image, ``content`` takes - precedence and is used to perform the image annotation + Google Cloud Storage image location. If both ``content`` + and ``source`` are provided for an image, ``content`` + takes precedence and is used to perform the image annotation request. """ @@ -235,17 +230,17 @@ class FaceAnnotation(proto.Message): in ``ImageParams``. The bounding box is computed to "frame" the face in accordance with human expectations. It is based on the landmarker results. Note that one or more x and/or y - coordinates may not be generated in the ``BoundingPoly`` - (the polygon will be unbounded) if only a partial face - appears in the image to be annotated. + coordinates may not be generated in the ``BoundingPoly`` (the + polygon will be unbounded) if only a partial face appears in + the image to be annotated. fd_bounding_poly (google.cloud.vision_v1p1beta1.types.BoundingPoly): - The ``fd_bounding_poly`` bounding polygon is tighter than - the ``boundingPoly``, and encloses only the skin part of the - face. Typically, it is used to eliminate the face from any - image analysis that detects the "amount of skin" visible in - an image. It is not based on the landmarker results, only on - the initial face detection, hence the fd (face detection) - prefix. + The ``fd_bounding_poly`` bounding polygon is tighter than the + ``boundingPoly``, and encloses only the skin part of the face. + Typically, it is used to eliminate the face from any image + analysis that detects the "amount of skin" visible in an + image. It is not based on the landmarker results, only on + the initial face detection, hence the fd (face + detection) prefix. landmarks (MutableSequence[google.cloud.vision_v1p1beta1.types.FaceAnnotation.Landmark]): Detected face landmarks. roll_angle (float): @@ -535,9 +530,8 @@ class EntityAnnotation(proto.Message): Attributes: mid (str): - Opaque entity ID. Some IDs may be available in `Google - Knowledge Graph Search - API `__. + Opaque entity ID. Some IDs may be available in + `Google Knowledge Graph Search API `__. locale (str): The language code for the locale in which the entity textual ``description`` is expressed. @@ -563,11 +557,11 @@ class EntityAnnotation(proto.Message): ``LABEL_DETECTION`` features. locations (MutableSequence[google.cloud.vision_v1p1beta1.types.LocationInfo]): The location information for the detected entity. Multiple - ``LocationInfo`` elements can be present because one - location may indicate the location of the scene in the - image, and another location may indicate the location of the - place where the image was taken. Location information is - usually present for landmarks. + ``LocationInfo`` elements can be present because one location + may indicate the location of the scene in the image, and + another location may indicate the location of the place + where the image was taken. Location information is usually + present for landmarks. properties (MutableSequence[google.cloud.vision_v1p1beta1.types.Property]): Some entities may have optional user-supplied ``Property`` (name/value) fields, such a score or string that qualifies @@ -764,7 +758,7 @@ class CropHint(proto.Message): the bounding box are in the original image's scale, as returned in ``ImageParams``. confidence (float): - Confidence of this being a salient region. Range [0, 1]. + Confidence of this being a salient region. Range [0, 1]. importance_fraction (float): Fraction of importance of this salient region with respect to the original image. @@ -872,13 +866,12 @@ class ImageContext(proto.Message): List of languages to use for TEXT_DETECTION. In most cases, an empty value yields the best results since it enables automatic language detection. For languages based on the - Latin alphabet, setting ``language_hints`` is not needed. In - rare cases, when the language of the text in the image is - known, setting a hint will help get better results (although - it will be a significant hindrance if the hint is wrong). - Text detection returns an error if one or more of the - specified languages is not one of the `supported - languages `__. + Latin alphabet, setting ``language_hints`` is not needed. In rare + cases, when the language of the text in the image is known, + setting a hint will help get better results (although it + will be a significant hindrance if the hint is wrong). Text + detection returns an error if one or more of the specified + languages is not one of the `supported languages `__. crop_hints_params (google.cloud.vision_v1p1beta1.types.CropHintsParams): Parameters for crop hints annotation request. web_detection_params (google.cloud.vision_v1p1beta1.types.WebDetectionParams): diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p1beta1/types/text_annotation.py b/packages/google-cloud-vision/google/cloud/vision_v1p1beta1/types/text_annotation.py index 6a1893ff64f2..4c1d6a21dc94 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p1beta1/types/text_annotation.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p1beta1/types/text_annotation.py @@ -37,12 +37,18 @@ class TextAnnotation(proto.Message): r"""TextAnnotation contains a structured representation of OCR extracted text. The hierarchy of an OCR extracted text structure is like this: + + TextAnnotation contains a structured representation of OCR extracted text. + The hierarchy of an OCR extracted text structure is like this: + TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol + + TextAnnotation contains a structured representation of OCR extracted + text. The hierarchy of an OCR extracted text structure is like this: TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol Each structural component, starting from Page, may further have their own properties. Properties describe detected languages, breaks etc.. - Please refer to the - [TextAnnotation.TextProperty][google.cloud.vision.v1p1beta1.TextAnnotation.TextProperty] - message definition below for more detail. + Please refer to the `TextAnnotation.TextProperty `__ message definition below for more + detail. Attributes: pages (MutableSequence[google.cloud.vision_v1p1beta1.types.Page]): @@ -208,11 +214,24 @@ class Block(proto.Message): is represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example: - - when the text is horizontal it might look like: 0----1 \| - \| 3----2 - - when it's rotated 180 degrees around the top-left corner - it becomes: 2----3 \| \| 1----0 and the vertice order will - still be (0, 1, 2, 3). + * when the text is horizontal it might look like: + + * when the text is horizontal it might look like: + 0----1 + | | + 3----2 + + * when it's rotated 180 degrees around the top-left corner + it becomes: + + * when it's rotated 180 degrees around the top-left corner it becomes: + 2----3 + | | + 1----0 + + * when it's rotated 180 degrees around the top-left corner + it becomes: 2----3 | | 1----0 and the vertice order will + still be (0, 1, 2, 3). paragraphs (MutableSequence[google.cloud.vision_v1p1beta1.types.Paragraph]): List of paragraphs in this block (if this blocks is of type text). @@ -288,11 +307,24 @@ class Paragraph(proto.Message): is represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example: - - when the text is horizontal it might look like: 0----1 \| - \| 3----2 - - when it's rotated 180 degrees around the top-left corner - it becomes: 2----3 \| \| 1----0 and the vertice order will - still be (0, 1, 2, 3). + * when the text is horizontal it might look like: + + * when the text is horizontal it might look like: + 0----1 + | | + 3----2 + + * when it's rotated 180 degrees around the top-left corner + it becomes: + + * when it's rotated 180 degrees around the top-left corner it becomes: + 2----3 + | | + 1----0 + + * when it's rotated 180 degrees around the top-left corner + it becomes: 2----3 | | 1----0 and the vertice order will + still be (0, 1, 2, 3). words (MutableSequence[google.cloud.vision_v1p1beta1.types.Word]): List of words in this paragraph. confidence (float): @@ -334,11 +366,24 @@ class Word(proto.Message): represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example: - - when the text is horizontal it might look like: 0----1 \| - \| 3----2 - - when it's rotated 180 degrees around the top-left corner - it becomes: 2----3 \| \| 1----0 and the vertice order will - still be (0, 1, 2, 3). + * when the text is horizontal it might look like: + + * when the text is horizontal it might look like: + 0----1 + | | + 3----2 + + * when it's rotated 180 degrees around the top-left corner + it becomes: + + * when it's rotated 180 degrees around the top-left corner it becomes: + 2----3 + | | + 1----0 + + * when it's rotated 180 degrees around the top-left corner + it becomes: 2----3 | | 1----0 and the vertice order will + still be (0, 1, 2, 3). symbols (MutableSequence[google.cloud.vision_v1p1beta1.types.Symbol]): List of symbols in the word. The order of the symbols follows the natural @@ -382,11 +427,24 @@ class Symbol(proto.Message): is represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example: - - when the text is horizontal it might look like: 0----1 \| - \| 3----2 - - when it's rotated 180 degrees around the top-left corner - it becomes: 2----3 \| \| 1----0 and the vertice order will - still be (0, 1, 2, 3). + * when the text is horizontal it might look like: + + * when the text is horizontal it might look like: + 0----1 + | | + 3----2 + + * when it's rotated 180 degrees around the top-left corner + it becomes: + + * when it's rotated 180 degrees around the top-left corner it becomes: + 2----3 + | | + 1----0 + + * when it's rotated 180 degrees around the top-left corner + it becomes: 2----3 | | 1----0 and the vertice order will + still be (0, 1, 2, 3). text (str): The actual UTF-8 representation of the symbol. diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p1beta1/types/web_detection.py b/packages/google-cloud-vision/google/cloud/vision_v1p1beta1/types/web_detection.py index bdfaf20fc558..2429d18853ed 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p1beta1/types/web_detection.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p1beta1/types/web_detection.py @@ -157,8 +157,8 @@ class WebLabel(proto.Message): label (str): Label for extra metadata. language_code (str): - The BCP-47 language code for ``label``, such as "en-US" or - "sr-Latn". For more information, see + The BCP-47 language code for ``label``, such as "en-US" + or "sr-Latn". For more information, see http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. """ diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/services/image_annotator/async_client.py b/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/services/image_annotator/async_client.py index fb5632ad071d..7f5fd23412f2 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/services/image_annotator/async_client.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/services/image_annotator/async_client.py @@ -417,10 +417,9 @@ async def async_batch_annotate_files( r"""Run async image detection and annotation for a list of generic files (e.g. PDF) which may contain multiple pages and multiple images per page. Progress and results can be retrieved through - the ``google.longrunning.Operations`` interface. - ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains - ``AsyncBatchAnnotateFilesResponse`` (results). + the ``google.longrunning.Operations`` interface. ``Operation.metadata`` contains + ``OperationMetadata`` (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` + (results). .. code-block:: python diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/services/image_annotator/client.py b/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/services/image_annotator/client.py index aa9125703821..a830e582b85e 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/services/image_annotator/client.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/services/image_annotator/client.py @@ -835,10 +835,9 @@ def async_batch_annotate_files( r"""Run async image detection and annotation for a list of generic files (e.g. PDF) which may contain multiple pages and multiple images per page. Progress and results can be retrieved through - the ``google.longrunning.Operations`` interface. - ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains - ``AsyncBatchAnnotateFilesResponse`` (results). + the ``google.longrunning.Operations`` interface. ``Operation.metadata`` contains + ``OperationMetadata`` (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` + (results). .. code-block:: python diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/services/image_annotator/transports/base.py b/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/services/image_annotator/transports/base.py index 0e16cba7627b..404a1726b8de 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/services/image_annotator/transports/base.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/services/image_annotator/transports/base.py @@ -86,8 +86,6 @@ def __init__( be used for service account credentials. """ - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} - # Save the scopes. self._scopes = scopes if not hasattr(self, "_ignore_credentials"): @@ -102,11 +100,16 @@ def __init__( if credentials_file is not None: credentials, _ = google.auth.load_credentials_from_file( - credentials_file, **scopes_kwargs, quota_project_id=quota_project_id + credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + default_scopes=self.AUTH_SCOPES, ) elif credentials is None and not self._ignore_credentials: credentials, _ = google.auth.default( - **scopes_kwargs, quota_project_id=quota_project_id + scopes=scopes, + quota_project_id=quota_project_id, + default_scopes=self.AUTH_SCOPES, ) # Don't apply audience if the credentials file passed from user. if hasattr(credentials, "with_gdch_audience"): diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/services/image_annotator/transports/grpc.py b/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/services/image_annotator/transports/grpc.py index 7fe5866362e2..a185836675c9 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/services/image_annotator/transports/grpc.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/services/image_annotator/transports/grpc.py @@ -383,10 +383,9 @@ def async_batch_annotate_files( Run async image detection and annotation for a list of generic files (e.g. PDF) which may contain multiple pages and multiple images per page. Progress and results can be retrieved through - the ``google.longrunning.Operations`` interface. - ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains - ``AsyncBatchAnnotateFilesResponse`` (results). + the ``google.longrunning.Operations`` interface. ``Operation.metadata`` contains + ``OperationMetadata`` (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` + (results). Returns: Callable[[~.AsyncBatchAnnotateFilesRequest], diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/services/image_annotator/transports/grpc_asyncio.py b/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/services/image_annotator/transports/grpc_asyncio.py index 41879c4326a0..acd2bda2b145 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/services/image_annotator/transports/grpc_asyncio.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/services/image_annotator/transports/grpc_asyncio.py @@ -392,10 +392,9 @@ def async_batch_annotate_files( Run async image detection and annotation for a list of generic files (e.g. PDF) which may contain multiple pages and multiple images per page. Progress and results can be retrieved through - the ``google.longrunning.Operations`` interface. - ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains - ``AsyncBatchAnnotateFilesResponse`` (results). + the ``google.longrunning.Operations`` interface. ``Operation.metadata`` contains + ``OperationMetadata`` (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` + (results). Returns: Callable[[~.AsyncBatchAnnotateFilesRequest], diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/types/image_annotator.py b/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/types/image_annotator.py index 89143e766721..cbcef9fab858 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/types/image_annotator.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/types/image_annotator.py @@ -108,14 +108,13 @@ class Feature(proto.Message): The feature type. max_results (int): Maximum number of results of this type. Does not apply to - ``TEXT_DETECTION``, ``DOCUMENT_TEXT_DETECTION``, or - ``CROP_HINTS``. + ``TEXT_DETECTION``, ``DOCUMENT_TEXT_DETECTION``, or ``CROP_HINTS``. model (str): Model to use for the feature. Supported values: "builtin/stable" (the default if unset) and - "builtin/latest". ``DOCUMENT_TEXT_DETECTION`` and - ``TEXT_DETECTION`` also support "builtin/weekly" for the - bleeding edge release updated weekly. + "builtin/latest". ``DOCUMENT_TEXT_DETECTION`` and ``TEXT_DETECTION`` also + support "builtin/weekly" for the bleeding edge release + updated weekly. """ class Type(proto.Enum): @@ -135,12 +134,11 @@ class Type(proto.Enum): TEXT_DETECTION (5): Run text detection / optical character recognition (OCR). Text detection is optimized for areas of text within a - larger image; if the image is a document, use - ``DOCUMENT_TEXT_DETECTION`` instead. + larger image; if the image is a document, use ``DOCUMENT_TEXT_DETECTION`` + instead. DOCUMENT_TEXT_DETECTION (11): Run dense text document OCR. Takes precedence when both - ``DOCUMENT_TEXT_DETECTION`` and ``TEXT_DETECTION`` are - present. + ``DOCUMENT_TEXT_DETECTION`` and ``TEXT_DETECTION`` are present. SAFE_SEARCH_DETECTION (6): Run Safe Search to detect potentially unsafe or undesirable content. @@ -187,28 +185,29 @@ class ImageSource(proto.Message): gcs_image_uri (str): **Use ``image_uri`` instead.** - The Google Cloud Storage URI of the form - ``gs://bucket_name/object_name``. Object versioning is not - supported. See `Google Cloud Storage Request - URIs `__ - for more info. + The Google Cloud Storage URI of the form ``gs://bucket_name/object_name``. + Object versioning is not supported. See `Google Cloud Storage Request URIs `__ for + more info. image_uri (str): The URI of the source image. Can be either: 1. A Google Cloud Storage URI of the form - ``gs://bucket_name/object_name``. Object versioning is - not supported. See `Google Cloud Storage Request - URIs `__ - for more info. + + 1. A Google Cloud Storage URI of the form + ``gs://bucket_name/object_name``. Object versioning is not supported. See + `Google Cloud Storage Request + URIs `__ for more + info. 2. A publicly-accessible image HTTP/HTTPS URL. When fetching - images from HTTP/HTTPS URLs, Google cannot guarantee that - the request will be completed. Your request may fail if - the specified host denies the request (e.g. due to - request throttling or DOS prevention), or if Google - throttles requests to the site for abuse prevention. You - should not depend on externally-hosted images for - production applications. + images from + + 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from + HTTP/HTTPS URLs, Google cannot guarantee that the request will be + completed. Your request may fail if the specified host denies the + request (e.g. due to request throttling or DOS prevention), or if Google + throttles requests to the site for abuse prevention. You should not + depend on externally-hosted images for production applications. When both ``gcs_image_uri`` and ``image_uri`` are specified, ``image_uri`` takes precedence. @@ -230,13 +229,14 @@ class Image(proto.Message): Attributes: content (bytes): Image content, represented as a stream of bytes. Note: As - with all ``bytes`` fields, protobuffers use a pure binary - representation, whereas JSON representations use base64. + with all ``bytes`` fields, protobuffers use a pure + binary representation, whereas JSON representations use + base64. source (google.cloud.vision_v1p2beta1.types.ImageSource): Google Cloud Storage image location, or publicly-accessible - image URL. If both ``content`` and ``source`` are provided - for an image, ``content`` takes precedence and is used to - perform the image annotation request. + image URL. If both ``content`` and ``source`` are + provided for an image, ``content`` takes precedence and is + used to perform the image annotation request. """ content: bytes = proto.Field( @@ -261,17 +261,17 @@ class FaceAnnotation(proto.Message): in ``ImageParams``. The bounding box is computed to "frame" the face in accordance with human expectations. It is based on the landmarker results. Note that one or more x and/or y - coordinates may not be generated in the ``BoundingPoly`` - (the polygon will be unbounded) if only a partial face - appears in the image to be annotated. + coordinates may not be generated in the ``BoundingPoly`` (the + polygon will be unbounded) if only a partial face appears in + the image to be annotated. fd_bounding_poly (google.cloud.vision_v1p2beta1.types.BoundingPoly): - The ``fd_bounding_poly`` bounding polygon is tighter than - the ``boundingPoly``, and encloses only the skin part of the - face. Typically, it is used to eliminate the face from any - image analysis that detects the "amount of skin" visible in - an image. It is not based on the landmarker results, only on - the initial face detection, hence the fd (face detection) - prefix. + The ``fd_bounding_poly`` bounding polygon is tighter than the + ``boundingPoly``, and encloses only the skin part of the face. + Typically, it is used to eliminate the face from any image + analysis that detects the "amount of skin" visible in an + image. It is not based on the landmarker results, only on + the initial face detection, hence the fd (face + detection) prefix. landmarks (MutableSequence[google.cloud.vision_v1p2beta1.types.FaceAnnotation.Landmark]): Detected face landmarks. roll_angle (float): @@ -561,9 +561,8 @@ class EntityAnnotation(proto.Message): Attributes: mid (str): - Opaque entity ID. Some IDs may be available in `Google - Knowledge Graph Search - API `__. + Opaque entity ID. Some IDs may be available in + `Google Knowledge Graph Search API `__. locale (str): The language code for the locale in which the entity textual ``description`` is expressed. @@ -573,9 +572,9 @@ class EntityAnnotation(proto.Message): score (float): Overall score of the result. Range [0, 1]. confidence (float): - **Deprecated. Use ``score`` instead.** The accuracy of the - entity detection in an image. For example, for an image in - which the "Eiffel Tower" entity is detected, this field + **Deprecated. Use ``score`` instead.** The accuracy of + the entity detection in an image. For example, for an image + in which the "Eiffel Tower" entity is detected, this field represents the confidence that there is a tower in the query image. Range [0, 1]. topicality (float): @@ -590,11 +589,11 @@ class EntityAnnotation(proto.Message): ``LABEL_DETECTION`` features. locations (MutableSequence[google.cloud.vision_v1p2beta1.types.LocationInfo]): The location information for the detected entity. Multiple - ``LocationInfo`` elements can be present because one - location may indicate the location of the scene in the - image, and another location may indicate the location of the - place where the image was taken. Location information is - usually present for landmarks. + ``LocationInfo`` elements can be present because one location + may indicate the location of the scene in the image, and + another location may indicate the location of the place + where the image was taken. Location information is usually + present for landmarks. properties (MutableSequence[google.cloud.vision_v1p2beta1.types.Property]): Some entities may have optional user-supplied ``Property`` (name/value) fields, such a score or string that qualifies @@ -791,7 +790,7 @@ class CropHint(proto.Message): the bounding box are in the original image's scale, as returned in ``ImageParams``. confidence (float): - Confidence of this being a salient region. Range [0, 1]. + Confidence of this being a salient region. Range [0, 1]. importance_fraction (float): Fraction of importance of this salient region with respect to the original image. @@ -898,13 +897,12 @@ class ImageContext(proto.Message): List of languages to use for TEXT_DETECTION. In most cases, an empty value yields the best results since it enables automatic language detection. For languages based on the - Latin alphabet, setting ``language_hints`` is not needed. In - rare cases, when the language of the text in the image is - known, setting a hint will help get better results (although - it will be a significant hindrance if the hint is wrong). - Text detection returns an error if one or more of the - specified languages is not one of the `supported - languages `__. + Latin alphabet, setting ``language_hints`` is not needed. In rare + cases, when the language of the text in the image is known, + setting a hint will help get better results (although it + will be a significant hindrance if the hint is wrong). Text + detection returns an error if one or more of the specified + languages is not one of the `supported languages `__. crop_hints_params (google.cloud.vision_v1p2beta1.types.CropHintsParams): Parameters for crop hints annotation request. web_detection_params (google.cloud.vision_v1p2beta1.types.WebDetectionParams): @@ -1286,9 +1284,9 @@ class OutputConfig(proto.Message): specified, the default value is 20. For example, for one pdf file with 100 pages, 100 response - protos will be generated. If ``batch_size`` = 20, then 5 - json files each containing 20 response protos will be - written under the prefix ``gcs_destination``.\ ``uri``. + protos will be generated. If ``batch_size`` = 20, then 5 json + files each containing 20 response protos will be written + under the prefix ``gcs_destination``.``uri``. Currently, batch_size only applies to GcsDestination, with potential future support for other output configurations. @@ -1336,9 +1334,11 @@ class GcsDestination(proto.Message): Examples: - - File: gs://bucket-name/filename.json - - Prefix: gs://bucket-name/prefix/here/ - - File: gs://bucket-name/prefix/here + * File: gs://bucket-name/filename.json + + * Prefix: gs://bucket-name/prefix/here/ + + * File: gs://bucket-name/prefix/here If multiple outputs, each response is still AnnotateFileResponse, each of which contains some subset of diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/types/text_annotation.py b/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/types/text_annotation.py index 1fed739872b4..8224c0280cb0 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/types/text_annotation.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/types/text_annotation.py @@ -37,12 +37,18 @@ class TextAnnotation(proto.Message): r"""TextAnnotation contains a structured representation of OCR extracted text. The hierarchy of an OCR extracted text structure is like this: + + TextAnnotation contains a structured representation of OCR extracted text. + The hierarchy of an OCR extracted text structure is like this: + TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol + + TextAnnotation contains a structured representation of OCR extracted + text. The hierarchy of an OCR extracted text structure is like this: TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol Each structural component, starting from Page, may further have their own properties. Properties describe detected languages, breaks etc.. - Please refer to the - [TextAnnotation.TextProperty][google.cloud.vision.v1p2beta1.TextAnnotation.TextProperty] - message definition below for more detail. + Please refer to the `TextAnnotation.TextProperty `__ message definition below for more + detail. Attributes: pages (MutableSequence[google.cloud.vision_v1p2beta1.types.Page]): @@ -210,24 +216,20 @@ class Block(proto.Message): is represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example: - - when the text is horizontal it might look like: + * when the text is horizontal it might look like: - :: + 0----1 + | | + 3----2 - 0----1 - | | - 3----2 - - - when it's rotated 180 degrees around the top-left corner + * when it's rotated 180 degrees around the top-left corner it becomes: - :: - - 2----3 - | | - 1----0 + 2----3 + | | + 1----0 - and the vertice order will still be (0, 1, 2, 3). + and the vertice order will still be (0, 1, 2, 3). paragraphs (MutableSequence[google.cloud.vision_v1p2beta1.types.Paragraph]): List of paragraphs in this block (if this blocks is of type text). @@ -303,11 +305,24 @@ class Paragraph(proto.Message): is represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example: - - when the text is horizontal it might look like: 0----1 \| - \| 3----2 - - when it's rotated 180 degrees around the top-left corner - it becomes: 2----3 \| \| 1----0 and the vertice order will - still be (0, 1, 2, 3). + * when the text is horizontal it might look like: + + * when the text is horizontal it might look like: + 0----1 + | | + 3----2 + + * when it's rotated 180 degrees around the top-left corner + it becomes: + + * when it's rotated 180 degrees around the top-left corner it becomes: + 2----3 + | | + 1----0 + + * when it's rotated 180 degrees around the top-left corner + it becomes: 2----3 | | 1----0 and the vertice order will + still be (0, 1, 2, 3). words (MutableSequence[google.cloud.vision_v1p2beta1.types.Word]): List of words in this paragraph. confidence (float): @@ -349,11 +364,24 @@ class Word(proto.Message): represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example: - - when the text is horizontal it might look like: 0----1 \| - \| 3----2 - - when it's rotated 180 degrees around the top-left corner - it becomes: 2----3 \| \| 1----0 and the vertice order will - still be (0, 1, 2, 3). + * when the text is horizontal it might look like: + + * when the text is horizontal it might look like: + 0----1 + | | + 3----2 + + * when it's rotated 180 degrees around the top-left corner + it becomes: + + * when it's rotated 180 degrees around the top-left corner it becomes: + 2----3 + | | + 1----0 + + * when it's rotated 180 degrees around the top-left corner + it becomes: 2----3 | | 1----0 and the vertice order will + still be (0, 1, 2, 3). symbols (MutableSequence[google.cloud.vision_v1p2beta1.types.Symbol]): List of symbols in the word. The order of the symbols follows the natural @@ -397,11 +425,24 @@ class Symbol(proto.Message): is represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example: - - when the text is horizontal it might look like: 0----1 \| - \| 3----2 - - when it's rotated 180 degrees around the top-left corner - it becomes: 2----3 \| \| 1----0 and the vertice order will - still be (0, 1, 2, 3). + * when the text is horizontal it might look like: + + * when the text is horizontal it might look like: + 0----1 + | | + 3----2 + + * when it's rotated 180 degrees around the top-left corner + it becomes: + + * when it's rotated 180 degrees around the top-left corner it becomes: + 2----3 + | | + 1----0 + + * when it's rotated 180 degrees around the top-left corner + it becomes: 2----3 | | 1----0 and the vertice order will + still be (0, 1, 2, 3). text (str): The actual UTF-8 representation of the symbol. diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/types/web_detection.py b/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/types/web_detection.py index 648d4e415953..84e3baa931e7 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/types/web_detection.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p2beta1/types/web_detection.py @@ -157,8 +157,8 @@ class WebLabel(proto.Message): label (str): Label for extra metadata. language_code (str): - The BCP-47 language code for ``label``, such as "en-US" or - "sr-Latn". For more information, see + The BCP-47 language code for ``label``, such as "en-US" + or "sr-Latn". For more information, see http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. """ diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/image_annotator/async_client.py b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/image_annotator/async_client.py index 2d7135564480..a1af5bceafd7 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/image_annotator/async_client.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/image_annotator/async_client.py @@ -420,9 +420,8 @@ async def async_batch_annotate_files( r"""Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be - retrieved through the ``google.longrunning.Operations`` - interface. ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains + retrieved through the ``google.longrunning.Operations`` interface. ``Operation.metadata`` + contains ``OperationMetadata`` (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` (results). .. code-block:: python diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/image_annotator/client.py b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/image_annotator/client.py index d459e909b674..66e862558066 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/image_annotator/client.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/image_annotator/client.py @@ -880,9 +880,8 @@ def async_batch_annotate_files( r"""Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be - retrieved through the ``google.longrunning.Operations`` - interface. ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains + retrieved through the ``google.longrunning.Operations`` interface. ``Operation.metadata`` + contains ``OperationMetadata`` (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` (results). .. code-block:: python diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/image_annotator/transports/base.py b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/image_annotator/transports/base.py index 1f027daad808..178bf370dae7 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/image_annotator/transports/base.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/image_annotator/transports/base.py @@ -86,8 +86,6 @@ def __init__( be used for service account credentials. """ - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} - # Save the scopes. self._scopes = scopes if not hasattr(self, "_ignore_credentials"): @@ -102,11 +100,16 @@ def __init__( if credentials_file is not None: credentials, _ = google.auth.load_credentials_from_file( - credentials_file, **scopes_kwargs, quota_project_id=quota_project_id + credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + default_scopes=self.AUTH_SCOPES, ) elif credentials is None and not self._ignore_credentials: credentials, _ = google.auth.default( - **scopes_kwargs, quota_project_id=quota_project_id + scopes=scopes, + quota_project_id=quota_project_id, + default_scopes=self.AUTH_SCOPES, ) # Don't apply audience if the credentials file passed from user. if hasattr(credentials, "with_gdch_audience"): diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc.py b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc.py index 19d16fc5d3a5..72737925b3e5 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc.py @@ -383,9 +383,8 @@ def async_batch_annotate_files( Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be - retrieved through the ``google.longrunning.Operations`` - interface. ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains + retrieved through the ``google.longrunning.Operations`` interface. ``Operation.metadata`` + contains ``OperationMetadata`` (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` (results). Returns: diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc_asyncio.py b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc_asyncio.py index 73745c486211..7b91a85d5429 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc_asyncio.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/image_annotator/transports/grpc_asyncio.py @@ -392,9 +392,8 @@ def async_batch_annotate_files( Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be - retrieved through the ``google.longrunning.Operations`` - interface. ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains + retrieved through the ``google.longrunning.Operations`` interface. ``Operation.metadata`` + contains ``OperationMetadata`` (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` (results). Returns: diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/async_client.py b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/async_client.py index 5902002a7d3d..aa9baaf295d6 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/async_client.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/async_client.py @@ -71,22 +71,18 @@ class ProductSearchAsyncClient: """Manages Products and ProductSets of reference images for use in product search. It uses the following resource model: - - The API has a collection of - [ProductSet][google.cloud.vision.v1p3beta1.ProductSet] resources, - named ``projects/*/locations/*/productSets/*``, which acts as a - way to put different products into groups to limit identification. + - The API has a collection of `ProductSet `__ resources, named + + ``projects/*/locations/*/productSets/*``, which acts as a way to put different products into + groups to limit identification. In parallel, - - The API has a collection of - [Product][google.cloud.vision.v1p3beta1.Product] resources, named + - The API has a collection of `Product `__ resources, named ``projects/*/locations/*/products/*`` - - Each [Product][google.cloud.vision.v1p3beta1.Product] has a - collection of - [ReferenceImage][google.cloud.vision.v1p3beta1.ReferenceImage] - resources, named - ``projects/*/locations/*/products/*/referenceImages/*`` + - Each `Product `__ has a collection of `ReferenceImage `__ resources, + named ``projects/*/locations/*/products/*/referenceImages/*`` """ _client: ProductSearchClient @@ -335,7 +331,7 @@ async def create_product_set( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing, or is + * Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters. .. code-block:: python @@ -386,7 +382,8 @@ async def sample_create_product_set(): the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 - characters long. It cannot contain the character ``/``. + characters long. It cannot contain the character + ``/``. This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this @@ -476,7 +473,7 @@ async def list_product_sets( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100, or + * Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1. .. code-block:: python @@ -528,7 +525,7 @@ async def sample_list_product_sets(): Returns: google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductSetsAsyncPager: - Response message for the ListProductSets method. + Response message for the ``ListProductSets`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -609,7 +606,7 @@ async def get_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. + * Returns NOT_FOUND if the ProductSet does not exist. .. code-block:: python @@ -643,8 +640,7 @@ async def sample_get_product_set(): name (:class:`str`): Required. Resource name of the ProductSet to get. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -732,8 +728,9 @@ async def update_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the ProductSet does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but missing from the request or longer than 4096 characters. @@ -773,10 +770,9 @@ async def sample_update_product_set(): on the ``request`` instance; if ``request`` is provided, this should not be set. update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - The [FieldMask][google.protobuf.FieldMask] that - specifies which fields to update. If update_mask isn't - specified, all mutable fields are to be updated. Valid - mask path is ``display_name``. + The `FieldMask `__ that specifies which fields to update. + If update_mask isn't specified, all mutable fields are + to be updated. Valid mask path is ``display_name``. This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this @@ -870,7 +866,7 @@ async def delete_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. + * Returns NOT_FOUND if the ProductSet does not exist. .. code-block:: python @@ -901,8 +897,7 @@ async def sample_delete_product_set(): name (:class:`str`): Required. Resource name of the ProductSet to delete. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -978,11 +973,13 @@ async def create_product( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing or longer + * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is longer than 4096 + + * Returns INVALID_ARGUMENT if description is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is missing or + + * Returns INVALID_ARGUMENT if product_category is missing or invalid. .. code-block:: python @@ -1033,7 +1030,8 @@ async def sample_create_product(): the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 - characters long. It cannot contain the character ``/``. + characters long. It cannot contain the character + ``/``. This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this @@ -1118,7 +1116,7 @@ async def list_products( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. .. code-block:: python @@ -1170,7 +1168,7 @@ async def sample_list_products(): Returns: google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductsAsyncPager: - Response message for the ListProducts method. + Response message for the ``ListProducts`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1249,7 +1247,7 @@ async def get_product( Possible errors: - - Returns NOT_FOUND if the Product does not exist. + * Returns NOT_FOUND if the Product does not exist. .. code-block:: python @@ -1283,8 +1281,7 @@ async def sample_get_product(): name (:class:`str`): Required. Resource name of the Product to get. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -1370,13 +1367,16 @@ async def update_product( Possible errors: - - Returns NOT_FOUND if the Product does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the Product does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from the request or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is present in + + * Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is present in + + * Returns INVALID_ARGUMENT if product_category is present in update_mask. .. code-block:: python @@ -1416,11 +1416,10 @@ async def sample_update_product(): on the ``request`` instance; if ``request`` is provided, this should not be set. update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - The [FieldMask][google.protobuf.FieldMask] that - specifies which fields to update. If update_mask isn't - specified, all mutable fields are to be updated. Valid - mask paths include ``product_labels``, ``display_name``, - and ``description``. + The `FieldMask `__ that specifies which fields to update. + If update_mask isn't specified, all mutable fields are + to be updated. Valid mask paths include ``product_labels``, + ``display_name``, and ``description``. This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this @@ -1509,7 +1508,7 @@ async def delete_product( Possible errors: - - Returns NOT_FOUND if the product does not exist. + * Returns NOT_FOUND if the product does not exist. .. code-block:: python @@ -1540,8 +1539,7 @@ async def sample_delete_product(): name (:class:`str`): Required. Resource name of product to delete. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -1615,25 +1613,27 @@ async def create_reference_image( ) -> product_search_service.ReferenceImage: r"""Creates and returns a new ReferenceImage resource. - The ``bounding_poly`` field is optional. If ``bounding_poly`` is - not specified, the system will try to detect regions of interest - in the image that are compatible with the product_category on - the parent product. If it is specified, detection is ALWAYS - skipped. The system converts polygons into non-rotated - rectangles. + The ``bounding_poly`` field is optional. If ``bounding_poly`` is not + specified, the system will try to detect regions of interest in + the image that are compatible with the product_category on the + parent product. If it is specified, detection is ALWAYS skipped. + The system converts polygons into non-rotated rectangles. Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP). Possible errors: - - Returns INVALID_ARGUMENT if the image_uri is missing or longer + * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if the product does not exist. - - Returns INVALID_ARGUMENT if bounding_poly is not provided, and + + * Returns INVALID_ARGUMENT if the product does not exist. + + * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with the parent product's product_category is detected. - - Returns INVALID_ARGUMENT if bounding_poly contains more than + + * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. .. code-block:: python @@ -1673,8 +1673,7 @@ async def sample_create_reference_image(): Required. Resource name of the product in which to create the reference image. - Format is - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this @@ -1692,7 +1691,8 @@ async def sample_create_reference_image(): added. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 - characters long. It cannot contain the character ``/``. + characters long. It cannot contain the character + ``/``. This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this @@ -1707,8 +1707,8 @@ async def sample_create_reference_image(): Returns: google.cloud.vision_v1p3beta1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1786,7 +1786,7 @@ async def delete_reference_image( Possible errors: - - Returns NOT_FOUND if the reference image does not exist. + * Returns NOT_FOUND if the reference image does not exist. .. code-block:: python @@ -1894,8 +1894,9 @@ async def list_reference_images( Possible errors: - - Returns NOT_FOUND if the parent product does not exist. - - Returns INVALID_ARGUMENT if the page_size is greater than 100, + * Returns NOT_FOUND if the parent product does not exist. + + * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1. .. code-block:: python @@ -1932,8 +1933,7 @@ async def sample_list_reference_images(): Required. Resource name of the product containing the reference images. - Format is - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this @@ -1948,7 +1948,7 @@ async def sample_list_reference_images(): Returns: google.cloud.vision_v1p3beta1.services.product_search.pagers.ListReferenceImagesAsyncPager: - Response message for the ListReferenceImages method. + Response message for the ``ListReferenceImages`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -2029,7 +2029,7 @@ async def get_reference_image( Possible errors: - - Returns NOT_FOUND if the specified image does not exist. + * Returns NOT_FOUND if the specified image does not exist. .. code-block:: python @@ -2081,8 +2081,8 @@ async def sample_get_reference_image(): Returns: google.cloud.vision_v1p3beta1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -2153,7 +2153,7 @@ async def add_product_to_product_set( Possible errors: - - Returns NOT_FOUND if the Product or the ProductSet doesn't + * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. .. code-block:: python @@ -2182,14 +2182,12 @@ async def sample_add_product_to_product_set(): Args: request (Optional[Union[google.cloud.vision_v1p3beta1.types.AddProductToProductSetRequest, dict]]): - The request object. Request message for the ``AddProductToProductSet`` - method. + The request object. Request message for the ``AddProductToProductSet`` method. name (:class:`str`): Required. The resource name for the ProductSet to modify. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2198,8 +2196,7 @@ async def sample_add_product_to_product_set(): Required. The resource name for the Product to be added to this ProductSet. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this @@ -2278,7 +2275,7 @@ async def remove_product_from_product_set( Possible errors: - - Returns NOT_FOUND If the Product is not found under the + * Returns NOT_FOUND If the Product is not found under the ProductSet. .. code-block:: python @@ -2307,14 +2304,12 @@ async def sample_remove_product_from_product_set(): Args: request (Optional[Union[google.cloud.vision_v1p3beta1.types.RemoveProductFromProductSetRequest, dict]]): - The request object. Request message for the ``RemoveProductFromProductSet`` - method. + The request object. Request message for the ``RemoveProductFromProductSet`` method. name (:class:`str`): Required. The resource name for the ProductSet to modify. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2323,8 +2318,7 @@ async def sample_remove_product_from_product_set(): Required. The resource name for the Product to be removed from this ProductSet. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this @@ -2404,7 +2398,7 @@ async def list_products_in_product_set( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. .. code-block:: python @@ -2436,14 +2430,12 @@ async def sample_list_products_in_product_set(): Args: request (Optional[Union[google.cloud.vision_v1p3beta1.types.ListProductsInProductSetRequest, dict]]): - The request object. Request message for the ``ListProductsInProductSet`` - method. + The request object. Request message for the ``ListProductsInProductSet`` method. name (:class:`str`): Required. The ProductSet resource for which to retrieve Products. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2458,8 +2450,7 @@ async def sample_list_products_in_product_set(): Returns: google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductsInProductSetAsyncPager: - Response message for the ListProductsInProductSet - method. + Response message for the ``ListProductsInProductSet`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -2544,15 +2535,14 @@ async def import_product_sets( r"""Asynchronous API that imports a list of reference images to specified product sets based on a list of image information. - The [google.longrunning.Operation][google.longrunning.Operation] - API can be used to keep track of the progress and results of the - request. ``Operation.metadata`` contains - ``BatchOperationMetadata``. (progress) ``Operation.response`` - contains ``ImportProductSetsResponse``. (results) + The `google.longrunning.Operation `__ API can be used to keep track of the progress + and results of the request. ``Operation.metadata`` contains + ``BatchOperationMetadata``. (progress) ``Operation.response`` contains ``ImportProductSetsResponse``. + (results) The input source of this method is a csv file on Google Cloud Storage. For the format of the csv file please see - [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource.csv_file_uri]. + `ImportProductSetsGcsSource.csv_file_uri `__. .. code-block:: python @@ -2616,14 +2606,11 @@ async def sample_import_product_sets(): An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1p3beta1.types.ImportProductSetsResponse` - Response message for the ImportProductSets method. - - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + :class:`google.cloud.vision_v1p3beta1.types.ImportProductSetsResponse`` Response message for the ``ImportProductSets` + method. + + This message is returned by the `google.longrunning.Operations.GetOperation `__ method in + the returned `google.longrunning.Operation.response `__ field. """ # Create or coerce a protobuf request object. diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/client.py b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/client.py index 49204ee8fdac..ec540bbb000e 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/client.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/client.py @@ -115,22 +115,18 @@ class ProductSearchClient(metaclass=ProductSearchClientMeta): """Manages Products and ProductSets of reference images for use in product search. It uses the following resource model: - - The API has a collection of - [ProductSet][google.cloud.vision.v1p3beta1.ProductSet] resources, - named ``projects/*/locations/*/productSets/*``, which acts as a - way to put different products into groups to limit identification. + - The API has a collection of `ProductSet `__ resources, named + + ``projects/*/locations/*/productSets/*``, which acts as a way to put different products into + groups to limit identification. In parallel, - - The API has a collection of - [Product][google.cloud.vision.v1p3beta1.Product] resources, named + - The API has a collection of `Product `__ resources, named ``projects/*/locations/*/products/*`` - - Each [Product][google.cloud.vision.v1p3beta1.Product] has a - collection of - [ReferenceImage][google.cloud.vision.v1p3beta1.ReferenceImage] - resources, named - ``projects/*/locations/*/products/*/referenceImages/*`` + - Each `Product `__ has a collection of `ReferenceImage `__ resources, + named ``projects/*/locations/*/products/*/referenceImages/*`` """ @staticmethod @@ -816,7 +812,7 @@ def create_product_set( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing, or is + * Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters. .. code-block:: python @@ -867,7 +863,8 @@ def sample_create_product_set(): the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 - characters long. It cannot contain the character ``/``. + characters long. It cannot contain the character + ``/``. This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this @@ -954,7 +951,7 @@ def list_product_sets( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100, or + * Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1. .. code-block:: python @@ -1006,7 +1003,7 @@ def sample_list_product_sets(): Returns: google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductSetsPager: - Response message for the ListProductSets method. + Response message for the ``ListProductSets`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1084,7 +1081,7 @@ def get_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. + * Returns NOT_FOUND if the ProductSet does not exist. .. code-block:: python @@ -1118,8 +1115,7 @@ def sample_get_product_set(): name (str): Required. Resource name of the ProductSet to get. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -1204,8 +1200,9 @@ def update_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the ProductSet does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but missing from the request or longer than 4096 characters. @@ -1245,10 +1242,9 @@ def sample_update_product_set(): on the ``request`` instance; if ``request`` is provided, this should not be set. update_mask (google.protobuf.field_mask_pb2.FieldMask): - The [FieldMask][google.protobuf.FieldMask] that - specifies which fields to update. If update_mask isn't - specified, all mutable fields are to be updated. Valid - mask path is ``display_name``. + The `FieldMask `__ that specifies which fields to update. + If update_mask isn't specified, all mutable fields are + to be updated. Valid mask path is ``display_name``. This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this @@ -1339,7 +1335,7 @@ def delete_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. + * Returns NOT_FOUND if the ProductSet does not exist. .. code-block:: python @@ -1370,8 +1366,7 @@ def sample_delete_product_set(): name (str): Required. Resource name of the ProductSet to delete. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -1444,11 +1439,13 @@ def create_product( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing or longer + * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is longer than 4096 + + * Returns INVALID_ARGUMENT if description is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is missing or + + * Returns INVALID_ARGUMENT if product_category is missing or invalid. .. code-block:: python @@ -1499,7 +1496,8 @@ def sample_create_product(): the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 - characters long. It cannot contain the character ``/``. + characters long. It cannot contain the character + ``/``. This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this @@ -1581,7 +1579,7 @@ def list_products( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. .. code-block:: python @@ -1633,7 +1631,7 @@ def sample_list_products(): Returns: google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductsPager: - Response message for the ListProducts method. + Response message for the ``ListProducts`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1709,7 +1707,7 @@ def get_product( Possible errors: - - Returns NOT_FOUND if the Product does not exist. + * Returns NOT_FOUND if the Product does not exist. .. code-block:: python @@ -1743,8 +1741,7 @@ def sample_get_product(): name (str): Required. Resource name of the Product to get. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -1827,13 +1824,16 @@ def update_product( Possible errors: - - Returns NOT_FOUND if the Product does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the Product does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from the request or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is present in + + * Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is present in + + * Returns INVALID_ARGUMENT if product_category is present in update_mask. .. code-block:: python @@ -1873,11 +1873,10 @@ def sample_update_product(): on the ``request`` instance; if ``request`` is provided, this should not be set. update_mask (google.protobuf.field_mask_pb2.FieldMask): - The [FieldMask][google.protobuf.FieldMask] that - specifies which fields to update. If update_mask isn't - specified, all mutable fields are to be updated. Valid - mask paths include ``product_labels``, ``display_name``, - and ``description``. + The `FieldMask `__ that specifies which fields to update. + If update_mask isn't specified, all mutable fields are + to be updated. Valid mask paths include ``product_labels``, + ``display_name``, and ``description``. This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this @@ -1963,7 +1962,7 @@ def delete_product( Possible errors: - - Returns NOT_FOUND if the product does not exist. + * Returns NOT_FOUND if the product does not exist. .. code-block:: python @@ -1994,8 +1993,7 @@ def sample_delete_product(): name (str): Required. Resource name of product to delete. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2066,25 +2064,27 @@ def create_reference_image( ) -> product_search_service.ReferenceImage: r"""Creates and returns a new ReferenceImage resource. - The ``bounding_poly`` field is optional. If ``bounding_poly`` is - not specified, the system will try to detect regions of interest - in the image that are compatible with the product_category on - the parent product. If it is specified, detection is ALWAYS - skipped. The system converts polygons into non-rotated - rectangles. + The ``bounding_poly`` field is optional. If ``bounding_poly`` is not + specified, the system will try to detect regions of interest in + the image that are compatible with the product_category on the + parent product. If it is specified, detection is ALWAYS skipped. + The system converts polygons into non-rotated rectangles. Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP). Possible errors: - - Returns INVALID_ARGUMENT if the image_uri is missing or longer + * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if the product does not exist. - - Returns INVALID_ARGUMENT if bounding_poly is not provided, and + + * Returns INVALID_ARGUMENT if the product does not exist. + + * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with the parent product's product_category is detected. - - Returns INVALID_ARGUMENT if bounding_poly contains more than + + * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. .. code-block:: python @@ -2124,8 +2124,7 @@ def sample_create_reference_image(): Required. Resource name of the product in which to create the reference image. - Format is - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this @@ -2143,7 +2142,8 @@ def sample_create_reference_image(): added. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 - characters long. It cannot contain the character ``/``. + characters long. It cannot contain the character + ``/``. This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this @@ -2158,8 +2158,8 @@ def sample_create_reference_image(): Returns: google.cloud.vision_v1p3beta1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -2234,7 +2234,7 @@ def delete_reference_image( Possible errors: - - Returns NOT_FOUND if the reference image does not exist. + * Returns NOT_FOUND if the reference image does not exist. .. code-block:: python @@ -2339,8 +2339,9 @@ def list_reference_images( Possible errors: - - Returns NOT_FOUND if the parent product does not exist. - - Returns INVALID_ARGUMENT if the page_size is greater than 100, + * Returns NOT_FOUND if the parent product does not exist. + + * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1. .. code-block:: python @@ -2377,8 +2378,7 @@ def sample_list_reference_images(): Required. Resource name of the product containing the reference images. - Format is - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this @@ -2393,7 +2393,7 @@ def sample_list_reference_images(): Returns: google.cloud.vision_v1p3beta1.services.product_search.pagers.ListReferenceImagesPager: - Response message for the ListReferenceImages method. + Response message for the ``ListReferenceImages`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -2471,7 +2471,7 @@ def get_reference_image( Possible errors: - - Returns NOT_FOUND if the specified image does not exist. + * Returns NOT_FOUND if the specified image does not exist. .. code-block:: python @@ -2523,8 +2523,8 @@ def sample_get_reference_image(): Returns: google.cloud.vision_v1p3beta1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -2592,7 +2592,7 @@ def add_product_to_product_set( Possible errors: - - Returns NOT_FOUND if the Product or the ProductSet doesn't + * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. .. code-block:: python @@ -2621,14 +2621,12 @@ def sample_add_product_to_product_set(): Args: request (Union[google.cloud.vision_v1p3beta1.types.AddProductToProductSetRequest, dict]): - The request object. Request message for the ``AddProductToProductSet`` - method. + The request object. Request message for the ``AddProductToProductSet`` method. name (str): Required. The resource name for the ProductSet to modify. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2637,8 +2635,7 @@ def sample_add_product_to_product_set(): Required. The resource name for the Product to be added to this ProductSet. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this @@ -2716,7 +2713,7 @@ def remove_product_from_product_set( Possible errors: - - Returns NOT_FOUND If the Product is not found under the + * Returns NOT_FOUND If the Product is not found under the ProductSet. .. code-block:: python @@ -2745,14 +2742,12 @@ def sample_remove_product_from_product_set(): Args: request (Union[google.cloud.vision_v1p3beta1.types.RemoveProductFromProductSetRequest, dict]): - The request object. Request message for the ``RemoveProductFromProductSet`` - method. + The request object. Request message for the ``RemoveProductFromProductSet`` method. name (str): Required. The resource name for the ProductSet to modify. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2761,8 +2756,7 @@ def sample_remove_product_from_product_set(): Required. The resource name for the Product to be removed from this ProductSet. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this @@ -2841,7 +2835,7 @@ def list_products_in_product_set( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. .. code-block:: python @@ -2873,14 +2867,12 @@ def sample_list_products_in_product_set(): Args: request (Union[google.cloud.vision_v1p3beta1.types.ListProductsInProductSetRequest, dict]): - The request object. Request message for the ``ListProductsInProductSet`` - method. + The request object. Request message for the ``ListProductsInProductSet`` method. name (str): Required. The ProductSet resource for which to retrieve Products. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2895,8 +2887,7 @@ def sample_list_products_in_product_set(): Returns: google.cloud.vision_v1p3beta1.services.product_search.pagers.ListProductsInProductSetPager: - Response message for the ListProductsInProductSet - method. + Response message for the ``ListProductsInProductSet`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -2980,15 +2971,14 @@ def import_product_sets( r"""Asynchronous API that imports a list of reference images to specified product sets based on a list of image information. - The [google.longrunning.Operation][google.longrunning.Operation] - API can be used to keep track of the progress and results of the - request. ``Operation.metadata`` contains - ``BatchOperationMetadata``. (progress) ``Operation.response`` - contains ``ImportProductSetsResponse``. (results) + The `google.longrunning.Operation `__ API can be used to keep track of the progress + and results of the request. ``Operation.metadata`` contains + ``BatchOperationMetadata``. (progress) ``Operation.response`` contains ``ImportProductSetsResponse``. + (results) The input source of this method is a csv file on Google Cloud Storage. For the format of the csv file please see - [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource.csv_file_uri]. + `ImportProductSetsGcsSource.csv_file_uri `__. .. code-block:: python @@ -3052,14 +3042,11 @@ def sample_import_product_sets(): An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1p3beta1.types.ImportProductSetsResponse` - Response message for the ImportProductSets method. - - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + :class:`google.cloud.vision_v1p3beta1.types.ImportProductSetsResponse`` Response message for the ``ImportProductSets` + method. + + This message is returned by the `google.longrunning.Operations.GetOperation `__ method in + the returned `google.longrunning.Operation.response `__ field. """ # Create or coerce a protobuf request object. diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/transports/base.py b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/transports/base.py index dbc3b9149b32..0d52ea37512f 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/transports/base.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/transports/base.py @@ -87,8 +87,6 @@ def __init__( be used for service account credentials. """ - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} - # Save the scopes. self._scopes = scopes if not hasattr(self, "_ignore_credentials"): @@ -103,11 +101,16 @@ def __init__( if credentials_file is not None: credentials, _ = google.auth.load_credentials_from_file( - credentials_file, **scopes_kwargs, quota_project_id=quota_project_id + credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + default_scopes=self.AUTH_SCOPES, ) elif credentials is None and not self._ignore_credentials: credentials, _ = google.auth.default( - **scopes_kwargs, quota_project_id=quota_project_id + scopes=scopes, + quota_project_id=quota_project_id, + default_scopes=self.AUTH_SCOPES, ) # Don't apply audience if the credentials file passed from user. if hasattr(credentials, "with_gdch_audience"): diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/transports/grpc.py b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/transports/grpc.py index 4ddca650fe7e..12a294d5fc63 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/transports/grpc.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/transports/grpc.py @@ -115,22 +115,18 @@ class ProductSearchGrpcTransport(ProductSearchTransport): Manages Products and ProductSets of reference images for use in product search. It uses the following resource model: - - The API has a collection of - [ProductSet][google.cloud.vision.v1p3beta1.ProductSet] resources, - named ``projects/*/locations/*/productSets/*``, which acts as a - way to put different products into groups to limit identification. + - The API has a collection of `ProductSet `__ resources, named + + ``projects/*/locations/*/productSets/*``, which acts as a way to put different products into + groups to limit identification. In parallel, - - The API has a collection of - [Product][google.cloud.vision.v1p3beta1.Product] resources, named + - The API has a collection of `Product `__ resources, named ``projects/*/locations/*/products/*`` - - Each [Product][google.cloud.vision.v1p3beta1.Product] has a - collection of - [ReferenceImage][google.cloud.vision.v1p3beta1.ReferenceImage] - resources, named - ``projects/*/locations/*/products/*/referenceImages/*`` + - Each `Product `__ has a collection of `ReferenceImage `__ resources, + named ``projects/*/locations/*/products/*/referenceImages/*`` This class defines the same methods as the primary client, so the primary client can load the underlying transport implementation @@ -371,7 +367,7 @@ def create_product_set( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing, or is + * Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters. Returns: @@ -405,7 +401,7 @@ def list_product_sets( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100, or + * Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1. Returns: @@ -438,7 +434,7 @@ def get_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. + * Returns NOT_FOUND if the ProductSet does not exist. Returns: Callable[[~.GetProductSetRequest], @@ -472,8 +468,9 @@ def update_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the ProductSet does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but missing from the request or longer than 4096 characters. @@ -509,7 +506,7 @@ def delete_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. + * Returns NOT_FOUND if the ProductSet does not exist. Returns: Callable[[~.DeleteProductSetRequest], @@ -541,11 +538,13 @@ def create_product( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing or longer + * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is longer than 4096 + + * Returns INVALID_ARGUMENT if description is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is missing or + + * Returns INVALID_ARGUMENT if product_category is missing or invalid. Returns: @@ -579,7 +578,7 @@ def list_products( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. Returns: @@ -612,7 +611,7 @@ def get_product( Possible errors: - - Returns NOT_FOUND if the Product does not exist. + * Returns NOT_FOUND if the Product does not exist. Returns: Callable[[~.GetProductRequest], @@ -648,13 +647,16 @@ def update_product( Possible errors: - - Returns NOT_FOUND if the Product does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the Product does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from the request or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is present in + + * Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is present in + + * Returns INVALID_ARGUMENT if product_category is present in update_mask. Returns: @@ -689,7 +691,7 @@ def delete_product( Possible errors: - - Returns NOT_FOUND if the product does not exist. + * Returns NOT_FOUND if the product does not exist. Returns: Callable[[~.DeleteProductRequest], @@ -720,25 +722,27 @@ def create_reference_image( Creates and returns a new ReferenceImage resource. - The ``bounding_poly`` field is optional. If ``bounding_poly`` is - not specified, the system will try to detect regions of interest - in the image that are compatible with the product_category on - the parent product. If it is specified, detection is ALWAYS - skipped. The system converts polygons into non-rotated - rectangles. + The ``bounding_poly`` field is optional. If ``bounding_poly`` is not + specified, the system will try to detect regions of interest in + the image that are compatible with the product_category on the + parent product. If it is specified, detection is ALWAYS skipped. + The system converts polygons into non-rotated rectangles. Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP). Possible errors: - - Returns INVALID_ARGUMENT if the image_uri is missing or longer + * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if the product does not exist. - - Returns INVALID_ARGUMENT if bounding_poly is not provided, and + + * Returns INVALID_ARGUMENT if the product does not exist. + + * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with the parent product's product_category is detected. - - Returns INVALID_ARGUMENT if bounding_poly contains more than + + * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. Returns: @@ -778,7 +782,7 @@ def delete_reference_image( Possible errors: - - Returns NOT_FOUND if the reference image does not exist. + * Returns NOT_FOUND if the reference image does not exist. Returns: Callable[[~.DeleteReferenceImageRequest], @@ -811,8 +815,9 @@ def list_reference_images( Possible errors: - - Returns NOT_FOUND if the parent product does not exist. - - Returns INVALID_ARGUMENT if the page_size is greater than 100, + * Returns NOT_FOUND if the parent product does not exist. + + * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1. Returns: @@ -846,7 +851,7 @@ def get_reference_image( Possible errors: - - Returns NOT_FOUND if the specified image does not exist. + * Returns NOT_FOUND if the specified image does not exist. Returns: Callable[[~.GetReferenceImageRequest], @@ -881,7 +886,7 @@ def add_product_to_product_set( Possible errors: - - Returns NOT_FOUND if the Product or the ProductSet doesn't + * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. Returns: @@ -917,7 +922,7 @@ def remove_product_from_product_set( Possible errors: - - Returns NOT_FOUND If the Product is not found under the + * Returns NOT_FOUND If the Product is not found under the ProductSet. Returns: @@ -955,7 +960,7 @@ def list_products_in_product_set( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. Returns: @@ -989,15 +994,14 @@ def import_product_sets( Asynchronous API that imports a list of reference images to specified product sets based on a list of image information. - The [google.longrunning.Operation][google.longrunning.Operation] - API can be used to keep track of the progress and results of the - request. ``Operation.metadata`` contains - ``BatchOperationMetadata``. (progress) ``Operation.response`` - contains ``ImportProductSetsResponse``. (results) + The `google.longrunning.Operation `__ API can be used to keep track of the progress + and results of the request. ``Operation.metadata`` contains + ``BatchOperationMetadata``. (progress) ``Operation.response`` contains ``ImportProductSetsResponse``. + (results) The input source of this method is a csv file on Google Cloud Storage. For the format of the csv file please see - [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource.csv_file_uri]. + `ImportProductSetsGcsSource.csv_file_uri `__. Returns: Callable[[~.ImportProductSetsRequest], diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/transports/grpc_asyncio.py b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/transports/grpc_asyncio.py index cc26271ea70d..94bd5be87e8b 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/transports/grpc_asyncio.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/transports/grpc_asyncio.py @@ -121,22 +121,18 @@ class ProductSearchGrpcAsyncIOTransport(ProductSearchTransport): Manages Products and ProductSets of reference images for use in product search. It uses the following resource model: - - The API has a collection of - [ProductSet][google.cloud.vision.v1p3beta1.ProductSet] resources, - named ``projects/*/locations/*/productSets/*``, which acts as a - way to put different products into groups to limit identification. + - The API has a collection of `ProductSet `__ resources, named + + ``projects/*/locations/*/productSets/*``, which acts as a way to put different products into + groups to limit identification. In parallel, - - The API has a collection of - [Product][google.cloud.vision.v1p3beta1.Product] resources, named + - The API has a collection of `Product `__ resources, named ``projects/*/locations/*/products/*`` - - Each [Product][google.cloud.vision.v1p3beta1.Product] has a - collection of - [ReferenceImage][google.cloud.vision.v1p3beta1.ReferenceImage] - resources, named - ``projects/*/locations/*/products/*/referenceImages/*`` + - Each `Product `__ has a collection of `ReferenceImage `__ resources, + named ``projects/*/locations/*/products/*/referenceImages/*`` This class defines the same methods as the primary client, so the primary client can load the underlying transport implementation @@ -379,7 +375,7 @@ def create_product_set( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing, or is + * Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters. Returns: @@ -413,7 +409,7 @@ def list_product_sets( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100, or + * Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1. Returns: @@ -447,7 +443,7 @@ def get_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. + * Returns NOT_FOUND if the ProductSet does not exist. Returns: Callable[[~.GetProductSetRequest], @@ -481,8 +477,9 @@ def update_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the ProductSet does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but missing from the request or longer than 4096 characters. @@ -520,7 +517,7 @@ def delete_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. + * Returns NOT_FOUND if the ProductSet does not exist. Returns: Callable[[~.DeleteProductSetRequest], @@ -553,11 +550,13 @@ def create_product( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing or longer + * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is longer than 4096 + + * Returns INVALID_ARGUMENT if description is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is missing or + + * Returns INVALID_ARGUMENT if product_category is missing or invalid. Returns: @@ -591,7 +590,7 @@ def list_products( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. Returns: @@ -625,7 +624,7 @@ def get_product( Possible errors: - - Returns NOT_FOUND if the Product does not exist. + * Returns NOT_FOUND if the Product does not exist. Returns: Callable[[~.GetProductRequest], @@ -662,13 +661,16 @@ def update_product( Possible errors: - - Returns NOT_FOUND if the Product does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the Product does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from the request or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is present in + + * Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is present in + + * Returns INVALID_ARGUMENT if product_category is present in update_mask. Returns: @@ -705,7 +707,7 @@ def delete_product( Possible errors: - - Returns NOT_FOUND if the product does not exist. + * Returns NOT_FOUND if the product does not exist. Returns: Callable[[~.DeleteProductRequest], @@ -736,25 +738,27 @@ def create_reference_image( Creates and returns a new ReferenceImage resource. - The ``bounding_poly`` field is optional. If ``bounding_poly`` is - not specified, the system will try to detect regions of interest - in the image that are compatible with the product_category on - the parent product. If it is specified, detection is ALWAYS - skipped. The system converts polygons into non-rotated - rectangles. + The ``bounding_poly`` field is optional. If ``bounding_poly`` is not + specified, the system will try to detect regions of interest in + the image that are compatible with the product_category on the + parent product. If it is specified, detection is ALWAYS skipped. + The system converts polygons into non-rotated rectangles. Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP). Possible errors: - - Returns INVALID_ARGUMENT if the image_uri is missing or longer + * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if the product does not exist. - - Returns INVALID_ARGUMENT if bounding_poly is not provided, and + + * Returns INVALID_ARGUMENT if the product does not exist. + + * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with the parent product's product_category is detected. - - Returns INVALID_ARGUMENT if bounding_poly contains more than + + * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. Returns: @@ -794,7 +798,7 @@ def delete_reference_image( Possible errors: - - Returns NOT_FOUND if the reference image does not exist. + * Returns NOT_FOUND if the reference image does not exist. Returns: Callable[[~.DeleteReferenceImageRequest], @@ -827,8 +831,9 @@ def list_reference_images( Possible errors: - - Returns NOT_FOUND if the parent product does not exist. - - Returns INVALID_ARGUMENT if the page_size is greater than 100, + * Returns NOT_FOUND if the parent product does not exist. + + * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1. Returns: @@ -862,7 +867,7 @@ def get_reference_image( Possible errors: - - Returns NOT_FOUND if the specified image does not exist. + * Returns NOT_FOUND if the specified image does not exist. Returns: Callable[[~.GetReferenceImageRequest], @@ -898,7 +903,7 @@ def add_product_to_product_set( Possible errors: - - Returns NOT_FOUND if the Product or the ProductSet doesn't + * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. Returns: @@ -935,7 +940,7 @@ def remove_product_from_product_set( Possible errors: - - Returns NOT_FOUND If the Product is not found under the + * Returns NOT_FOUND If the Product is not found under the ProductSet. Returns: @@ -973,7 +978,7 @@ def list_products_in_product_set( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. Returns: @@ -1008,15 +1013,14 @@ def import_product_sets( Asynchronous API that imports a list of reference images to specified product sets based on a list of image information. - The [google.longrunning.Operation][google.longrunning.Operation] - API can be used to keep track of the progress and results of the - request. ``Operation.metadata`` contains - ``BatchOperationMetadata``. (progress) ``Operation.response`` - contains ``ImportProductSetsResponse``. (results) + The `google.longrunning.Operation `__ API can be used to keep track of the progress + and results of the request. ``Operation.metadata`` contains + ``BatchOperationMetadata``. (progress) ``Operation.response`` contains ``ImportProductSetsResponse``. + (results) The input source of this method is a csv file on Google Cloud Storage. For the format of the csv file please see - [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p3beta1.ImportProductSetsGcsSource.csv_file_uri]. + `ImportProductSetsGcsSource.csv_file_uri `__. Returns: Callable[[~.ImportProductSetsRequest], diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/transports/rest.py b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/transports/rest.py index 157314187d5e..4154063e864c 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/transports/rest.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/services/product_search/transports/rest.py @@ -952,22 +952,18 @@ class ProductSearchRestTransport(_BaseProductSearchRestTransport): Manages Products and ProductSets of reference images for use in product search. It uses the following resource model: - - The API has a collection of - [ProductSet][google.cloud.vision.v1p3beta1.ProductSet] resources, - named ``projects/*/locations/*/productSets/*``, which acts as a - way to put different products into groups to limit identification. + - The API has a collection of `ProductSet `__ resources, named + + ``projects/*/locations/*/productSets/*``, which acts as a way to put different products into + groups to limit identification. In parallel, - - The API has a collection of - [Product][google.cloud.vision.v1p3beta1.Product] resources, named + - The API has a collection of `Product `__ resources, named ``projects/*/locations/*/products/*`` - - Each [Product][google.cloud.vision.v1p3beta1.Product] has a - collection of - [ReferenceImage][google.cloud.vision.v1p3beta1.ReferenceImage] - resources, named - ``projects/*/locations/*/products/*/referenceImages/*`` + - Each `Product `__ has a collection of `ReferenceImage `__ resources, + named ``projects/*/locations/*/products/*/referenceImages/*`` This class defines the same methods as the primary client, so the primary client can load the underlying transport implementation @@ -1115,8 +1111,7 @@ def __call__( Args: request (~.product_search_service.AddProductToProductSetRequest): - The request object. Request message for the ``AddProductToProductSet`` - method. + The request object. Request message for the ``AddProductToProductSet`` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2914,8 +2909,7 @@ def __call__( Args: request (~.product_search_service.ListProductsInProductSetRequest): - The request object. Request message for the ``ListProductsInProductSet`` - method. + The request object. Request message for the ``ListProductsInProductSet`` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2926,9 +2920,7 @@ def __call__( Returns: ~.product_search_service.ListProductsInProductSetResponse: - Response message for the ``ListProductsInProductSet`` - method. - + Response message for the ``ListProductsInProductSet`` method. """ http_options = ( @@ -3222,8 +3214,7 @@ def __call__( Args: request (~.product_search_service.RemoveProductFromProductSetRequest): - The request object. Request message for the ``RemoveProductFromProductSet`` - method. + The request object. Request message for the ``RemoveProductFromProductSet`` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/types/image_annotator.py b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/types/image_annotator.py index d9726c6461f3..b0341e4c042a 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/types/image_annotator.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/types/image_annotator.py @@ -113,14 +113,13 @@ class Feature(proto.Message): The feature type. max_results (int): Maximum number of results of this type. Does not apply to - ``TEXT_DETECTION``, ``DOCUMENT_TEXT_DETECTION``, or - ``CROP_HINTS``. + ``TEXT_DETECTION``, ``DOCUMENT_TEXT_DETECTION``, or ``CROP_HINTS``. model (str): Model to use for the feature. Supported values: "builtin/stable" (the default if unset) and - "builtin/latest". ``DOCUMENT_TEXT_DETECTION`` and - ``TEXT_DETECTION`` also support "builtin/weekly" for the - bleeding edge release updated weekly. + "builtin/latest". ``DOCUMENT_TEXT_DETECTION`` and ``TEXT_DETECTION`` also + support "builtin/weekly" for the bleeding edge release + updated weekly. """ class Type(proto.Enum): @@ -140,12 +139,11 @@ class Type(proto.Enum): TEXT_DETECTION (5): Run text detection / optical character recognition (OCR). Text detection is optimized for areas of text within a - larger image; if the image is a document, use - ``DOCUMENT_TEXT_DETECTION`` instead. + larger image; if the image is a document, use ``DOCUMENT_TEXT_DETECTION`` + instead. DOCUMENT_TEXT_DETECTION (11): Run dense text document OCR. Takes precedence when both - ``DOCUMENT_TEXT_DETECTION`` and ``TEXT_DETECTION`` are - present. + ``DOCUMENT_TEXT_DETECTION`` and ``TEXT_DETECTION`` are present. SAFE_SEARCH_DETECTION (6): Run Safe Search to detect potentially unsafe or undesirable content. @@ -198,28 +196,29 @@ class ImageSource(proto.Message): gcs_image_uri (str): **Use ``image_uri`` instead.** - The Google Cloud Storage URI of the form - ``gs://bucket_name/object_name``. Object versioning is not - supported. See `Google Cloud Storage Request - URIs `__ - for more info. + The Google Cloud Storage URI of the form ``gs://bucket_name/object_name``. + Object versioning is not supported. See `Google Cloud Storage Request URIs `__ for + more info. image_uri (str): The URI of the source image. Can be either: 1. A Google Cloud Storage URI of the form - ``gs://bucket_name/object_name``. Object versioning is - not supported. See `Google Cloud Storage Request - URIs `__ - for more info. + + 1. A Google Cloud Storage URI of the form + ``gs://bucket_name/object_name``. Object versioning is not supported. See + `Google Cloud Storage Request + URIs `__ for more + info. 2. A publicly-accessible image HTTP/HTTPS URL. When fetching - images from HTTP/HTTPS URLs, Google cannot guarantee that - the request will be completed. Your request may fail if - the specified host denies the request (e.g. due to - request throttling or DOS prevention), or if Google - throttles requests to the site for abuse prevention. You - should not depend on externally-hosted images for - production applications. + images from + + 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from + HTTP/HTTPS URLs, Google cannot guarantee that the request will be + completed. Your request may fail if the specified host denies the + request (e.g. due to request throttling or DOS prevention), or if Google + throttles requests to the site for abuse prevention. You should not + depend on externally-hosted images for production applications. When both ``gcs_image_uri`` and ``image_uri`` are specified, ``image_uri`` takes precedence. @@ -241,13 +240,14 @@ class Image(proto.Message): Attributes: content (bytes): Image content, represented as a stream of bytes. Note: As - with all ``bytes`` fields, protobuffers use a pure binary - representation, whereas JSON representations use base64. + with all ``bytes`` fields, protobuffers use a pure + binary representation, whereas JSON representations use + base64. source (google.cloud.vision_v1p3beta1.types.ImageSource): Google Cloud Storage image location, or publicly-accessible - image URL. If both ``content`` and ``source`` are provided - for an image, ``content`` takes precedence and is used to - perform the image annotation request. + image URL. If both ``content`` and ``source`` are + provided for an image, ``content`` takes precedence and is + used to perform the image annotation request. """ content: bytes = proto.Field( @@ -272,17 +272,17 @@ class FaceAnnotation(proto.Message): in ``ImageParams``. The bounding box is computed to "frame" the face in accordance with human expectations. It is based on the landmarker results. Note that one or more x and/or y - coordinates may not be generated in the ``BoundingPoly`` - (the polygon will be unbounded) if only a partial face - appears in the image to be annotated. + coordinates may not be generated in the ``BoundingPoly`` (the + polygon will be unbounded) if only a partial face appears in + the image to be annotated. fd_bounding_poly (google.cloud.vision_v1p3beta1.types.BoundingPoly): - The ``fd_bounding_poly`` bounding polygon is tighter than - the ``boundingPoly``, and encloses only the skin part of the - face. Typically, it is used to eliminate the face from any - image analysis that detects the "amount of skin" visible in - an image. It is not based on the landmarker results, only on - the initial face detection, hence the fd (face detection) - prefix. + The ``fd_bounding_poly`` bounding polygon is tighter than the + ``boundingPoly``, and encloses only the skin part of the face. + Typically, it is used to eliminate the face from any image + analysis that detects the "amount of skin" visible in an + image. It is not based on the landmarker results, only on + the initial face detection, hence the fd (face + detection) prefix. landmarks (MutableSequence[google.cloud.vision_v1p3beta1.types.FaceAnnotation.Landmark]): Detected face landmarks. roll_angle (float): @@ -572,9 +572,8 @@ class EntityAnnotation(proto.Message): Attributes: mid (str): - Opaque entity ID. Some IDs may be available in `Google - Knowledge Graph Search - API `__. + Opaque entity ID. Some IDs may be available in + `Google Knowledge Graph Search API `__. locale (str): The language code for the locale in which the entity textual ``description`` is expressed. @@ -584,9 +583,9 @@ class EntityAnnotation(proto.Message): score (float): Overall score of the result. Range [0, 1]. confidence (float): - **Deprecated. Use ``score`` instead.** The accuracy of the - entity detection in an image. For example, for an image in - which the "Eiffel Tower" entity is detected, this field + **Deprecated. Use ``score`` instead.** The accuracy of + the entity detection in an image. For example, for an image + in which the "Eiffel Tower" entity is detected, this field represents the confidence that there is a tower in the query image. Range [0, 1]. topicality (float): @@ -601,11 +600,11 @@ class EntityAnnotation(proto.Message): ``LABEL_DETECTION`` features. locations (MutableSequence[google.cloud.vision_v1p3beta1.types.LocationInfo]): The location information for the detected entity. Multiple - ``LocationInfo`` elements can be present because one - location may indicate the location of the scene in the - image, and another location may indicate the location of the - place where the image was taken. Location information is - usually present for landmarks. + ``LocationInfo`` elements can be present because one location + may indicate the location of the scene in the image, and + another location may indicate the location of the place + where the image was taken. Location information is usually + present for landmarks. properties (MutableSequence[google.cloud.vision_v1p3beta1.types.Property]): Some entities may have optional user-supplied ``Property`` (name/value) fields, such a score or string that qualifies @@ -845,7 +844,7 @@ class CropHint(proto.Message): the bounding box are in the original image's scale, as returned in ``ImageParams``. confidence (float): - Confidence of this being a salient region. Range [0, 1]. + Confidence of this being a salient region. Range [0, 1]. importance_fraction (float): Fraction of importance of this salient region with respect to the original image. @@ -952,13 +951,12 @@ class ImageContext(proto.Message): List of languages to use for TEXT_DETECTION. In most cases, an empty value yields the best results since it enables automatic language detection. For languages based on the - Latin alphabet, setting ``language_hints`` is not needed. In - rare cases, when the language of the text in the image is - known, setting a hint will help get better results (although - it will be a significant hindrance if the hint is wrong). - Text detection returns an error if one or more of the - specified languages is not one of the `supported - languages `__. + Latin alphabet, setting ``language_hints`` is not needed. In rare + cases, when the language of the text in the image is known, + setting a hint will help get better results (although it + will be a significant hindrance if the hint is wrong). Text + detection returns an error if one or more of the specified + languages is not one of the `supported languages `__. crop_hints_params (google.cloud.vision_v1p3beta1.types.CropHintsParams): Parameters for crop hints annotation request. product_search_params (google.cloud.vision_v1p3beta1.types.ProductSearchParams): @@ -1366,9 +1364,9 @@ class OutputConfig(proto.Message): 100]. If not specified, the default value is 20. For example, for one pdf file with 100 pages, 100 response - protos will be generated. If ``batch_size`` = 20, then 5 - json files each containing 20 response protos will be - written under the prefix ``gcs_destination``.\ ``uri``. + protos will be generated. If ``batch_size`` = 20, then 5 json + files each containing 20 response protos will be written + under the prefix ``gcs_destination``.``uri``. Currently, batch_size only applies to GcsDestination, with potential future support for other output configurations. @@ -1416,9 +1414,11 @@ class GcsDestination(proto.Message): Examples: - - File: gs://bucket-name/filename.json - - Prefix: gs://bucket-name/prefix/here/ - - File: gs://bucket-name/prefix/here + * File: gs://bucket-name/filename.json + + * Prefix: gs://bucket-name/prefix/here/ + + * File: gs://bucket-name/prefix/here If multiple outputs, each response is still AnnotateFileResponse, each of which contains some subset of diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/types/product_search.py b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/types/product_search.py index 4cd22fcf75e0..f260c79d8ade 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/types/product_search.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/types/product_search.py @@ -40,12 +40,10 @@ class ProductSearchParams(proto.Message): interest in the image. If it is not specified, system discretion will be applied. product_set (str): - The resource name of a - [ProductSet][google.cloud.vision.v1p3beta1.ProductSet] to be - searched for similar images. + The resource name of a `ProductSet `__ to be searched for + similar images. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID``. + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID``. product_categories (MutableSequence[str]): The list of product categories to search in. Currently, we only consider the first category, diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/types/product_search_service.py b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/types/product_search_service.py index b082ad202abf..3982fa338548 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/types/product_search_service.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/types/product_search_service.py @@ -67,8 +67,7 @@ class Product(proto.Message): name (str): The resource name of the product. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. This field is ignored when creating a product. display_name (str): @@ -152,8 +151,7 @@ class ProductSet(proto.Message): name (str): The resource name of the ProductSet. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID``. + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID``. This field is ignored when creating a ProductSet. display_name (str): @@ -199,8 +197,8 @@ class ProductSet(proto.Message): class ReferenceImage(proto.Message): - r"""A ``ReferenceImage`` represents a product image and its associated - metadata, such as bounding boxes. + r"""A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. Attributes: name (str): @@ -257,11 +255,12 @@ class CreateProductRequest(proto.Message): product (google.cloud.vision_v1p3beta1.types.Product): Required. The product to create. product_id (str): - A user-supplied resource id for this Product. If set, the - server will attempt to use this value as the resource id. If - it is already in use, an error is returned with code - ALREADY_EXISTS. Must be at most 128 characters long. It - cannot contain the character ``/``. + A user-supplied resource id for this Product. If set, + the server will attempt to use this value as the + resource id. If it is already in use, an error is + returned with code ALREADY_EXISTS. Must be at most 128 + characters long. It cannot contain the character + ``/``. """ parent: str = proto.Field( @@ -344,8 +343,7 @@ class GetProductRequest(proto.Message): name (str): Required. Resource name of the Product to get. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ name: str = proto.Field( @@ -363,10 +361,10 @@ class UpdateProductRequest(proto.Message): the one on the server. product.name is immutable. update_mask (google.protobuf.field_mask_pb2.FieldMask): - The [FieldMask][google.protobuf.FieldMask] that specifies - which fields to update. If update_mask isn't specified, all - mutable fields are to be updated. Valid mask paths include - ``product_labels``, ``display_name``, and ``description``. + The `FieldMask `__ that specifies which fields to update. + If update_mask isn't specified, all mutable fields are + to be updated. Valid mask paths include ``product_labels``, + ``display_name``, and ``description``. """ product: "Product" = proto.Field( @@ -388,8 +386,7 @@ class DeleteProductRequest(proto.Message): name (str): Required. Resource name of product to delete. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ name: str = proto.Field( @@ -410,11 +407,12 @@ class CreateProductSetRequest(proto.Message): product_set (google.cloud.vision_v1p3beta1.types.ProductSet): Required. The ProductSet to create. product_set_id (str): - A user-supplied resource id for this ProductSet. If set, the - server will attempt to use this value as the resource id. If - it is already in use, an error is returned with code - ALREADY_EXISTS. Must be at most 128 characters long. It - cannot contain the character ``/``. + A user-supplied resource id for this ProductSet. If set, + the server will attempt to use this value as the + resource id. If it is already in use, an error is + returned with code ALREADY_EXISTS. Must be at most 128 + characters long. It cannot contain the character + ``/``. """ parent: str = proto.Field( @@ -497,8 +495,7 @@ class GetProductSetRequest(proto.Message): name (str): Required. Resource name of the ProductSet to get. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` """ name: str = proto.Field( @@ -515,10 +512,9 @@ class UpdateProductSetRequest(proto.Message): Required. The ProductSet resource which replaces the one on the server. update_mask (google.protobuf.field_mask_pb2.FieldMask): - The [FieldMask][google.protobuf.FieldMask] that specifies - which fields to update. If update_mask isn't specified, all - mutable fields are to be updated. Valid mask path is - ``display_name``. + The `FieldMask `__ that specifies which fields to update. + If update_mask isn't specified, all mutable fields are + to be updated. Valid mask path is ``display_name``. """ product_set: "ProductSet" = proto.Field( @@ -540,8 +536,7 @@ class DeleteProductSetRequest(proto.Message): name (str): Required. Resource name of the ProductSet to delete. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` """ name: str = proto.Field( @@ -555,20 +550,20 @@ class CreateReferenceImageRequest(proto.Message): Attributes: parent (str): - Required. Resource name of the product in which to create - the reference image. + Required. Resource name of the product in which to + create the reference image. - Format is - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. reference_image (google.cloud.vision_v1p3beta1.types.ReferenceImage): Required. The reference image to create. If an image ID is specified, it is ignored. reference_image_id (str): A user-supplied resource id for the ReferenceImage to be - added. If set, the server will attempt to use this value as - the resource id. If it is already in use, an error is + added. If set, the server will attempt to use this value + as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 - characters long. It cannot contain the character ``/``. + characters long. It cannot contain the character + ``/``. """ parent: str = proto.Field( @@ -594,8 +589,7 @@ class ListReferenceImagesRequest(proto.Message): Required. Resource name of the product containing the reference images. - Format is - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. page_size (int): The maximum number of items to return. Default 10, maximum 100. @@ -659,7 +653,8 @@ class GetReferenceImageRequest(proto.Message): Attributes: name (str): - Required. The resource name of the ReferenceImage to get. + Required. The resource name of the ReferenceImage to + get. Format is: @@ -696,16 +691,15 @@ class AddProductToProductSetRequest(proto.Message): Attributes: name (str): - Required. The resource name for the ProductSet to modify. + Required. The resource name for the ProductSet to + modify. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` product (str): - Required. The resource name for the Product to be added to - this ProductSet. + Required. The resource name for the Product to be added + to this ProductSet. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ name: str = proto.Field( @@ -723,16 +717,15 @@ class RemoveProductFromProductSetRequest(proto.Message): Attributes: name (str): - Required. The resource name for the ProductSet to modify. + Required. The resource name for the ProductSet to + modify. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` product (str): - Required. The resource name for the Product to be removed - from this ProductSet. + Required. The resource name for the Product to be + removed from this ProductSet. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ name: str = proto.Field( @@ -753,8 +746,7 @@ class ListProductsInProductSetRequest(proto.Message): Required. The ProductSet resource for which to retrieve Products. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` page_size (int): The maximum number of items to return. Default 10, maximum 100. @@ -817,11 +809,17 @@ class ImportProductSetsGcsSource(proto.Message): The format of the input csv file should be one image per line. In each line, there are 6 columns. - 1. image_uri 2, image_id - 2. product_set_id - 3. product_id 5, product_category 6, product_display_name 7, - labels - 4. bounding_poly + 1. image_uri + + 2, image_id + + 3. product_set_id + + 4. product_id + + 5, product_category 6, product_display_name 7, labels + + 8. bounding_poly Columns 1, 3, 4, and 5 are required, other columns are optional. A new ProductSet/Product with the same id will be @@ -842,15 +840,16 @@ class ImportProductSetsGcsSource(proto.Message): ignored. If a Product doesn't exist and needs to be created on the - fly, the product_display_name field refers to - [Product.display_name][google.cloud.vision.v1p3beta1.Product.display_name], - the product_category field refers to - [Product.product_category][google.cloud.vision.v1p3beta1.Product.product_category], - and the labels field refers to [Product.labels][]. + fly, the product_display_name field refers to `Product.display_name `__, + the product_category field refers to `Product.product_category `__, and the + labels field refers to [Product.labels][]. Labels (optional) should be a line containing a list of comma-separated key-value pairs, with the format - "key_1=value_1,key_2=value_2,...,key_n=value_n". + + Labels (optional) should be a line containing a list of comma-separated + key-value pairs, with the format + "key_1=value_1,key_2=value_2,...,key_n=value_n". The bounding_poly (optional) field is used to identify one region of interest from the image in the same manner as @@ -928,11 +927,8 @@ class ImportProductSetsRequest(proto.Message): class ImportProductSetsResponse(proto.Message): r"""Response message for the ``ImportProductSets`` method. - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + This message is returned by the `google.longrunning.Operations.GetOperation `__ method in the returned + `google.longrunning.Operation.response `__ field. Attributes: reference_images (MutableSequence[google.cloud.vision_v1p3beta1.types.ReferenceImage]): @@ -963,8 +959,7 @@ class BatchOperationMetadata(proto.Message): r"""Metadata for the batch operations such as the current state. This is included in the ``metadata`` field of the ``Operation`` - returned by the ``GetOperation`` call of the - ``google::longrunning::Operations`` service. + returned by the ``GetOperation`` call of the ``google::longrunning::Operations`` service. Attributes: state (google.cloud.vision_v1p3beta1.types.BatchOperationMetadata.State): @@ -974,8 +969,7 @@ class BatchOperationMetadata(proto.Message): to the server. end_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch request is finished and - [google.longrunning.Operation.done][google.longrunning.Operation.done] - is set to true. + `google.longrunning.Operation.done `__ is set to true. """ class State(proto.Enum): diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/types/text_annotation.py b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/types/text_annotation.py index 660990572b2e..683e7556c71a 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/types/text_annotation.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/types/text_annotation.py @@ -37,12 +37,18 @@ class TextAnnotation(proto.Message): r"""TextAnnotation contains a structured representation of OCR extracted text. The hierarchy of an OCR extracted text structure is like this: + + TextAnnotation contains a structured representation of OCR extracted text. + The hierarchy of an OCR extracted text structure is like this: + TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol + + TextAnnotation contains a structured representation of OCR extracted + text. The hierarchy of an OCR extracted text structure is like this: TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol Each structural component, starting from Page, may further have their own properties. Properties describe detected languages, breaks etc.. - Please refer to the - [TextAnnotation.TextProperty][google.cloud.vision.v1p3beta1.TextAnnotation.TextProperty] - message definition below for more detail. + Please refer to the `TextAnnotation.TextProperty `__ message definition below for more + detail. Attributes: pages (MutableSequence[google.cloud.vision_v1p3beta1.types.Page]): @@ -210,24 +216,20 @@ class Block(proto.Message): is represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example: - - when the text is horizontal it might look like: + * when the text is horizontal it might look like: - :: + 0----1 + | | + 3----2 - 0----1 - | | - 3----2 - - - when it's rotated 180 degrees around the top-left corner + * when it's rotated 180 degrees around the top-left corner it becomes: - :: - - 2----3 - | | - 1----0 + 2----3 + | | + 1----0 - and the vertice order will still be (0, 1, 2, 3). + and the vertice order will still be (0, 1, 2, 3). paragraphs (MutableSequence[google.cloud.vision_v1p3beta1.types.Paragraph]): List of paragraphs in this block (if this blocks is of type text). @@ -303,11 +305,24 @@ class Paragraph(proto.Message): is represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example: - - when the text is horizontal it might look like: 0----1 \| - \| 3----2 - - when it's rotated 180 degrees around the top-left corner - it becomes: 2----3 \| \| 1----0 and the vertice order will - still be (0, 1, 2, 3). + * when the text is horizontal it might look like: + + * when the text is horizontal it might look like: + 0----1 + | | + 3----2 + + * when it's rotated 180 degrees around the top-left corner + it becomes: + + * when it's rotated 180 degrees around the top-left corner it becomes: + 2----3 + | | + 1----0 + + * when it's rotated 180 degrees around the top-left corner + it becomes: 2----3 | | 1----0 and the vertice order will + still be (0, 1, 2, 3). words (MutableSequence[google.cloud.vision_v1p3beta1.types.Word]): List of words in this paragraph. confidence (float): @@ -349,11 +364,24 @@ class Word(proto.Message): represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example: - - when the text is horizontal it might look like: 0----1 \| - \| 3----2 - - when it's rotated 180 degrees around the top-left corner - it becomes: 2----3 \| \| 1----0 and the vertice order will - still be (0, 1, 2, 3). + * when the text is horizontal it might look like: + + * when the text is horizontal it might look like: + 0----1 + | | + 3----2 + + * when it's rotated 180 degrees around the top-left corner + it becomes: + + * when it's rotated 180 degrees around the top-left corner it becomes: + 2----3 + | | + 1----0 + + * when it's rotated 180 degrees around the top-left corner + it becomes: 2----3 | | 1----0 and the vertice order will + still be (0, 1, 2, 3). symbols (MutableSequence[google.cloud.vision_v1p3beta1.types.Symbol]): List of symbols in the word. The order of the symbols follows the natural @@ -397,11 +425,24 @@ class Symbol(proto.Message): is represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example: - - when the text is horizontal it might look like: 0----1 \| - \| 3----2 - - when it's rotated 180 degrees around the top-left corner - it becomes: 2----3 \| \| 1----0 and the vertice order will - still be (0, 1, 2, 3). + * when the text is horizontal it might look like: + + * when the text is horizontal it might look like: + 0----1 + | | + 3----2 + + * when it's rotated 180 degrees around the top-left corner + it becomes: + + * when it's rotated 180 degrees around the top-left corner it becomes: + 2----3 + | | + 1----0 + + * when it's rotated 180 degrees around the top-left corner + it becomes: 2----3 | | 1----0 and the vertice order will + still be (0, 1, 2, 3). text (str): The actual UTF-8 representation of the symbol. diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/types/web_detection.py b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/types/web_detection.py index 887e53444d05..1c408f107189 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/types/web_detection.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p3beta1/types/web_detection.py @@ -157,8 +157,8 @@ class WebLabel(proto.Message): label (str): Label for extra metadata. language_code (str): - The BCP-47 language code for ``label``, such as "en-US" or - "sr-Latn". For more information, see + The BCP-47 language code for ``label``, such as "en-US" + or "sr-Latn". For more information, see http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. """ diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/image_annotator/async_client.py b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/image_annotator/async_client.py index 82d9164b0b9a..6295f6a002ef 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/image_annotator/async_client.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/image_annotator/async_client.py @@ -535,11 +535,9 @@ async def async_batch_annotate_images( r"""Run asynchronous image detection and annotation for a list of images. - Progress and results can be retrieved through the - ``google.longrunning.Operations`` interface. - ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains - ``AsyncBatchAnnotateImagesResponse`` (results). + Progress and results can be retrieved through the ``google.longrunning.Operations`` + interface. ``Operation.metadata`` contains ``OperationMetadata`` (metadata). + ``Operation.response`` contains ``AsyncBatchAnnotateImagesResponse`` (results). This service will write image annotation outputs to json files in customer GCS bucket, each json file containing @@ -678,9 +676,8 @@ async def async_batch_annotate_files( r"""Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be - retrieved through the ``google.longrunning.Operations`` - interface. ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains + retrieved through the ``google.longrunning.Operations`` interface. ``Operation.metadata`` + contains ``OperationMetadata`` (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` (results). .. code-block:: python diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/image_annotator/client.py b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/image_annotator/client.py index bd2be3894228..e9b57cae422a 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/image_annotator/client.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/image_annotator/client.py @@ -992,11 +992,9 @@ def async_batch_annotate_images( r"""Run asynchronous image detection and annotation for a list of images. - Progress and results can be retrieved through the - ``google.longrunning.Operations`` interface. - ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains - ``AsyncBatchAnnotateImagesResponse`` (results). + Progress and results can be retrieved through the ``google.longrunning.Operations`` + interface. ``Operation.metadata`` contains ``OperationMetadata`` (metadata). + ``Operation.response`` contains ``AsyncBatchAnnotateImagesResponse`` (results). This service will write image annotation outputs to json files in customer GCS bucket, each json file containing @@ -1134,9 +1132,8 @@ def async_batch_annotate_files( r"""Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be - retrieved through the ``google.longrunning.Operations`` - interface. ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains + retrieved through the ``google.longrunning.Operations`` interface. ``Operation.metadata`` + contains ``OperationMetadata`` (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` (results). .. code-block:: python diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/image_annotator/transports/base.py b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/image_annotator/transports/base.py index 3534da170b88..1d8c3375cd15 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/image_annotator/transports/base.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/image_annotator/transports/base.py @@ -86,8 +86,6 @@ def __init__( be used for service account credentials. """ - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} - # Save the scopes. self._scopes = scopes if not hasattr(self, "_ignore_credentials"): @@ -102,11 +100,16 @@ def __init__( if credentials_file is not None: credentials, _ = google.auth.load_credentials_from_file( - credentials_file, **scopes_kwargs, quota_project_id=quota_project_id + credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + default_scopes=self.AUTH_SCOPES, ) elif credentials is None and not self._ignore_credentials: credentials, _ = google.auth.default( - **scopes_kwargs, quota_project_id=quota_project_id + scopes=scopes, + quota_project_id=quota_project_id, + default_scopes=self.AUTH_SCOPES, ) # Don't apply audience if the credentials file passed from user. if hasattr(credentials, "with_gdch_audience"): diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/image_annotator/transports/grpc.py b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/image_annotator/transports/grpc.py index 3a4e2ca1115e..6caee99b1f70 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/image_annotator/transports/grpc.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/image_annotator/transports/grpc.py @@ -420,11 +420,9 @@ def async_batch_annotate_images( Run asynchronous image detection and annotation for a list of images. - Progress and results can be retrieved through the - ``google.longrunning.Operations`` interface. - ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains - ``AsyncBatchAnnotateImagesResponse`` (results). + Progress and results can be retrieved through the ``google.longrunning.Operations`` + interface. ``Operation.metadata`` contains ``OperationMetadata`` (metadata). + ``Operation.response`` contains ``AsyncBatchAnnotateImagesResponse`` (results). This service will write image annotation outputs to json files in customer GCS bucket, each json file containing @@ -461,9 +459,8 @@ def async_batch_annotate_files( Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be - retrieved through the ``google.longrunning.Operations`` - interface. ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains + retrieved through the ``google.longrunning.Operations`` interface. ``Operation.metadata`` + contains ``OperationMetadata`` (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` (results). Returns: diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/image_annotator/transports/grpc_asyncio.py b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/image_annotator/transports/grpc_asyncio.py index f78715e6006e..1c13d03f1ad7 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/image_annotator/transports/grpc_asyncio.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/image_annotator/transports/grpc_asyncio.py @@ -429,11 +429,9 @@ def async_batch_annotate_images( Run asynchronous image detection and annotation for a list of images. - Progress and results can be retrieved through the - ``google.longrunning.Operations`` interface. - ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains - ``AsyncBatchAnnotateImagesResponse`` (results). + Progress and results can be retrieved through the ``google.longrunning.Operations`` + interface. ``Operation.metadata`` contains ``OperationMetadata`` (metadata). + ``Operation.response`` contains ``AsyncBatchAnnotateImagesResponse`` (results). This service will write image annotation outputs to json files in customer GCS bucket, each json file containing @@ -471,9 +469,8 @@ def async_batch_annotate_files( Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be - retrieved through the ``google.longrunning.Operations`` - interface. ``Operation.metadata`` contains ``OperationMetadata`` - (metadata). ``Operation.response`` contains + retrieved through the ``google.longrunning.Operations`` interface. ``Operation.metadata`` + contains ``OperationMetadata`` (metadata). ``Operation.response`` contains ``AsyncBatchAnnotateFilesResponse`` (results). Returns: diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/async_client.py b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/async_client.py index 25cfb5dfc83e..a23c6f8c901e 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/async_client.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/async_client.py @@ -73,21 +73,19 @@ class ProductSearchAsyncClient: product search. It uses the following resource model: - The API has a collection of - [ProductSet][google.cloud.vision.v1p4beta1.ProductSet] resources, - named ``projects/*/locations/*/productSets/*``, which acts as a - way to put different products into groups to limit identification. + + `ProductSet `__ resources, named ``projects/*/locations/*/productSets/*``, which acts as a way to + put different products into groups to limit identification. In parallel, - The API has a collection of - [Product][google.cloud.vision.v1p4beta1.Product] resources, named - ``projects/*/locations/*/products/*`` - - - Each [Product][google.cloud.vision.v1p4beta1.Product] has a - collection of - [ReferenceImage][google.cloud.vision.v1p4beta1.ReferenceImage] - resources, named - ``projects/*/locations/*/products/*/referenceImages/*`` + + `Product `__ resources, named ``projects/*/locations/*/products/*`` + + - Each `Product `__ has a collection of + + `ReferenceImage `__ resources, named ``projects/*/locations/*/products/*/referenceImages/*`` """ _client: ProductSearchClient @@ -336,7 +334,7 @@ async def create_product_set( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing, or is + * Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters. .. code-block:: python @@ -387,7 +385,8 @@ async def sample_create_product_set(): the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 - characters long. It cannot contain the character ``/``. + characters long. It cannot contain the character + ``/``. This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this @@ -477,7 +476,7 @@ async def list_product_sets( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100, or + * Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1. .. code-block:: python @@ -529,7 +528,7 @@ async def sample_list_product_sets(): Returns: google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductSetsAsyncPager: - Response message for the ListProductSets method. + Response message for the ``ListProductSets`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -610,7 +609,7 @@ async def get_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. + * Returns NOT_FOUND if the ProductSet does not exist. .. code-block:: python @@ -644,8 +643,7 @@ async def sample_get_product_set(): name (:class:`str`): Required. Resource name of the ProductSet to get. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -733,8 +731,9 @@ async def update_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the ProductSet does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but missing from the request or longer than 4096 characters. @@ -774,10 +773,9 @@ async def sample_update_product_set(): on the ``request`` instance; if ``request`` is provided, this should not be set. update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - The [FieldMask][google.protobuf.FieldMask] that - specifies which fields to update. If update_mask isn't - specified, all mutable fields are to be updated. Valid - mask path is ``display_name``. + The `FieldMask `__ that specifies which fields to update. + If update_mask isn't specified, all mutable fields are + to be updated. Valid mask path is ``display_name``. This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this @@ -898,8 +896,7 @@ async def sample_delete_product_set(): name (:class:`str`): Required. Resource name of the ProductSet to delete. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -975,11 +972,13 @@ async def create_product( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing or longer + * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is longer than 4096 + + * Returns INVALID_ARGUMENT if description is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is missing or + + * Returns INVALID_ARGUMENT if product_category is missing or invalid. .. code-block:: python @@ -1030,7 +1029,8 @@ async def sample_create_product(): the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 - characters long. It cannot contain the character ``/``. + characters long. It cannot contain the character + ``/``. This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this @@ -1115,7 +1115,7 @@ async def list_products( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. .. code-block:: python @@ -1167,7 +1167,7 @@ async def sample_list_products(): Returns: google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductsAsyncPager: - Response message for the ListProducts method. + Response message for the ``ListProducts`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1246,7 +1246,7 @@ async def get_product( Possible errors: - - Returns NOT_FOUND if the Product does not exist. + * Returns NOT_FOUND if the Product does not exist. .. code-block:: python @@ -1280,8 +1280,7 @@ async def sample_get_product(): name (:class:`str`): Required. Resource name of the Product to get. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -1360,20 +1359,24 @@ async def update_product( metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> product_search_service.Product: r"""Makes changes to a Product resource. Only the ``display_name``, - ``description``, and ``labels`` fields can be updated right now. + ``description``, and ``labels`` fields can be updated right + now. If labels are updated, the change will not be reflected in queries until the next index time. Possible errors: - - Returns NOT_FOUND if the Product does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the Product does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from the request or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is present in + + * Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is present in + + * Returns INVALID_ARGUMENT if product_category is present in update_mask. .. code-block:: python @@ -1413,11 +1416,10 @@ async def sample_update_product(): on the ``request`` instance; if ``request`` is provided, this should not be set. update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - The [FieldMask][google.protobuf.FieldMask] that - specifies which fields to update. If update_mask isn't - specified, all mutable fields are to be updated. Valid - mask paths include ``product_labels``, ``display_name``, - and ``description``. + The `FieldMask `__ that specifies which fields to update. + If update_mask isn't specified, all mutable fields are + to be updated. Valid mask paths include ``product_labels``, + ``display_name``, and ``description``. This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this @@ -1534,8 +1536,7 @@ async def sample_delete_product(): name (:class:`str`): Required. Resource name of product to delete. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -1609,25 +1610,27 @@ async def create_reference_image( ) -> product_search_service.ReferenceImage: r"""Creates and returns a new ReferenceImage resource. - The ``bounding_poly`` field is optional. If ``bounding_poly`` is - not specified, the system will try to detect regions of interest - in the image that are compatible with the product_category on - the parent product. If it is specified, detection is ALWAYS - skipped. The system converts polygons into non-rotated - rectangles. + The ``bounding_poly`` field is optional. If ``bounding_poly`` is not + specified, the system will try to detect regions of interest in + the image that are compatible with the product_category on the + parent product. If it is specified, detection is ALWAYS skipped. + The system converts polygons into non-rotated rectangles. Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP). Possible errors: - - Returns INVALID_ARGUMENT if the image_uri is missing or longer + * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if the product does not exist. - - Returns INVALID_ARGUMENT if bounding_poly is not provided, and + + * Returns INVALID_ARGUMENT if the product does not exist. + + * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with the parent product's product_category is detected. - - Returns INVALID_ARGUMENT if bounding_poly contains more than + + * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. .. code-block:: python @@ -1667,8 +1670,7 @@ async def sample_create_reference_image(): Required. Resource name of the product in which to create the reference image. - Format is - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this @@ -1686,7 +1688,8 @@ async def sample_create_reference_image(): added. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 - characters long. It cannot contain the character ``/``. + characters long. It cannot contain the character + ``/``. This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this @@ -1701,8 +1704,8 @@ async def sample_create_reference_image(): Returns: google.cloud.vision_v1p4beta1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -1884,8 +1887,9 @@ async def list_reference_images( Possible errors: - - Returns NOT_FOUND if the parent product does not exist. - - Returns INVALID_ARGUMENT if the page_size is greater than 100, + * Returns NOT_FOUND if the parent product does not exist. + + * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1. .. code-block:: python @@ -1922,8 +1926,7 @@ async def sample_list_reference_images(): Required. Resource name of the product containing the reference images. - Format is - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this @@ -1938,7 +1941,7 @@ async def sample_list_reference_images(): Returns: google.cloud.vision_v1p4beta1.services.product_search.pagers.ListReferenceImagesAsyncPager: - Response message for the ListReferenceImages method. + Response message for the ``ListReferenceImages`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -2019,7 +2022,7 @@ async def get_reference_image( Possible errors: - - Returns NOT_FOUND if the specified image does not exist. + * Returns NOT_FOUND if the specified image does not exist. .. code-block:: python @@ -2071,8 +2074,8 @@ async def sample_get_reference_image(): Returns: google.cloud.vision_v1p4beta1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -2143,7 +2146,7 @@ async def add_product_to_product_set( Possible errors: - - Returns NOT_FOUND if the Product or the ProductSet doesn't + * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. .. code-block:: python @@ -2172,14 +2175,12 @@ async def sample_add_product_to_product_set(): Args: request (Optional[Union[google.cloud.vision_v1p4beta1.types.AddProductToProductSetRequest, dict]]): - The request object. Request message for the ``AddProductToProductSet`` - method. + The request object. Request message for the ``AddProductToProductSet`` method. name (:class:`str`): Required. The resource name for the ProductSet to modify. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2188,8 +2189,7 @@ async def sample_add_product_to_product_set(): Required. The resource name for the Product to be added to this ProductSet. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this @@ -2292,14 +2292,12 @@ async def sample_remove_product_from_product_set(): Args: request (Optional[Union[google.cloud.vision_v1p4beta1.types.RemoveProductFromProductSetRequest, dict]]): - The request object. Request message for the ``RemoveProductFromProductSet`` - method. + The request object. Request message for the ``RemoveProductFromProductSet`` method. name (:class:`str`): Required. The resource name for the ProductSet to modify. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2308,8 +2306,7 @@ async def sample_remove_product_from_product_set(): Required. The resource name for the Product to be removed from this ProductSet. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this @@ -2389,7 +2386,7 @@ async def list_products_in_product_set( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. .. code-block:: python @@ -2421,14 +2418,12 @@ async def sample_list_products_in_product_set(): Args: request (Optional[Union[google.cloud.vision_v1p4beta1.types.ListProductsInProductSetRequest, dict]]): - The request object. Request message for the ``ListProductsInProductSet`` - method. + The request object. Request message for the ``ListProductsInProductSet`` method. name (:class:`str`): Required. The ProductSet resource for which to retrieve Products. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2443,8 +2438,7 @@ async def sample_list_products_in_product_set(): Returns: google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductsInProductSetAsyncPager: - Response message for the ListProductsInProductSet - method. + Response message for the ``ListProductsInProductSet`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -2529,15 +2523,14 @@ async def import_product_sets( r"""Asynchronous API that imports a list of reference images to specified product sets based on a list of image information. - The [google.longrunning.Operation][google.longrunning.Operation] - API can be used to keep track of the progress and results of the - request. ``Operation.metadata`` contains - ``BatchOperationMetadata``. (progress) ``Operation.response`` - contains ``ImportProductSetsResponse``. (results) + The `google.longrunning.Operation `__ API can be used to keep track of the progress + and results of the request. ``Operation.metadata`` contains + ``BatchOperationMetadata``. (progress) ``Operation.response`` contains ``ImportProductSetsResponse``. + (results) The input source of this method is a csv file on Google Cloud Storage. For the format of the csv file please see - [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.csv_file_uri]. + `ImportProductSetsGcsSource.csv_file_uri `__. .. code-block:: python @@ -2601,14 +2594,11 @@ async def sample_import_product_sets(): An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1p4beta1.types.ImportProductSetsResponse` - Response message for the ImportProductSets method. + :class:`google.cloud.vision_v1p4beta1.types.ImportProductSetsResponse`` Response message for the ``ImportProductSets` + method. - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + This message is returned by the `google.longrunning.Operations.GetOperation `__ method in + the returned `google.longrunning.Operation.response `__ field. """ # Create or coerce a protobuf request object. @@ -2704,9 +2694,8 @@ async def purge_products( into the empty ProductSet, you must wait until the PurgeProducts operation has finished for that ProductSet. - The [google.longrunning.Operation][google.longrunning.Operation] - API can be used to keep track of the progress and results of the - request. ``Operation.metadata`` contains + The `google.longrunning.Operation `__ API can be used to keep track of the progress + and results of the request. ``Operation.metadata`` contains ``BatchOperationMetadata``. (progress) .. code-block:: python @@ -2763,16 +2752,16 @@ async def sample_purge_products(): google.api_core.operation_async.AsyncOperation: An object representing a long-running operation. - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } + The result type for the operation will be + :class:`google.protobuf.empty_pb2.Empty` A generic empty + message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to use + it as the request or the response type of an API method. + For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } """ # Create or coerce a protobuf request object. diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/client.py b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/client.py index c34d87387b68..e471e68c0431 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/client.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/client.py @@ -117,21 +117,19 @@ class ProductSearchClient(metaclass=ProductSearchClientMeta): product search. It uses the following resource model: - The API has a collection of - [ProductSet][google.cloud.vision.v1p4beta1.ProductSet] resources, - named ``projects/*/locations/*/productSets/*``, which acts as a - way to put different products into groups to limit identification. + + `ProductSet `__ resources, named ``projects/*/locations/*/productSets/*``, which acts as a way to + put different products into groups to limit identification. In parallel, - The API has a collection of - [Product][google.cloud.vision.v1p4beta1.Product] resources, named - ``projects/*/locations/*/products/*`` - - - Each [Product][google.cloud.vision.v1p4beta1.Product] has a - collection of - [ReferenceImage][google.cloud.vision.v1p4beta1.ReferenceImage] - resources, named - ``projects/*/locations/*/products/*/referenceImages/*`` + + `Product `__ resources, named ``projects/*/locations/*/products/*`` + + - Each `Product `__ has a collection of + + `ReferenceImage `__ resources, named ``projects/*/locations/*/products/*/referenceImages/*`` """ @staticmethod @@ -817,7 +815,7 @@ def create_product_set( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing, or is + * Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters. .. code-block:: python @@ -868,7 +866,8 @@ def sample_create_product_set(): the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 - characters long. It cannot contain the character ``/``. + characters long. It cannot contain the character + ``/``. This corresponds to the ``product_set_id`` field on the ``request`` instance; if ``request`` is provided, this @@ -955,7 +954,7 @@ def list_product_sets( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100, or + * Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1. .. code-block:: python @@ -1007,7 +1006,7 @@ def sample_list_product_sets(): Returns: google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductSetsPager: - Response message for the ListProductSets method. + Response message for the ``ListProductSets`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1085,7 +1084,7 @@ def get_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. + * Returns NOT_FOUND if the ProductSet does not exist. .. code-block:: python @@ -1119,8 +1118,7 @@ def sample_get_product_set(): name (str): Required. Resource name of the ProductSet to get. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -1205,8 +1203,9 @@ def update_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the ProductSet does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but missing from the request or longer than 4096 characters. @@ -1246,10 +1245,9 @@ def sample_update_product_set(): on the ``request`` instance; if ``request`` is provided, this should not be set. update_mask (google.protobuf.field_mask_pb2.FieldMask): - The [FieldMask][google.protobuf.FieldMask] that - specifies which fields to update. If update_mask isn't - specified, all mutable fields are to be updated. Valid - mask path is ``display_name``. + The `FieldMask `__ that specifies which fields to update. + If update_mask isn't specified, all mutable fields are + to be updated. Valid mask path is ``display_name``. This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this @@ -1367,8 +1365,7 @@ def sample_delete_product_set(): name (str): Required. Resource name of the ProductSet to delete. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -1441,11 +1438,13 @@ def create_product( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing or longer + * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is longer than 4096 + + * Returns INVALID_ARGUMENT if description is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is missing or + + * Returns INVALID_ARGUMENT if product_category is missing or invalid. .. code-block:: python @@ -1496,7 +1495,8 @@ def sample_create_product(): the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 - characters long. It cannot contain the character ``/``. + characters long. It cannot contain the character + ``/``. This corresponds to the ``product_id`` field on the ``request`` instance; if ``request`` is provided, this @@ -1578,7 +1578,7 @@ def list_products( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. .. code-block:: python @@ -1630,7 +1630,7 @@ def sample_list_products(): Returns: google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductsPager: - Response message for the ListProducts method. + Response message for the ``ListProducts`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -1706,7 +1706,7 @@ def get_product( Possible errors: - - Returns NOT_FOUND if the Product does not exist. + * Returns NOT_FOUND if the Product does not exist. .. code-block:: python @@ -1740,8 +1740,7 @@ def sample_get_product(): name (str): Required. Resource name of the Product to get. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -1817,20 +1816,24 @@ def update_product( metadata: Sequence[Tuple[str, Union[str, bytes]]] = (), ) -> product_search_service.Product: r"""Makes changes to a Product resource. Only the ``display_name``, - ``description``, and ``labels`` fields can be updated right now. + ``description``, and ``labels`` fields can be updated right + now. If labels are updated, the change will not be reflected in queries until the next index time. Possible errors: - - Returns NOT_FOUND if the Product does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the Product does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from the request or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is present in + + * Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is present in + + * Returns INVALID_ARGUMENT if product_category is present in update_mask. .. code-block:: python @@ -1870,11 +1873,10 @@ def sample_update_product(): on the ``request`` instance; if ``request`` is provided, this should not be set. update_mask (google.protobuf.field_mask_pb2.FieldMask): - The [FieldMask][google.protobuf.FieldMask] that - specifies which fields to update. If update_mask isn't - specified, all mutable fields are to be updated. Valid - mask paths include ``product_labels``, ``display_name``, - and ``description``. + The `FieldMask `__ that specifies which fields to update. + If update_mask isn't specified, all mutable fields are + to be updated. Valid mask paths include ``product_labels``, + ``display_name``, and ``description``. This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this @@ -1988,8 +1990,7 @@ def sample_delete_product(): name (str): Required. Resource name of product to delete. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2060,25 +2061,27 @@ def create_reference_image( ) -> product_search_service.ReferenceImage: r"""Creates and returns a new ReferenceImage resource. - The ``bounding_poly`` field is optional. If ``bounding_poly`` is - not specified, the system will try to detect regions of interest - in the image that are compatible with the product_category on - the parent product. If it is specified, detection is ALWAYS - skipped. The system converts polygons into non-rotated - rectangles. + The ``bounding_poly`` field is optional. If ``bounding_poly`` is not + specified, the system will try to detect regions of interest in + the image that are compatible with the product_category on the + parent product. If it is specified, detection is ALWAYS skipped. + The system converts polygons into non-rotated rectangles. Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP). Possible errors: - - Returns INVALID_ARGUMENT if the image_uri is missing or longer + * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if the product does not exist. - - Returns INVALID_ARGUMENT if bounding_poly is not provided, and + + * Returns INVALID_ARGUMENT if the product does not exist. + + * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with the parent product's product_category is detected. - - Returns INVALID_ARGUMENT if bounding_poly contains more than + + * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. .. code-block:: python @@ -2118,8 +2121,7 @@ def sample_create_reference_image(): Required. Resource name of the product in which to create the reference image. - Format is - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this @@ -2137,7 +2139,8 @@ def sample_create_reference_image(): added. If set, the server will attempt to use this value as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 - characters long. It cannot contain the character ``/``. + characters long. It cannot contain the character + ``/``. This corresponds to the ``reference_image_id`` field on the ``request`` instance; if ``request`` is provided, this @@ -2152,8 +2155,8 @@ def sample_create_reference_image(): Returns: google.cloud.vision_v1p4beta1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -2329,8 +2332,9 @@ def list_reference_images( Possible errors: - - Returns NOT_FOUND if the parent product does not exist. - - Returns INVALID_ARGUMENT if the page_size is greater than 100, + * Returns NOT_FOUND if the parent product does not exist. + + * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1. .. code-block:: python @@ -2367,8 +2371,7 @@ def sample_list_reference_images(): Required. Resource name of the product containing the reference images. - Format is - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this @@ -2383,7 +2386,7 @@ def sample_list_reference_images(): Returns: google.cloud.vision_v1p4beta1.services.product_search.pagers.ListReferenceImagesPager: - Response message for the ListReferenceImages method. + Response message for the ``ListReferenceImages`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -2461,7 +2464,7 @@ def get_reference_image( Possible errors: - - Returns NOT_FOUND if the specified image does not exist. + * Returns NOT_FOUND if the specified image does not exist. .. code-block:: python @@ -2513,8 +2516,8 @@ def sample_get_reference_image(): Returns: google.cloud.vision_v1p4beta1.types.ReferenceImage: - A ReferenceImage represents a product image and its associated metadata, - such as bounding boxes. + A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. """ # Create or coerce a protobuf request object. @@ -2582,7 +2585,7 @@ def add_product_to_product_set( Possible errors: - - Returns NOT_FOUND if the Product or the ProductSet doesn't + * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. .. code-block:: python @@ -2611,14 +2614,12 @@ def sample_add_product_to_product_set(): Args: request (Union[google.cloud.vision_v1p4beta1.types.AddProductToProductSetRequest, dict]): - The request object. Request message for the ``AddProductToProductSet`` - method. + The request object. Request message for the ``AddProductToProductSet`` method. name (str): Required. The resource name for the ProductSet to modify. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2627,8 +2628,7 @@ def sample_add_product_to_product_set(): Required. The resource name for the Product to be added to this ProductSet. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this @@ -2730,14 +2730,12 @@ def sample_remove_product_from_product_set(): Args: request (Union[google.cloud.vision_v1p4beta1.types.RemoveProductFromProductSetRequest, dict]): - The request object. Request message for the ``RemoveProductFromProductSet`` - method. + The request object. Request message for the ``RemoveProductFromProductSet`` method. name (str): Required. The resource name for the ProductSet to modify. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2746,8 +2744,7 @@ def sample_remove_product_from_product_set(): Required. The resource name for the Product to be removed from this ProductSet. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` This corresponds to the ``product`` field on the ``request`` instance; if ``request`` is provided, this @@ -2826,7 +2823,7 @@ def list_products_in_product_set( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. .. code-block:: python @@ -2858,14 +2855,12 @@ def sample_list_products_in_product_set(): Args: request (Union[google.cloud.vision_v1p4beta1.types.ListProductsInProductSetRequest, dict]): - The request object. Request message for the ``ListProductsInProductSet`` - method. + The request object. Request message for the ``ListProductsInProductSet`` method. name (str): Required. The ProductSet resource for which to retrieve Products. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2880,8 +2875,7 @@ def sample_list_products_in_product_set(): Returns: google.cloud.vision_v1p4beta1.services.product_search.pagers.ListProductsInProductSetPager: - Response message for the ListProductsInProductSet - method. + Response message for the ``ListProductsInProductSet`` method. Iterating over this object will yield results and resolve additional pages automatically. @@ -2965,15 +2959,14 @@ def import_product_sets( r"""Asynchronous API that imports a list of reference images to specified product sets based on a list of image information. - The [google.longrunning.Operation][google.longrunning.Operation] - API can be used to keep track of the progress and results of the - request. ``Operation.metadata`` contains - ``BatchOperationMetadata``. (progress) ``Operation.response`` - contains ``ImportProductSetsResponse``. (results) + The `google.longrunning.Operation `__ API can be used to keep track of the progress + and results of the request. ``Operation.metadata`` contains + ``BatchOperationMetadata``. (progress) ``Operation.response`` contains ``ImportProductSetsResponse``. + (results) The input source of this method is a csv file on Google Cloud Storage. For the format of the csv file please see - [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.csv_file_uri]. + `ImportProductSetsGcsSource.csv_file_uri `__. .. code-block:: python @@ -3037,14 +3030,11 @@ def sample_import_product_sets(): An object representing a long-running operation. The result type for the operation will be - :class:`google.cloud.vision_v1p4beta1.types.ImportProductSetsResponse` - Response message for the ImportProductSets method. + :class:`google.cloud.vision_v1p4beta1.types.ImportProductSetsResponse`` Response message for the ``ImportProductSets` + method. - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + This message is returned by the `google.longrunning.Operations.GetOperation `__ method in + the returned `google.longrunning.Operation.response `__ field. """ # Create or coerce a protobuf request object. @@ -3137,9 +3127,8 @@ def purge_products( into the empty ProductSet, you must wait until the PurgeProducts operation has finished for that ProductSet. - The [google.longrunning.Operation][google.longrunning.Operation] - API can be used to keep track of the progress and results of the - request. ``Operation.metadata`` contains + The `google.longrunning.Operation `__ API can be used to keep track of the progress + and results of the request. ``Operation.metadata`` contains ``BatchOperationMetadata``. (progress) .. code-block:: python @@ -3196,16 +3185,16 @@ def sample_purge_products(): google.api_core.operation.Operation: An object representing a long-running operation. - The result type for the operation will be :class:`google.protobuf.empty_pb2.Empty` A generic empty message that you can re-use to avoid defining duplicated - empty messages in your APIs. A typical example is to - use it as the request or the response type of an API - method. For instance: - - service Foo { - rpc Bar(google.protobuf.Empty) returns - (google.protobuf.Empty); - - } + The result type for the operation will be + :class:`google.protobuf.empty_pb2.Empty` A generic empty + message that you can re-use to avoid defining duplicated + empty messages in your APIs. A typical example is to use + it as the request or the response type of an API method. + For instance: + + service Foo { + rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); + } """ # Create or coerce a protobuf request object. diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/transports/base.py b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/transports/base.py index 64ce1bc97cbd..7e02477a5895 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/transports/base.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/transports/base.py @@ -87,8 +87,6 @@ def __init__( be used for service account credentials. """ - scopes_kwargs = {"scopes": scopes, "default_scopes": self.AUTH_SCOPES} - # Save the scopes. self._scopes = scopes if not hasattr(self, "_ignore_credentials"): @@ -103,11 +101,16 @@ def __init__( if credentials_file is not None: credentials, _ = google.auth.load_credentials_from_file( - credentials_file, **scopes_kwargs, quota_project_id=quota_project_id + credentials_file, + scopes=scopes, + quota_project_id=quota_project_id, + default_scopes=self.AUTH_SCOPES, ) elif credentials is None and not self._ignore_credentials: credentials, _ = google.auth.default( - **scopes_kwargs, quota_project_id=quota_project_id + scopes=scopes, + quota_project_id=quota_project_id, + default_scopes=self.AUTH_SCOPES, ) # Don't apply audience if the credentials file passed from user. if hasattr(credentials, "with_gdch_audience"): diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/transports/grpc.py b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/transports/grpc.py index 452d930a604c..1436872bc649 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/transports/grpc.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/transports/grpc.py @@ -116,21 +116,19 @@ class ProductSearchGrpcTransport(ProductSearchTransport): product search. It uses the following resource model: - The API has a collection of - [ProductSet][google.cloud.vision.v1p4beta1.ProductSet] resources, - named ``projects/*/locations/*/productSets/*``, which acts as a - way to put different products into groups to limit identification. + + `ProductSet `__ resources, named ``projects/*/locations/*/productSets/*``, which acts as a way to + put different products into groups to limit identification. In parallel, - The API has a collection of - [Product][google.cloud.vision.v1p4beta1.Product] resources, named - ``projects/*/locations/*/products/*`` - - Each [Product][google.cloud.vision.v1p4beta1.Product] has a - collection of - [ReferenceImage][google.cloud.vision.v1p4beta1.ReferenceImage] - resources, named - ``projects/*/locations/*/products/*/referenceImages/*`` + `Product `__ resources, named ``projects/*/locations/*/products/*`` + + - Each `Product `__ has a collection of + + `ReferenceImage `__ resources, named ``projects/*/locations/*/products/*/referenceImages/*`` This class defines the same methods as the primary client, so the primary client can load the underlying transport implementation @@ -371,7 +369,7 @@ def create_product_set( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing, or is + * Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters. Returns: @@ -405,7 +403,7 @@ def list_product_sets( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100, or + * Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1. Returns: @@ -438,7 +436,7 @@ def get_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. + * Returns NOT_FOUND if the ProductSet does not exist. Returns: Callable[[~.GetProductSetRequest], @@ -472,8 +470,9 @@ def update_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the ProductSet does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but missing from the request or longer than 4096 characters. @@ -537,11 +536,13 @@ def create_product( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing or longer + * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is longer than 4096 + + * Returns INVALID_ARGUMENT if description is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is missing or + + * Returns INVALID_ARGUMENT if product_category is missing or invalid. Returns: @@ -575,7 +576,7 @@ def list_products( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. Returns: @@ -608,7 +609,7 @@ def get_product( Possible errors: - - Returns NOT_FOUND if the Product does not exist. + * Returns NOT_FOUND if the Product does not exist. Returns: Callable[[~.GetProductRequest], @@ -637,20 +638,24 @@ def update_product( r"""Return a callable for the update product method over gRPC. Makes changes to a Product resource. Only the ``display_name``, - ``description``, and ``labels`` fields can be updated right now. + ``description``, and ``labels`` fields can be updated right + now. If labels are updated, the change will not be reflected in queries until the next index time. Possible errors: - - Returns NOT_FOUND if the Product does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the Product does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from the request or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is present in + + * Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is present in + + * Returns INVALID_ARGUMENT if product_category is present in update_mask. Returns: @@ -713,25 +718,27 @@ def create_reference_image( Creates and returns a new ReferenceImage resource. - The ``bounding_poly`` field is optional. If ``bounding_poly`` is - not specified, the system will try to detect regions of interest - in the image that are compatible with the product_category on - the parent product. If it is specified, detection is ALWAYS - skipped. The system converts polygons into non-rotated - rectangles. + The ``bounding_poly`` field is optional. If ``bounding_poly`` is not + specified, the system will try to detect regions of interest in + the image that are compatible with the product_category on the + parent product. If it is specified, detection is ALWAYS skipped. + The system converts polygons into non-rotated rectangles. Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP). Possible errors: - - Returns INVALID_ARGUMENT if the image_uri is missing or longer + * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if the product does not exist. - - Returns INVALID_ARGUMENT if bounding_poly is not provided, and + + * Returns INVALID_ARGUMENT if the product does not exist. + + * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with the parent product's product_category is detected. - - Returns INVALID_ARGUMENT if bounding_poly contains more than + + * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. Returns: @@ -800,8 +807,9 @@ def list_reference_images( Possible errors: - - Returns NOT_FOUND if the parent product does not exist. - - Returns INVALID_ARGUMENT if the page_size is greater than 100, + * Returns NOT_FOUND if the parent product does not exist. + + * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1. Returns: @@ -835,7 +843,7 @@ def get_reference_image( Possible errors: - - Returns NOT_FOUND if the specified image does not exist. + * Returns NOT_FOUND if the specified image does not exist. Returns: Callable[[~.GetReferenceImageRequest], @@ -870,7 +878,7 @@ def add_product_to_product_set( Possible errors: - - Returns NOT_FOUND if the Product or the ProductSet doesn't + * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. Returns: @@ -939,7 +947,7 @@ def list_products_in_product_set( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. Returns: @@ -973,15 +981,14 @@ def import_product_sets( Asynchronous API that imports a list of reference images to specified product sets based on a list of image information. - The [google.longrunning.Operation][google.longrunning.Operation] - API can be used to keep track of the progress and results of the - request. ``Operation.metadata`` contains - ``BatchOperationMetadata``. (progress) ``Operation.response`` - contains ``ImportProductSetsResponse``. (results) + The `google.longrunning.Operation `__ API can be used to keep track of the progress + and results of the request. ``Operation.metadata`` contains + ``BatchOperationMetadata``. (progress) ``Operation.response`` contains ``ImportProductSetsResponse``. + (results) The input source of this method is a csv file on Google Cloud Storage. For the format of the csv file please see - [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.csv_file_uri]. + `ImportProductSetsGcsSource.csv_file_uri `__. Returns: Callable[[~.ImportProductSetsRequest], @@ -1032,9 +1039,8 @@ def purge_products( into the empty ProductSet, you must wait until the PurgeProducts operation has finished for that ProductSet. - The [google.longrunning.Operation][google.longrunning.Operation] - API can be used to keep track of the progress and results of the - request. ``Operation.metadata`` contains + The `google.longrunning.Operation `__ API can be used to keep track of the progress + and results of the request. ``Operation.metadata`` contains ``BatchOperationMetadata``. (progress) Returns: diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/transports/grpc_asyncio.py b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/transports/grpc_asyncio.py index 16ae1eac3171..3dd935a52d34 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/transports/grpc_asyncio.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/transports/grpc_asyncio.py @@ -122,21 +122,19 @@ class ProductSearchGrpcAsyncIOTransport(ProductSearchTransport): product search. It uses the following resource model: - The API has a collection of - [ProductSet][google.cloud.vision.v1p4beta1.ProductSet] resources, - named ``projects/*/locations/*/productSets/*``, which acts as a - way to put different products into groups to limit identification. + + `ProductSet `__ resources, named ``projects/*/locations/*/productSets/*``, which acts as a way to + put different products into groups to limit identification. In parallel, - The API has a collection of - [Product][google.cloud.vision.v1p4beta1.Product] resources, named - ``projects/*/locations/*/products/*`` - - Each [Product][google.cloud.vision.v1p4beta1.Product] has a - collection of - [ReferenceImage][google.cloud.vision.v1p4beta1.ReferenceImage] - resources, named - ``projects/*/locations/*/products/*/referenceImages/*`` + `Product `__ resources, named ``projects/*/locations/*/products/*`` + + - Each `Product `__ has a collection of + + `ReferenceImage `__ resources, named ``projects/*/locations/*/products/*/referenceImages/*`` This class defines the same methods as the primary client, so the primary client can load the underlying transport implementation @@ -379,7 +377,7 @@ def create_product_set( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing, or is + * Returns INVALID_ARGUMENT if display_name is missing, or is longer than 4096 characters. Returns: @@ -413,7 +411,7 @@ def list_product_sets( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100, or + * Returns INVALID_ARGUMENT if page_size is greater than 100, or less than 1. Returns: @@ -447,7 +445,7 @@ def get_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. + * Returns NOT_FOUND if the ProductSet does not exist. Returns: Callable[[~.GetProductSetRequest], @@ -481,8 +479,9 @@ def update_product_set( Possible errors: - - Returns NOT_FOUND if the ProductSet does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the ProductSet does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but missing from the request or longer than 4096 characters. @@ -549,11 +548,13 @@ def create_product( Possible errors: - - Returns INVALID_ARGUMENT if display_name is missing or longer + * Returns INVALID_ARGUMENT if display_name is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is longer than 4096 + + * Returns INVALID_ARGUMENT if description is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is missing or + + * Returns INVALID_ARGUMENT if product_category is missing or invalid. Returns: @@ -587,7 +588,7 @@ def list_products( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. Returns: @@ -621,7 +622,7 @@ def get_product( Possible errors: - - Returns NOT_FOUND if the Product does not exist. + * Returns NOT_FOUND if the Product does not exist. Returns: Callable[[~.GetProductRequest], @@ -651,20 +652,24 @@ def update_product( r"""Return a callable for the update product method over gRPC. Makes changes to a Product resource. Only the ``display_name``, - ``description``, and ``labels`` fields can be updated right now. + ``description``, and ``labels`` fields can be updated right + now. If labels are updated, the change will not be reflected in queries until the next index time. Possible errors: - - Returns NOT_FOUND if the Product does not exist. - - Returns INVALID_ARGUMENT if display_name is present in + * Returns NOT_FOUND if the Product does not exist. + + * Returns INVALID_ARGUMENT if display_name is present in update_mask but is missing from the request or longer than 4096 characters. - - Returns INVALID_ARGUMENT if description is present in + + * Returns INVALID_ARGUMENT if description is present in update_mask but is longer than 4096 characters. - - Returns INVALID_ARGUMENT if product_category is present in + + * Returns INVALID_ARGUMENT if product_category is present in update_mask. Returns: @@ -729,25 +734,27 @@ def create_reference_image( Creates and returns a new ReferenceImage resource. - The ``bounding_poly`` field is optional. If ``bounding_poly`` is - not specified, the system will try to detect regions of interest - in the image that are compatible with the product_category on - the parent product. If it is specified, detection is ALWAYS - skipped. The system converts polygons into non-rotated - rectangles. + The ``bounding_poly`` field is optional. If ``bounding_poly`` is not + specified, the system will try to detect regions of interest in + the image that are compatible with the product_category on the + parent product. If it is specified, detection is ALWAYS skipped. + The system converts polygons into non-rotated rectangles. Note that the pipeline will resize the image if the image resolution is too large to process (above 50MP). Possible errors: - - Returns INVALID_ARGUMENT if the image_uri is missing or longer + * Returns INVALID_ARGUMENT if the image_uri is missing or longer than 4096 characters. - - Returns INVALID_ARGUMENT if the product does not exist. - - Returns INVALID_ARGUMENT if bounding_poly is not provided, and + + * Returns INVALID_ARGUMENT if the product does not exist. + + * Returns INVALID_ARGUMENT if bounding_poly is not provided, and nothing compatible with the parent product's product_category is detected. - - Returns INVALID_ARGUMENT if bounding_poly contains more than + + * Returns INVALID_ARGUMENT if bounding_poly contains more than 10 polygons. Returns: @@ -816,8 +823,9 @@ def list_reference_images( Possible errors: - - Returns NOT_FOUND if the parent product does not exist. - - Returns INVALID_ARGUMENT if the page_size is greater than 100, + * Returns NOT_FOUND if the parent product does not exist. + + * Returns INVALID_ARGUMENT if the page_size is greater than 100, or less than 1. Returns: @@ -851,7 +859,7 @@ def get_reference_image( Possible errors: - - Returns NOT_FOUND if the specified image does not exist. + * Returns NOT_FOUND if the specified image does not exist. Returns: Callable[[~.GetReferenceImageRequest], @@ -887,7 +895,7 @@ def add_product_to_product_set( Possible errors: - - Returns NOT_FOUND if the Product or the ProductSet doesn't + * Returns NOT_FOUND if the Product or the ProductSet doesn't exist. Returns: @@ -957,7 +965,7 @@ def list_products_in_product_set( Possible errors: - - Returns INVALID_ARGUMENT if page_size is greater than 100 or + * Returns INVALID_ARGUMENT if page_size is greater than 100 or less than 1. Returns: @@ -992,15 +1000,14 @@ def import_product_sets( Asynchronous API that imports a list of reference images to specified product sets based on a list of image information. - The [google.longrunning.Operation][google.longrunning.Operation] - API can be used to keep track of the progress and results of the - request. ``Operation.metadata`` contains - ``BatchOperationMetadata``. (progress) ``Operation.response`` - contains ``ImportProductSetsResponse``. (results) + The `google.longrunning.Operation `__ API can be used to keep track of the progress + and results of the request. ``Operation.metadata`` contains + ``BatchOperationMetadata``. (progress) ``Operation.response`` contains ``ImportProductSetsResponse``. + (results) The input source of this method is a csv file on Google Cloud Storage. For the format of the csv file please see - [ImportProductSetsGcsSource.csv_file_uri][google.cloud.vision.v1p4beta1.ImportProductSetsGcsSource.csv_file_uri]. + `ImportProductSetsGcsSource.csv_file_uri `__. Returns: Callable[[~.ImportProductSetsRequest], @@ -1052,9 +1059,8 @@ def purge_products( into the empty ProductSet, you must wait until the PurgeProducts operation has finished for that ProductSet. - The [google.longrunning.Operation][google.longrunning.Operation] - API can be used to keep track of the progress and results of the - request. ``Operation.metadata`` contains + The `google.longrunning.Operation `__ API can be used to keep track of the progress + and results of the request. ``Operation.metadata`` contains ``BatchOperationMetadata``. (progress) Returns: diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/transports/rest.py b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/transports/rest.py index af54bbc62247..727072328535 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/transports/rest.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/services/product_search/transports/rest.py @@ -1010,21 +1010,19 @@ class ProductSearchRestTransport(_BaseProductSearchRestTransport): product search. It uses the following resource model: - The API has a collection of - [ProductSet][google.cloud.vision.v1p4beta1.ProductSet] resources, - named ``projects/*/locations/*/productSets/*``, which acts as a - way to put different products into groups to limit identification. + + `ProductSet `__ resources, named ``projects/*/locations/*/productSets/*``, which acts as a way to + put different products into groups to limit identification. In parallel, - The API has a collection of - [Product][google.cloud.vision.v1p4beta1.Product] resources, named - ``projects/*/locations/*/products/*`` - - Each [Product][google.cloud.vision.v1p4beta1.Product] has a - collection of - [ReferenceImage][google.cloud.vision.v1p4beta1.ReferenceImage] - resources, named - ``projects/*/locations/*/products/*/referenceImages/*`` + `Product `__ resources, named ``projects/*/locations/*/products/*`` + + - Each `Product `__ has a collection of + + `ReferenceImage `__ resources, named ``projects/*/locations/*/products/*/referenceImages/*`` This class defines the same methods as the primary client, so the primary client can load the underlying transport implementation @@ -1172,8 +1170,7 @@ def __call__( Args: request (~.product_search_service.AddProductToProductSetRequest): - The request object. Request message for the ``AddProductToProductSet`` - method. + The request object. Request message for the ``AddProductToProductSet`` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2971,8 +2968,7 @@ def __call__( Args: request (~.product_search_service.ListProductsInProductSetRequest): - The request object. Request message for the ``ListProductsInProductSet`` - method. + The request object. Request message for the ``ListProductsInProductSet`` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2983,9 +2979,7 @@ def __call__( Returns: ~.product_search_service.ListProductsInProductSetResponse: - Response message for the ``ListProductsInProductSet`` - method. - + Response message for the ``ListProductsInProductSet`` method. """ http_options = ( @@ -3430,8 +3424,7 @@ def __call__( Args: request (~.product_search_service.RemoveProductFromProductSetRequest): - The request object. Request message for the ``RemoveProductFromProductSet`` - method. + The request object. Request message for the ``RemoveProductFromProductSet`` method. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/face.py b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/face.py index fecbfe028373..4943eb8e09e8 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/face.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/face.py @@ -34,9 +34,8 @@ class FaceRecognitionParams(proto.Message): Attributes: celebrity_set (MutableSequence[str]): - The resource names for one or more - [CelebritySet][google.cloud.vision.v1p4beta1.CelebritySet]s. - A celebrity set is preloaded and can be specified as + The resource names for one or more `CelebritySet `__s. A + celebrity set is preloaded and can be specified as "builtin/default". If this is specified, the algorithm will try to match the faces detected in the input image to the Celebrities in the CelebritySets. @@ -80,8 +79,7 @@ class FaceRecognitionResult(proto.Message): Attributes: celebrity (google.cloud.vision_v1p4beta1.types.Celebrity): - The [Celebrity][google.cloud.vision.v1p4beta1.Celebrity] - that this face was matched to. + The `Celebrity `__ that this face was matched to. confidence (float): Recognition confidence. Range [0, 1]. """ diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/image_annotator.py b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/image_annotator.py index a0a0cf215916..1d90ab22d33f 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/image_annotator.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/image_annotator.py @@ -114,14 +114,13 @@ class Feature(proto.Message): The feature type. max_results (int): Maximum number of results of this type. Does not apply to - ``TEXT_DETECTION``, ``DOCUMENT_TEXT_DETECTION``, or - ``CROP_HINTS``. + ``TEXT_DETECTION``, ``DOCUMENT_TEXT_DETECTION``, or ``CROP_HINTS``. model (str): Model to use for the feature. Supported values: "builtin/stable" (the default if unset) and - "builtin/latest". ``DOCUMENT_TEXT_DETECTION`` and - ``TEXT_DETECTION`` also support "builtin/weekly" for the - bleeding edge release updated weekly. + "builtin/latest". ``DOCUMENT_TEXT_DETECTION`` and ``TEXT_DETECTION`` also + support "builtin/weekly" for the bleeding edge release + updated weekly. """ class Type(proto.Enum): @@ -141,12 +140,11 @@ class Type(proto.Enum): TEXT_DETECTION (5): Run text detection / optical character recognition (OCR). Text detection is optimized for areas of text within a - larger image; if the image is a document, use - ``DOCUMENT_TEXT_DETECTION`` instead. + larger image; if the image is a document, use ``DOCUMENT_TEXT_DETECTION`` + instead. DOCUMENT_TEXT_DETECTION (11): Run dense text document OCR. Takes precedence when both - ``DOCUMENT_TEXT_DETECTION`` and ``TEXT_DETECTION`` are - present. + ``DOCUMENT_TEXT_DETECTION`` and ``TEXT_DETECTION`` are present. SAFE_SEARCH_DETECTION (6): Run Safe Search to detect potentially unsafe or undesirable content. @@ -199,28 +197,29 @@ class ImageSource(proto.Message): gcs_image_uri (str): **Use ``image_uri`` instead.** - The Google Cloud Storage URI of the form - ``gs://bucket_name/object_name``. Object versioning is not - supported. See `Google Cloud Storage Request - URIs `__ - for more info. + The Google Cloud Storage URI of the form ``gs://bucket_name/object_name``. + Object versioning is not supported. See `Google Cloud Storage Request URIs `__ for + more info. image_uri (str): The URI of the source image. Can be either: 1. A Google Cloud Storage URI of the form - ``gs://bucket_name/object_name``. Object versioning is - not supported. See `Google Cloud Storage Request - URIs `__ - for more info. + + 1. A Google Cloud Storage URI of the form + ``gs://bucket_name/object_name``. Object versioning is not supported. See + `Google Cloud Storage Request + URIs `__ for more + info. 2. A publicly-accessible image HTTP/HTTPS URL. When fetching - images from HTTP/HTTPS URLs, Google cannot guarantee that - the request will be completed. Your request may fail if - the specified host denies the request (e.g. due to - request throttling or DOS prevention), or if Google - throttles requests to the site for abuse prevention. You - should not depend on externally-hosted images for - production applications. + images from + + 2. A publicly-accessible image HTTP/HTTPS URL. When fetching images from + HTTP/HTTPS URLs, Google cannot guarantee that the request will be + completed. Your request may fail if the specified host denies the + request (e.g. due to request throttling or DOS prevention), or if Google + throttles requests to the site for abuse prevention. You should not + depend on externally-hosted images for production applications. When both ``gcs_image_uri`` and ``image_uri`` are specified, ``image_uri`` takes precedence. @@ -242,13 +241,14 @@ class Image(proto.Message): Attributes: content (bytes): Image content, represented as a stream of bytes. Note: As - with all ``bytes`` fields, protobuffers use a pure binary - representation, whereas JSON representations use base64. + with all ``bytes`` fields, protobuffers use a pure + binary representation, whereas JSON representations use + base64. source (google.cloud.vision_v1p4beta1.types.ImageSource): Google Cloud Storage image location, or publicly-accessible - image URL. If both ``content`` and ``source`` are provided - for an image, ``content`` takes precedence and is used to - perform the image annotation request. + image URL. If both ``content`` and ``source`` are + provided for an image, ``content`` takes precedence and is + used to perform the image annotation request. """ content: bytes = proto.Field( @@ -273,16 +273,16 @@ class FaceAnnotation(proto.Message): box is computed to "frame" the face in accordance with human expectations. It is based on the landmarker results. Note that one or more x and/or y coordinates may not be generated - in the ``BoundingPoly`` (the polygon will be unbounded) if - only a partial face appears in the image to be annotated. + in the ``BoundingPoly`` (the polygon will be unbounded) if only + a partial face appears in the image to be annotated. fd_bounding_poly (google.cloud.vision_v1p4beta1.types.BoundingPoly): - The ``fd_bounding_poly`` bounding polygon is tighter than - the ``boundingPoly``, and encloses only the skin part of the - face. Typically, it is used to eliminate the face from any - image analysis that detects the "amount of skin" visible in - an image. It is not based on the landmarker results, only on - the initial face detection, hence the fd (face detection) - prefix. + The ``fd_bounding_poly`` bounding polygon is tighter than the + ``boundingPoly``, and encloses only the skin part of the face. + Typically, it is used to eliminate the face from any image + analysis that detects the "amount of skin" visible in an + image. It is not based on the landmarker results, only on + the initial face detection, hence the fd (face + detection) prefix. landmarks (MutableSequence[google.cloud.vision_v1p4beta1.types.FaceAnnotation.Landmark]): Detected face landmarks. roll_angle (float): @@ -319,12 +319,9 @@ class FaceAnnotation(proto.Message): recognition_result (MutableSequence[google.cloud.vision_v1p4beta1.types.FaceRecognitionResult]): Additional recognition information. Only computed if image_context.face_recognition_params is provided, **and** a - match is found to a - [Celebrity][google.cloud.vision.v1p4beta1.Celebrity] in the - input - [CelebritySet][google.cloud.vision.v1p4beta1.CelebritySet]. - This field is sorted in order of decreasing confidence - values. + match is found to a `Celebrity `__ in the input + `CelebritySet `__. This field is sorted in order of decreasing + confidence values. """ class Landmark(proto.Message): @@ -588,9 +585,8 @@ class EntityAnnotation(proto.Message): Attributes: mid (str): - Opaque entity ID. Some IDs may be available in `Google - Knowledge Graph Search - API `__. + Opaque entity ID. Some IDs may be available in + `Google Knowledge Graph Search API `__. locale (str): The language code for the locale in which the entity textual ``description`` is expressed. @@ -600,9 +596,9 @@ class EntityAnnotation(proto.Message): score (float): Overall score of the result. Range [0, 1]. confidence (float): - **Deprecated. Use ``score`` instead.** The accuracy of the - entity detection in an image. For example, for an image in - which the "Eiffel Tower" entity is detected, this field + **Deprecated. Use ``score`` instead.** The accuracy of + the entity detection in an image. For example, for an image + in which the "Eiffel Tower" entity is detected, this field represents the confidence that there is a tower in the query image. Range [0, 1]. topicality (float): @@ -617,11 +613,11 @@ class EntityAnnotation(proto.Message): ``LABEL_DETECTION`` features. locations (MutableSequence[google.cloud.vision_v1p4beta1.types.LocationInfo]): The location information for the detected entity. Multiple - ``LocationInfo`` elements can be present because one - location may indicate the location of the scene in the - image, and another location may indicate the location of the - place where the image was taken. Location information is - usually present for landmarks. + ``LocationInfo`` elements can be present because one location + may indicate the location of the scene in the image, and + another location may indicate the location of the place + where the image was taken. Location information is usually + present for landmarks. properties (MutableSequence[google.cloud.vision_v1p4beta1.types.Property]): Some entities may have optional user-supplied ``Property`` (name/value) fields, such a score or string that qualifies @@ -861,7 +857,7 @@ class CropHint(proto.Message): coordinates of the bounding box are in the original image's scale. confidence (float): - Confidence of this being a salient region. Range [0, 1]. + Confidence of this being a salient region. Range [0, 1]. importance_fraction (float): Fraction of importance of this salient region with respect to the original image. @@ -968,13 +964,12 @@ class ImageContext(proto.Message): List of languages to use for TEXT_DETECTION. In most cases, an empty value yields the best results since it enables automatic language detection. For languages based on the - Latin alphabet, setting ``language_hints`` is not needed. In - rare cases, when the language of the text in the image is - known, setting a hint will help get better results (although - it will be a significant hindrance if the hint is wrong). - Text detection returns an error if one or more of the - specified languages is not one of the `supported - languages `__. + Latin alphabet, setting ``language_hints`` is not needed. In rare + cases, when the language of the text in the image is known, + setting a hint will help get better results (although it + will be a significant hindrance if the hint is wrong). Text + detection returns an error if one or more of the specified + languages is not one of the `supported languages `__. crop_hints_params (google.cloud.vision_v1p4beta1.types.CropHintsParams): Parameters for crop hints annotation request. face_recognition_params (google.cloud.vision_v1p4beta1.types.FaceRecognitionParams): @@ -1507,8 +1502,9 @@ class InputConfig(proto.Message): input from. content (bytes): File content, represented as a stream of bytes. Note: As - with all ``bytes`` fields, protobuffers use a pure binary - representation, whereas JSON representations use base64. + with all ``bytes`` fields, protobuffers use a pure + binary representation, whereas JSON representations use + base64. Currently, this field only works for BatchAnnotateFiles requests. It does not work for AsyncBatchAnnotateFiles @@ -1547,9 +1543,9 @@ class OutputConfig(proto.Message): 100]. If not specified, the default value is 20. For example, for one pdf file with 100 pages, 100 response - protos will be generated. If ``batch_size`` = 20, then 5 - json files each containing 20 response protos will be - written under the prefix ``gcs_destination``.\ ``uri``. + protos will be generated. If ``batch_size`` = 20, then 5 json + files each containing 20 response protos will be written + under the prefix ``gcs_destination``.``uri``. Currently, batch_size only applies to GcsDestination, with potential future support for other output configurations. @@ -1599,16 +1595,18 @@ class GcsDestination(proto.Message): Examples: - - File Prefix: gs://bucket-name/here/filenameprefix The - output files will be created in gs://bucket-name/here/ and - the names of the output files will begin with - "filenameprefix". + * File Prefix: gs://bucket-name/here/filenameprefix The + output files + + will be created in gs://bucket-name/here/ and the names of + the output files will begin with "filenameprefix". + + * Directory Prefix: gs://bucket-name/some/location/ The + output files - - Directory Prefix: gs://bucket-name/some/location/ The - output files will be created in - gs://bucket-name/some/location/ and the names of the - output files could be anything because there was no - filename prefix specified. + will be created in gs://bucket-name/some/location/ and the + names of the output files could be anything because there + was no filename prefix specified. If multiple outputs, each response is still AnnotateFileResponse, each of which contains some subset of diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/product_search.py b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/product_search.py index 1d5fb1d412b1..4e8a4aef9ad8 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/product_search.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/product_search.py @@ -40,12 +40,10 @@ class ProductSearchParams(proto.Message): interest in the image. If it is not specified, system discretion will be applied. product_set (str): - The resource name of a - [ProductSet][google.cloud.vision.v1p4beta1.ProductSet] to be - searched for similar images. + The resource name of a `ProductSet `__ to be searched for + similar images. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID``. + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID``. product_categories (MutableSequence[str]): The list of product categories to search in. Currently, we only consider the first category, diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/product_search_service.py b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/product_search_service.py index e2d1875066cc..e4e5bf138b98 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/product_search_service.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/product_search_service.py @@ -69,8 +69,7 @@ class Product(proto.Message): name (str): The resource name of the product. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. This field is ignored when creating a product. display_name (str): @@ -159,8 +158,7 @@ class ProductSet(proto.Message): name (str): The resource name of the ProductSet. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID``. + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID``. This field is ignored when creating a ProductSet. display_name (str): @@ -207,8 +205,8 @@ class ProductSet(proto.Message): class ReferenceImage(proto.Message): - r"""A ``ReferenceImage`` represents a product image and its associated - metadata, such as bounding boxes. + r"""A ``ReferenceImage`` represents a product image and its + associated metadata, such as bounding boxes. Attributes: name (str): @@ -265,11 +263,12 @@ class CreateProductRequest(proto.Message): product (google.cloud.vision_v1p4beta1.types.Product): Required. The product to create. product_id (str): - A user-supplied resource id for this Product. If set, the - server will attempt to use this value as the resource id. If - it is already in use, an error is returned with code - ALREADY_EXISTS. Must be at most 128 characters long. It - cannot contain the character ``/``. + A user-supplied resource id for this Product. If set, + the server will attempt to use this value as the + resource id. If it is already in use, an error is + returned with code ALREADY_EXISTS. Must be at most 128 + characters long. It cannot contain the character + ``/``. """ parent: str = proto.Field( @@ -352,8 +351,7 @@ class GetProductRequest(proto.Message): name (str): Required. Resource name of the Product to get. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ name: str = proto.Field( @@ -371,10 +369,10 @@ class UpdateProductRequest(proto.Message): the one on the server. product.name is immutable. update_mask (google.protobuf.field_mask_pb2.FieldMask): - The [FieldMask][google.protobuf.FieldMask] that specifies - which fields to update. If update_mask isn't specified, all - mutable fields are to be updated. Valid mask paths include - ``product_labels``, ``display_name``, and ``description``. + The `FieldMask `__ that specifies which fields to update. + If update_mask isn't specified, all mutable fields are + to be updated. Valid mask paths include ``product_labels``, + ``display_name``, and ``description``. """ product: "Product" = proto.Field( @@ -396,8 +394,7 @@ class DeleteProductRequest(proto.Message): name (str): Required. Resource name of product to delete. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ name: str = proto.Field( @@ -418,11 +415,12 @@ class CreateProductSetRequest(proto.Message): product_set (google.cloud.vision_v1p4beta1.types.ProductSet): Required. The ProductSet to create. product_set_id (str): - A user-supplied resource id for this ProductSet. If set, the - server will attempt to use this value as the resource id. If - it is already in use, an error is returned with code - ALREADY_EXISTS. Must be at most 128 characters long. It - cannot contain the character ``/``. + A user-supplied resource id for this ProductSet. If set, + the server will attempt to use this value as the + resource id. If it is already in use, an error is + returned with code ALREADY_EXISTS. Must be at most 128 + characters long. It cannot contain the character + ``/``. """ parent: str = proto.Field( @@ -505,8 +503,7 @@ class GetProductSetRequest(proto.Message): name (str): Required. Resource name of the ProductSet to get. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` """ name: str = proto.Field( @@ -523,10 +520,9 @@ class UpdateProductSetRequest(proto.Message): Required. The ProductSet resource which replaces the one on the server. update_mask (google.protobuf.field_mask_pb2.FieldMask): - The [FieldMask][google.protobuf.FieldMask] that specifies - which fields to update. If update_mask isn't specified, all - mutable fields are to be updated. Valid mask path is - ``display_name``. + The `FieldMask `__ that specifies which fields to update. + If update_mask isn't specified, all mutable fields are + to be updated. Valid mask path is ``display_name``. """ product_set: "ProductSet" = proto.Field( @@ -548,8 +544,7 @@ class DeleteProductSetRequest(proto.Message): name (str): Required. Resource name of the ProductSet to delete. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` """ name: str = proto.Field( @@ -563,20 +558,20 @@ class CreateReferenceImageRequest(proto.Message): Attributes: parent (str): - Required. Resource name of the product in which to create - the reference image. + Required. Resource name of the product in which to + create the reference image. - Format is - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. reference_image (google.cloud.vision_v1p4beta1.types.ReferenceImage): Required. The reference image to create. If an image ID is specified, it is ignored. reference_image_id (str): A user-supplied resource id for the ReferenceImage to be - added. If set, the server will attempt to use this value as - the resource id. If it is already in use, an error is + added. If set, the server will attempt to use this value + as the resource id. If it is already in use, an error is returned with code ALREADY_EXISTS. Must be at most 128 - characters long. It cannot contain the character ``/``. + characters long. It cannot contain the character + ``/``. """ parent: str = proto.Field( @@ -602,8 +597,7 @@ class ListReferenceImagesRequest(proto.Message): Required. Resource name of the product containing the reference images. - Format is - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. + Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``. page_size (int): The maximum number of items to return. Default 10, maximum 100. @@ -667,7 +661,8 @@ class GetReferenceImageRequest(proto.Message): Attributes: name (str): - Required. The resource name of the ReferenceImage to get. + Required. The resource name of the ReferenceImage to + get. Format is: @@ -704,16 +699,15 @@ class AddProductToProductSetRequest(proto.Message): Attributes: name (str): - Required. The resource name for the ProductSet to modify. + Required. The resource name for the ProductSet to + modify. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` product (str): - Required. The resource name for the Product to be added to - this ProductSet. + Required. The resource name for the Product to be added + to this ProductSet. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ name: str = proto.Field( @@ -731,16 +725,15 @@ class RemoveProductFromProductSetRequest(proto.Message): Attributes: name (str): - Required. The resource name for the ProductSet to modify. + Required. The resource name for the ProductSet to + modify. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` product (str): - Required. The resource name for the Product to be removed - from this ProductSet. + Required. The resource name for the Product to be + removed from this ProductSet. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID`` """ name: str = proto.Field( @@ -761,8 +754,7 @@ class ListProductsInProductSetRequest(proto.Message): Required. The ProductSet resource for which to retrieve Products. - Format is: - ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` + Format is: ``projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`` page_size (int): The maximum number of items to return. Default 10, maximum 100. @@ -825,63 +817,62 @@ class ImportProductSetsGcsSource(proto.Message): The format of the input csv file should be one image per line. In each line, there are 8 columns. - 1. image-uri - 2. image-id - 3. product-set-id - 4. product-id - 5. product-category - 6. product-display-name - 7. labels - 8. bounding-poly + 1. image-uri + + 2. image-id + + 3. product-set-id + + 4. product-id + + 5. product-category + + 6. product-display-name + + 7. labels + + 8. bounding-poly The ``image-uri``, ``product-set-id``, ``product-id``, and - ``product-category`` columns are required. All other columns - are optional. + ``product-category`` columns are required. All other columns are + optional. If the ``ProductSet`` or ``Product`` specified by the - ``product-set-id`` and ``product-id`` values does not exist, - then the system will create a new ``ProductSet`` or - ``Product`` for the image. In this case, the - ``product-display-name`` column refers to - [display_name][google.cloud.vision.v1p4beta1.Product.display_name], - the ``product-category`` column refers to - [product_category][google.cloud.vision.v1p4beta1.Product.product_category], - and the ``labels`` column refers to - [product_labels][google.cloud.vision.v1p4beta1.Product.product_labels]. + ``product-set-id`` and ``product-id`` values does not exist, then + the system will create a new ``ProductSet`` or ``Product`` + for the image. In this case, the ``product-display-name`` column refers + to `display_name `__, the ``product-category`` column refers to + `product_category `__, and the ``labels`` column refers to + `product_labels `__. The ``image-id`` column is optional but must be unique if provided. If it is empty, the system will automatically assign a unique id to the image. - The ``product-display-name`` column is optional. If it is - empty, the system sets the - [display_name][google.cloud.vision.v1p4beta1.Product.display_name] - field for the product to a space (" "). You can update the - ``display_name`` later by using the API. + The ``product-display-name`` column is optional. If it is empty, the + system sets the `display_name `__ field for the product to a + space (" "). You can update the ``display_name`` later by using + the API. If a ``Product`` with the specified ``product-id`` already - exists, then the system ignores the - ``product-display-name``, ``product-category``, and - ``labels`` columns. - - The ``labels`` column (optional) is a line containing a list - of comma-separated key-value pairs, in the following format: + exists, then the system ignores the ``product-display-name``, + ``product-category``, and ``labels`` columns. - :: + The ``labels`` column (optional) is a line containing a + list of comma-separated key-value pairs, in the following + format: - "key_1=value_1,key_2=value_2,...,key_n=value_n" + "key_1=value_1,key_2=value_2,...,key_n=value_n" - The ``bounding-poly`` column (optional) identifies one - region of interest from the image in the same manner as - ``CreateReferenceImage``. If you do not specify the - ``bounding-poly`` column, then the system will try to detect - regions of interest automatically. + The ``bounding-poly`` column (optional) identifies one region of + interest from the image in the same manner as ``CreateReferenceImage``. + If you do not specify the ``bounding-poly`` column, then the + system will try to detect regions of interest automatically. - At most one ``bounding-poly`` column is allowed per line. If - the image contains multiple regions of interest, add a line - to the CSV file that includes the same product information, - and the ``bounding-poly`` values for each region of - interest. + At most one ``bounding-poly`` column is allowed per line. If the + image contains multiple regions of interest, add a line to + the CSV file that includes the same product information, and + the ``bounding-poly`` values for each region of interest. The ``bounding-poly`` column must contain an even number of comma-separated numbers, in the format @@ -949,11 +940,8 @@ class ImportProductSetsRequest(proto.Message): class ImportProductSetsResponse(proto.Message): r"""Response message for the ``ImportProductSets`` method. - This message is returned by the - [google.longrunning.Operations.GetOperation][google.longrunning.Operations.GetOperation] - method in the returned - [google.longrunning.Operation.response][google.longrunning.Operation.response] - field. + This message is returned by the `google.longrunning.Operations.GetOperation `__ method in the returned + `google.longrunning.Operation.response `__ field. Attributes: reference_images (MutableSequence[google.cloud.vision_v1p4beta1.types.ReferenceImage]): @@ -984,8 +972,7 @@ class BatchOperationMetadata(proto.Message): r"""Metadata for the batch operations such as the current state. This is included in the ``metadata`` field of the ``Operation`` - returned by the ``GetOperation`` call of the - ``google::longrunning::Operations`` service. + returned by the ``GetOperation`` call of the ``google::longrunning::Operations`` service. Attributes: state (google.cloud.vision_v1p4beta1.types.BatchOperationMetadata.State): @@ -995,8 +982,7 @@ class BatchOperationMetadata(proto.Message): to the server. end_time (google.protobuf.timestamp_pb2.Timestamp): The time when the batch request is finished and - [google.longrunning.Operation.done][google.longrunning.Operation.done] - is set to true. + `google.longrunning.Operation.done `__ is set to true. """ class State(proto.Enum): diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/text_annotation.py b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/text_annotation.py index 8ff74951cbad..4d3134cc3205 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/text_annotation.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/text_annotation.py @@ -37,12 +37,18 @@ class TextAnnotation(proto.Message): r"""TextAnnotation contains a structured representation of OCR extracted text. The hierarchy of an OCR extracted text structure is like this: + + TextAnnotation contains a structured representation of OCR extracted text. + The hierarchy of an OCR extracted text structure is like this: + TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol + + TextAnnotation contains a structured representation of OCR extracted + text. The hierarchy of an OCR extracted text structure is like this: TextAnnotation -> Page -> Block -> Paragraph -> Word -> Symbol Each structural component, starting from Page, may further have their own properties. Properties describe detected languages, breaks etc.. - Please refer to the - [TextAnnotation.TextProperty][google.cloud.vision.v1p4beta1.TextAnnotation.TextProperty] - message definition below for more detail. + Please refer to the `TextAnnotation.TextProperty `__ message definition below for more + detail. Attributes: pages (MutableSequence[google.cloud.vision_v1p4beta1.types.Page]): @@ -210,24 +216,20 @@ class Block(proto.Message): is represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example: - - when the text is horizontal it might look like: + * when the text is horizontal it might look like: - :: + 0----1 + | | + 3----2 - 0----1 - | | - 3----2 - - - when it's rotated 180 degrees around the top-left corner + * when it's rotated 180 degrees around the top-left corner it becomes: - :: - - 2----3 - | | - 1----0 + 2----3 + | | + 1----0 - and the vertex order will still be (0, 1, 2, 3). + and the vertex order will still be (0, 1, 2, 3). paragraphs (MutableSequence[google.cloud.vision_v1p4beta1.types.Paragraph]): List of paragraphs in this block (if this blocks is of type text). @@ -303,11 +305,24 @@ class Paragraph(proto.Message): is represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example: - - when the text is horizontal it might look like: 0----1 \| - \| 3----2 - - when it's rotated 180 degrees around the top-left corner - it becomes: 2----3 \| \| 1----0 and the vertex order will - still be (0, 1, 2, 3). + * when the text is horizontal it might look like: + + * when the text is horizontal it might look like: + 0----1 + | | + 3----2 + + * when it's rotated 180 degrees around the top-left corner + it becomes: + + * when it's rotated 180 degrees around the top-left corner it becomes: + 2----3 + | | + 1----0 + + * when it's rotated 180 degrees around the top-left corner + it becomes: 2----3 | | 1----0 and the vertex order will + still be (0, 1, 2, 3). words (MutableSequence[google.cloud.vision_v1p4beta1.types.Word]): List of all words in this paragraph. confidence (float): @@ -349,11 +364,24 @@ class Word(proto.Message): represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example: - - when the text is horizontal it might look like: 0----1 \| - \| 3----2 - - when it's rotated 180 degrees around the top-left corner - it becomes: 2----3 \| \| 1----0 and the vertex order will - still be (0, 1, 2, 3). + * when the text is horizontal it might look like: + + * when the text is horizontal it might look like: + 0----1 + | | + 3----2 + + * when it's rotated 180 degrees around the top-left corner + it becomes: + + * when it's rotated 180 degrees around the top-left corner it becomes: + 2----3 + | | + 1----0 + + * when it's rotated 180 degrees around the top-left corner + it becomes: 2----3 | | 1----0 and the vertex order will + still be (0, 1, 2, 3). symbols (MutableSequence[google.cloud.vision_v1p4beta1.types.Symbol]): List of symbols in the word. The order of the symbols follows the natural @@ -397,11 +425,24 @@ class Symbol(proto.Message): is represented as around the top-left corner as defined when the text is read in the 'natural' orientation. For example: - - when the text is horizontal it might look like: 0----1 \| - \| 3----2 - - when it's rotated 180 degrees around the top-left corner - it becomes: 2----3 \| \| 1----0 and the vertex order will - still be (0, 1, 2, 3). + * when the text is horizontal it might look like: + + * when the text is horizontal it might look like: + 0----1 + | | + 3----2 + + * when it's rotated 180 degrees around the top-left corner + it becomes: + + * when it's rotated 180 degrees around the top-left corner it becomes: + 2----3 + | | + 1----0 + + * when it's rotated 180 degrees around the top-left corner + it becomes: 2----3 | | 1----0 and the vertex order will + still be (0, 1, 2, 3). text (str): The actual UTF-8 representation of the symbol. diff --git a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/web_detection.py b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/web_detection.py index 3bfadec02406..97298e71619f 100644 --- a/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/web_detection.py +++ b/packages/google-cloud-vision/google/cloud/vision_v1p4beta1/types/web_detection.py @@ -159,8 +159,8 @@ class WebLabel(proto.Message): label (str): Label for extra metadata. language_code (str): - The BCP-47 language code for ``label``, such as "en-US" or - "sr-Latn". For more information, see + The BCP-47 language code for ``label``, such as "en-US" + or "sr-Latn". For more information, see http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. """ diff --git a/packages/google-cloud-vision/mypy.ini b/packages/google-cloud-vision/mypy.ini index 574c5aed394b..a3cb5c292172 100644 --- a/packages/google-cloud-vision/mypy.ini +++ b/packages/google-cloud-vision/mypy.ini @@ -1,3 +1,3 @@ [mypy] -python_version = 3.7 +python_version = 3.14 namespace_packages = True