Skip to content
This repository was archived by the owner on Feb 13, 2024. It is now read-only.

Commit e8d00a5

Browse files
Integrate Python GAPIC Microgenerator in googleapis. This PR uses using documentai as an example. Depends on googleapis/gapic-generator-python#402
PiperOrigin-RevId: 309824146 Source-Author: Google APIs <[email protected]> Source-Date: Mon May 4 15:06:44 2020 -0700 Source-Repo: googleapis/googleapis Source-Sha: e0f9d9e1f9de890db765be46f45ca8490723e3eb Source-Link: googleapis/googleapis@e0f9d9e
1 parent b33fa88 commit e8d00a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+5461
-5158
lines changed

google/cloud/vision_v1/gapic/enums.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ class Type(enum.IntEnum):
181181
LANDMARK_DETECTION (int): Run landmark detection.
182182
LOGO_DETECTION (int): Run logo detection.
183183
LABEL_DETECTION (int): Run label detection.
184-
TEXT_DETECTION (int): Run text detection / optical character recognition (OCR). Text detection
185-
is optimized for areas of text within a larger image; if the image is a
186-
document, use ``DOCUMENT_TEXT_DETECTION`` instead.
184+
TEXT_DETECTION (int): Run text detection / optical character recognition (OCR). Text
185+
detection is optimized for areas of text within a larger image; if the
186+
image is a document, use ``DOCUMENT_TEXT_DETECTION`` instead.
187187
DOCUMENT_TEXT_DETECTION (int): Run dense text document OCR. Takes precedence when both
188188
``DOCUMENT_TEXT_DETECTION`` and ``TEXT_DETECTION`` are present.
189189
SAFE_SEARCH_DETECTION (int): Run Safe Search to detect potentially unsafe

google/cloud/vision_v1/gapic/image_annotator_client.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@ def async_batch_annotate_images(
381381
metadata=None,
382382
):
383383
"""
384-
Run asynchronous image detection and annotation for a list of images.
384+
Run asynchronous image detection and annotation for a list of
385+
images.
385386
386387
Progress and results can be retrieved through the
387388
``google.longrunning.Operations`` interface. ``Operation.metadata``
@@ -500,10 +501,10 @@ def async_batch_annotate_files(
500501
metadata=None,
501502
):
502503
"""
503-
Run asynchronous image detection and annotation for a list of generic
504-
files, such as PDF files, which may contain multiple pages and multiple
505-
images per page. Progress and results can be retrieved through the
506-
``google.longrunning.Operations`` interface. ``Operation.metadata``
504+
Run asynchronous image detection and annotation for a list of
505+
generic files, such as PDF files, which may contain multiple pages and
506+
multiple images per page. Progress and results can be retrieved through
507+
the ``google.longrunning.Operations`` interface. ``Operation.metadata``
507508
contains ``OperationMetadata`` (metadata). ``Operation.response``
508509
contains ``AsyncBatchAnnotateFilesResponse`` (results).
509510

google/cloud/vision_v1/gapic/product_search_client.py

Lines changed: 58 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949

5050
class ProductSearchClient(object):
5151
"""
52-
Manages Products and ProductSets of reference images for use in product
53-
search. It uses the following resource model:
52+
Manages Products and ProductSets of reference images for use in
53+
product search. It uses the following resource model:
5454
5555
- The API has a collection of ``ProductSet`` resources, named
5656
``projects/*/locations/*/productSets/*``, which acts as a way to put
@@ -259,7 +259,7 @@ def create_product_set(
259259
260260
Possible errors:
261261
262-
- Returns INVALID\_ARGUMENT if display\_name is missing, or is longer
262+
- Returns INVALID_ARGUMENT if display_name is missing, or is longer
263263
than 4096 characters.
264264
265265
Example:
@@ -282,9 +282,9 @@ def create_product_set(
282282
283283
If a dict is provided, it must be of the same form as the protobuf
284284
message :class:`~google.cloud.vision_v1.types.ProductSet`
285-
product_set_id (str): A user-supplied resource id for this ProductSet. If set, the server will
286-
attempt to use this value as the resource id. If it is already in use,
287-
an error is returned with code ALREADY\_EXISTS. Must be at most 128
285+
product_set_id (str): A user-supplied resource id for this ProductSet. If set, the server
286+
will attempt to use this value as the resource id. If it is already in
287+
use, an error is returned with code ALREADY_EXISTS. Must be at most 128
288288
characters long. It cannot contain the character ``/``.
289289
retry (Optional[google.api_core.retry.Retry]): A retry object used
290290
to retry requests. If ``None`` is specified, requests will
@@ -349,7 +349,7 @@ def list_product_sets(
349349
350350
Possible errors:
351351
352-
- Returns INVALID\_ARGUMENT if page\_size is greater than 100, or less
352+
- Returns INVALID_ARGUMENT if page_size is greater than 100, or less
353353
than 1.
354354
355355
Example:
@@ -458,7 +458,7 @@ def get_product_set(
458458
459459
Possible errors:
460460
461-
- Returns NOT\_FOUND if the ProductSet does not exist.
461+
- Returns NOT_FOUND if the ProductSet does not exist.
462462
463463
Example:
464464
>>> from google.cloud import vision_v1
@@ -531,13 +531,13 @@ def update_product_set(
531531
metadata=None,
532532
):
533533
"""
534-
Makes changes to a ProductSet resource. Only display\_name can be
534+
Makes changes to a ProductSet resource. Only display_name can be
535535
updated currently.
536536
537537
Possible errors:
538538
539-
- Returns NOT\_FOUND if the ProductSet does not exist.
540-
- Returns INVALID\_ARGUMENT if display\_name is present in update\_mask
539+
- Returns NOT_FOUND if the ProductSet does not exist.
540+
- Returns INVALID_ARGUMENT if display_name is present in update_mask
541541
but missing from the request or longer than 4096 characters.
542542
543543
Example:
@@ -555,9 +555,9 @@ def update_product_set(
555555
556556
If a dict is provided, it must be of the same form as the protobuf
557557
message :class:`~google.cloud.vision_v1.types.ProductSet`
558-
update_mask (Union[dict, ~google.cloud.vision_v1.types.FieldMask]): The ``FieldMask`` that specifies which fields to update. If update\_mask
559-
isn't specified, all mutable fields are to be updated. Valid mask path
560-
is ``display_name``.
558+
update_mask (Union[dict, ~google.cloud.vision_v1.types.FieldMask]): The ``FieldMask`` that specifies which fields to update. If
559+
update_mask isn't specified, all mutable fields are to be updated. Valid
560+
mask path is ``display_name``.
561561
562562
If a dict is provided, it must be of the same form as the protobuf
563563
message :class:`~google.cloud.vision_v1.types.FieldMask`
@@ -697,11 +697,11 @@ def create_product(
697697
698698
Possible errors:
699699
700-
- Returns INVALID\_ARGUMENT if display\_name is missing or longer than
700+
- Returns INVALID_ARGUMENT if display_name is missing or longer than
701701
4096 characters.
702-
- Returns INVALID\_ARGUMENT if description is longer than 4096
702+
- Returns INVALID_ARGUMENT if description is longer than 4096
703703
characters.
704-
- Returns INVALID\_ARGUMENT if product\_category is missing or invalid.
704+
- Returns INVALID_ARGUMENT if product_category is missing or invalid.
705705
706706
Example:
707707
>>> from google.cloud import vision_v1
@@ -723,9 +723,9 @@ def create_product(
723723
724724
If a dict is provided, it must be of the same form as the protobuf
725725
message :class:`~google.cloud.vision_v1.types.Product`
726-
product_id (str): A user-supplied resource id for this Product. If set, the server will
727-
attempt to use this value as the resource id. If it is already in use,
728-
an error is returned with code ALREADY\_EXISTS. Must be at most 128
726+
product_id (str): A user-supplied resource id for this Product. If set, the server
727+
will attempt to use this value as the resource id. If it is already in
728+
use, an error is returned with code ALREADY_EXISTS. Must be at most 128
729729
characters long. It cannot contain the character ``/``.
730730
retry (Optional[google.api_core.retry.Retry]): A retry object used
731731
to retry requests. If ``None`` is specified, requests will
@@ -790,7 +790,7 @@ def list_products(
790790
791791
Possible errors:
792792
793-
- Returns INVALID\_ARGUMENT if page\_size is greater than 100 or less
793+
- Returns INVALID_ARGUMENT if page_size is greater than 100 or less
794794
than 1.
795795
796796
Example:
@@ -900,7 +900,7 @@ def get_product(
900900
901901
Possible errors:
902902
903-
- Returns NOT\_FOUND if the Product does not exist.
903+
- Returns NOT_FOUND if the Product does not exist.
904904
905905
Example:
906906
>>> from google.cloud import vision_v1
@@ -980,13 +980,13 @@ def update_product(
980980
981981
Possible errors:
982982
983-
- Returns NOT\_FOUND if the Product does not exist.
984-
- Returns INVALID\_ARGUMENT if display\_name is present in update\_mask
983+
- Returns NOT_FOUND if the Product does not exist.
984+
- Returns INVALID_ARGUMENT if display_name is present in update_mask
985985
but is missing from the request or longer than 4096 characters.
986-
- Returns INVALID\_ARGUMENT if description is present in update\_mask
987-
but is longer than 4096 characters.
988-
- Returns INVALID\_ARGUMENT if product\_category is present in
989-
update\_mask.
986+
- Returns INVALID_ARGUMENT if description is present in update_mask but
987+
is longer than 4096 characters.
988+
- Returns INVALID_ARGUMENT if product_category is present in
989+
update_mask.
990990
991991
Example:
992992
>>> from google.cloud import vision_v1
@@ -1004,9 +1004,10 @@ def update_product(
10041004
10051005
If a dict is provided, it must be of the same form as the protobuf
10061006
message :class:`~google.cloud.vision_v1.types.Product`
1007-
update_mask (Union[dict, ~google.cloud.vision_v1.types.FieldMask]): The ``FieldMask`` that specifies which fields to update. If update\_mask
1008-
isn't specified, all mutable fields are to be updated. Valid mask paths
1009-
include ``product_labels``, ``display_name``, and ``description``.
1007+
update_mask (Union[dict, ~google.cloud.vision_v1.types.FieldMask]): The ``FieldMask`` that specifies which fields to update. If
1008+
update_mask isn't specified, all mutable fields are to be updated. Valid
1009+
mask paths include ``product_labels``, ``display_name``, and
1010+
``description``.
10101011
10111012
If a dict is provided, it must be of the same form as the protobuf
10121013
message :class:`~google.cloud.vision_v1.types.FieldMask`
@@ -1146,7 +1147,7 @@ def create_reference_image(
11461147
11471148
The ``bounding_poly`` field is optional. If ``bounding_poly`` is not
11481149
specified, the system will try to detect regions of interest in the
1149-
image that are compatible with the product\_category on the parent
1150+
image that are compatible with the product_category on the parent
11501151
product. If it is specified, detection is ALWAYS skipped. The system
11511152
converts polygons into non-rotated rectangles.
11521153
@@ -1155,13 +1156,13 @@ def create_reference_image(
11551156
11561157
Possible errors:
11571158
1158-
- Returns INVALID\_ARGUMENT if the image\_uri is missing or longer than
1159+
- Returns INVALID_ARGUMENT if the image_uri is missing or longer than
11591160
4096 characters.
1160-
- Returns INVALID\_ARGUMENT if the product does not exist.
1161-
- Returns INVALID\_ARGUMENT if bounding\_poly is not provided, and
1162-
nothing compatible with the parent product's product\_category is
1161+
- Returns INVALID_ARGUMENT if the product does not exist.
1162+
- Returns INVALID_ARGUMENT if bounding_poly is not provided, and
1163+
nothing compatible with the parent product's product_category is
11631164
detected.
1164-
- Returns INVALID\_ARGUMENT if bounding\_poly contains more than 10
1165+
- Returns INVALID_ARGUMENT if bounding_poly contains more than 10
11651166
polygons.
11661167
11671168
Example:
@@ -1177,19 +1178,19 @@ def create_reference_image(
11771178
>>> response = client.create_reference_image(parent, reference_image)
11781179
11791180
Args:
1180-
parent (str): Required. Resource name of the product in which to create the reference
1181-
image.
1181+
parent (str): Required. Resource name of the product in which to create the
1182+
reference image.
11821183
11831184
Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``.
11841185
reference_image (Union[dict, ~google.cloud.vision_v1.types.ReferenceImage]): Required. The reference image to create.
11851186
If an image ID is specified, it is ignored.
11861187
11871188
If a dict is provided, it must be of the same form as the protobuf
11881189
message :class:`~google.cloud.vision_v1.types.ReferenceImage`
1189-
reference_image_id (str): A user-supplied resource id for the ReferenceImage to be added. If set,
1190-
the server will attempt to use this value as the resource id. If it is
1191-
already in use, an error is returned with code ALREADY\_EXISTS. Must be
1192-
at most 128 characters long. It cannot contain the character ``/``.
1190+
reference_image_id (str): A user-supplied resource id for the ReferenceImage to be added. If
1191+
set, the server will attempt to use this value as the resource id. If it
1192+
is already in use, an error is returned with code ALREADY_EXISTS. Must
1193+
be at most 128 characters long. It cannot contain the character ``/``.
11931194
retry (Optional[google.api_core.retry.Retry]): A retry object used
11941195
to retry requests. If ``None`` is specified, requests will
11951196
be retried using a default configuration.
@@ -1331,8 +1332,8 @@ def list_reference_images(
13311332
13321333
Possible errors:
13331334
1334-
- Returns NOT\_FOUND if the parent product does not exist.
1335-
- Returns INVALID\_ARGUMENT if the page\_size is greater than 100, or
1335+
- Returns NOT_FOUND if the parent product does not exist.
1336+
- Returns INVALID_ARGUMENT if the page_size is greater than 100, or
13361337
less than 1.
13371338
13381339
Example:
@@ -1357,7 +1358,8 @@ def list_reference_images(
13571358
... pass
13581359
13591360
Args:
1360-
parent (str): Required. Resource name of the product containing the reference images.
1361+
parent (str): Required. Resource name of the product containing the reference
1362+
images.
13611363
13621364
Format is ``projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID``.
13631365
page_size (int): The maximum number of resources contained in the
@@ -1441,7 +1443,7 @@ def get_reference_image(
14411443
14421444
Possible errors:
14431445
1444-
- Returns NOT\_FOUND if the specified image does not exist.
1446+
- Returns NOT_FOUND if the specified image does not exist.
14451447
14461448
Example:
14471449
>>> from google.cloud import vision_v1
@@ -1515,14 +1517,14 @@ def add_product_to_product_set(
15151517
metadata=None,
15161518
):
15171519
"""
1518-
Adds a Product to the specified ProductSet. If the Product is already
1519-
present, no change is made.
1520+
Adds a Product to the specified ProductSet. If the Product is
1521+
already present, no change is made.
15201522
15211523
One Product can be added to at most 100 ProductSets.
15221524
15231525
Possible errors:
15241526
1525-
- Returns NOT\_FOUND if the Product or the ProductSet doesn't exist.
1527+
- Returns NOT_FOUND if the Product or the ProductSet doesn't exist.
15261528
15271529
Example:
15281530
>>> from google.cloud import vision_v1
@@ -1684,7 +1686,7 @@ def list_products_in_product_set(
16841686
16851687
Possible errors:
16861688
1687-
- Returns INVALID\_ARGUMENT if page\_size is greater than 100 or less
1689+
- Returns INVALID_ARGUMENT if page_size is greater than 100 or less
16881690
than 1.
16891691
16901692
Example:
@@ -1793,8 +1795,8 @@ def import_product_sets(
17931795
metadata=None,
17941796
):
17951797
"""
1796-
Asynchronous API that imports a list of reference images to specified
1797-
product sets based on a list of image information.
1798+
Asynchronous API that imports a list of reference images to
1799+
specified product sets based on a list of image information.
17981800
17991801
The ``google.longrunning.Operation`` API can be used to keep track of
18001802
the progress and results of the request. ``Operation.metadata`` contains
@@ -1901,8 +1903,8 @@ def purge_products(
19011903
metadata=None,
19021904
):
19031905
"""
1904-
Asynchronous API to delete all Products in a ProductSet or all Products
1905-
that are in no ProductSet.
1906+
Asynchronous API to delete all Products in a ProductSet or all
1907+
Products that are in no ProductSet.
19061908
19071909
If a Product is a member of the specified ProductSet in addition to
19081910
other ProductSets, the Product will still be deleted.
@@ -1953,7 +1955,7 @@ def purge_products(
19531955
19541956
If a dict is provided, it must be of the same form as the protobuf
19551957
message :class:`~google.cloud.vision_v1.types.ProductSetPurgeConfig`
1956-
delete_orphan_products (bool): If delete\_orphan\_products is true, all Products that are not in any
1958+
delete_orphan_products (bool): If delete_orphan_products is true, all Products that are not in any
19571959
ProductSet will be deleted.
19581960
force (bool): The default value is false. Override this value to true to actually perform
19591961
the purge.

google/cloud/vision_v1/gapic/transports/image_annotator_grpc_transport.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ def batch_annotate_files(self):
154154
def async_batch_annotate_images(self):
155155
"""Return the gRPC stub for :meth:`ImageAnnotatorClient.async_batch_annotate_images`.
156156
157-
Run asynchronous image detection and annotation for a list of images.
157+
Run asynchronous image detection and annotation for a list of
158+
images.
158159
159160
Progress and results can be retrieved through the
160161
``google.longrunning.Operations`` interface. ``Operation.metadata``
@@ -176,10 +177,10 @@ def async_batch_annotate_images(self):
176177
def async_batch_annotate_files(self):
177178
"""Return the gRPC stub for :meth:`ImageAnnotatorClient.async_batch_annotate_files`.
178179
179-
Run asynchronous image detection and annotation for a list of generic
180-
files, such as PDF files, which may contain multiple pages and multiple
181-
images per page. Progress and results can be retrieved through the
182-
``google.longrunning.Operations`` interface. ``Operation.metadata``
180+
Run asynchronous image detection and annotation for a list of
181+
generic files, such as PDF files, which may contain multiple pages and
182+
multiple images per page. Progress and results can be retrieved through
183+
the ``google.longrunning.Operations`` interface. ``Operation.metadata``
183184
contains ``OperationMetadata`` (metadata). ``Operation.response``
184185
contains ``AsyncBatchAnnotateFilesResponse`` (results).
185186

0 commit comments

Comments
 (0)