Skip to content

Commit 77e3cbf

Browse files
docs: Add documentation for enums (#448)
* docs: Add documentation for enums fix: Add context manager return types chore: Update gapic-generator-python to v1.8.1 PiperOrigin-RevId: 503210727 Source-Link: googleapis/googleapis@a391fd1 Source-Link: googleapis/googleapis-gen@0080f83 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDA4MGY4MzBkZWMzN2MzMzg0MTU3MDgyYmNlMjc5ZTM3MDc5ZWE1OCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent a4b6d4d commit 77e3cbf

File tree

19 files changed

+604
-32
lines changed

19 files changed

+604
-32
lines changed

packages/google-cloud-documentai/google/cloud/documentai_v1/services/document_processor_service/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2623,7 +2623,7 @@ def sample_review_document():
26232623
# Done; return the response.
26242624
return response
26252625

2626-
def __enter__(self):
2626+
def __enter__(self) -> "DocumentProcessorServiceClient":
26272627
return self
26282628

26292629
def __exit__(self, type, value, traceback):

packages/google-cloud-documentai/google/cloud/documentai_v1/types/document.py

Lines changed: 86 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,25 @@ class Layout(proto.Message):
396396
"""
397397

398398
class Orientation(proto.Enum):
399-
r"""Detected human reading orientation."""
399+
r"""Detected human reading orientation.
400+
401+
Values:
402+
ORIENTATION_UNSPECIFIED (0):
403+
Unspecified orientation.
404+
PAGE_UP (1):
405+
Orientation is aligned with page up.
406+
PAGE_RIGHT (2):
407+
Orientation is aligned with page right.
408+
Turn the head 90 degrees clockwise from upright
409+
to read.
410+
PAGE_DOWN (3):
411+
Orientation is aligned with page down.
412+
Turn the head 180 degrees from upright to read.
413+
PAGE_LEFT (4):
414+
Orientation is aligned with page left.
415+
Turn the head 90 degrees counterclockwise from
416+
upright to read.
417+
"""
400418
ORIENTATION_UNSPECIFIED = 0
401419
PAGE_UP = 1
402420
PAGE_RIGHT = 2
@@ -551,7 +569,19 @@ class DetectedBreak(proto.Message):
551569
"""
552570

553571
class Type(proto.Enum):
554-
r"""Enum to denote the type of break found."""
572+
r"""Enum to denote the type of break found.
573+
574+
Values:
575+
TYPE_UNSPECIFIED (0):
576+
Unspecified break type.
577+
SPACE (1):
578+
A single whitespace.
579+
WIDE_SPACE (2):
580+
A wider whitespace.
581+
HYPHEN (3):
582+
A hyphen that indicates that a token has been
583+
split across lines.
584+
"""
555585
TYPE_UNSPECIFIED = 0
556586
SPACE = 1
557587
WIDE_SPACE = 2
@@ -1344,7 +1374,40 @@ class PageRef(proto.Message):
13441374
"""
13451375

13461376
class LayoutType(proto.Enum):
1347-
r"""The type of layout that is being referenced."""
1377+
r"""The type of layout that is being referenced.
1378+
1379+
Values:
1380+
LAYOUT_TYPE_UNSPECIFIED (0):
1381+
Layout Unspecified.
1382+
BLOCK (1):
1383+
References a
1384+
[Page.blocks][google.cloud.documentai.v1.Document.Page.blocks]
1385+
element.
1386+
PARAGRAPH (2):
1387+
References a
1388+
[Page.paragraphs][google.cloud.documentai.v1.Document.Page.paragraphs]
1389+
element.
1390+
LINE (3):
1391+
References a
1392+
[Page.lines][google.cloud.documentai.v1.Document.Page.lines]
1393+
element.
1394+
TOKEN (4):
1395+
References a
1396+
[Page.tokens][google.cloud.documentai.v1.Document.Page.tokens]
1397+
element.
1398+
VISUAL_ELEMENT (5):
1399+
References a
1400+
[Page.visual_elements][google.cloud.documentai.v1.Document.Page.visual_elements]
1401+
element.
1402+
TABLE (6):
1403+
Refrrences a
1404+
[Page.tables][google.cloud.documentai.v1.Document.Page.tables]
1405+
element.
1406+
FORM_FIELD (7):
1407+
References a
1408+
[Page.form_fields][google.cloud.documentai.v1.Document.Page.form_fields]
1409+
element.
1410+
"""
13481411
LAYOUT_TYPE_UNSPECIFIED = 0
13491412
BLOCK = 1
13501413
PARAGRAPH = 2
@@ -1404,6 +1467,26 @@ class Provenance(proto.Message):
14041467
class OperationType(proto.Enum):
14051468
r"""If a processor or agent does an explicit operation on
14061469
existing elements.
1470+
1471+
Values:
1472+
OPERATION_TYPE_UNSPECIFIED (0):
1473+
Operation type unspecified. If no operation is specified a
1474+
provenance entry is simply used to match against a
1475+
``parent``.
1476+
ADD (1):
1477+
Add an element.
1478+
REMOVE (2):
1479+
Remove an element identified by ``parent``.
1480+
REPLACE (3):
1481+
Replace an element identified by ``parent``.
1482+
EVAL_REQUESTED (4):
1483+
Request human review for the element identified by
1484+
``parent``.
1485+
EVAL_APPROVED (5):
1486+
Element is reviewed and approved at human
1487+
review, confidence will be set to 1.0.
1488+
EVAL_SKIPPED (6):
1489+
Element is skipped in the validation process.
14071490
"""
14081491
OPERATION_TYPE_UNSPECIFIED = 0
14091492
ADD = 1

packages/google-cloud-documentai/google/cloud/documentai_v1/types/document_processor_service.py

Lines changed: 63 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,27 @@ class HumanReviewStatus(proto.Message):
161161
"""
162162

163163
class State(proto.Enum):
164-
r"""The final state of human review on a processed document."""
164+
r"""The final state of human review on a processed document.
165+
166+
Values:
167+
STATE_UNSPECIFIED (0):
168+
Human review state is unspecified. Most
169+
likely due to an internal error.
170+
SKIPPED (1):
171+
Human review is skipped for the document.
172+
This can happen because human review is not
173+
enabled on the processor or the processing
174+
request has been set to skip this document.
175+
VALIDATION_PASSED (2):
176+
Human review validation is triggered and
177+
passed, so no review is needed.
178+
IN_PROGRESS (3):
179+
Human review validation is triggered and the
180+
document is under review.
181+
ERROR (4):
182+
Some error happened during triggering human review, see the
183+
[state_message] for details.
184+
"""
165185
STATE_UNSPECIFIED = 0
166186
SKIPPED = 1
167187
VALIDATION_PASSED = 2
@@ -272,7 +292,25 @@ class BatchProcessMetadata(proto.Message):
272292
"""
273293

274294
class State(proto.Enum):
275-
r"""Possible states of the batch processing operation."""
295+
r"""Possible states of the batch processing operation.
296+
297+
Values:
298+
STATE_UNSPECIFIED (0):
299+
The default value. This value is used if the
300+
state is omitted.
301+
WAITING (1):
302+
Request operation is waiting for scheduling.
303+
RUNNING (2):
304+
Request is being processed.
305+
SUCCEEDED (3):
306+
The batch processing completed successfully.
307+
CANCELLING (4):
308+
The batch processing was being cancelled.
309+
CANCELLED (5):
310+
The batch processing was cancelled.
311+
FAILED (6):
312+
The batch processing has failed.
313+
"""
276314
STATE_UNSPECIFIED = 0
277315
WAITING = 1
278316
RUNNING = 2
@@ -918,7 +956,17 @@ class ReviewDocumentRequest(proto.Message):
918956
"""
919957

920958
class Priority(proto.Enum):
921-
r"""The priority level of the human review task."""
959+
r"""The priority level of the human review task.
960+
961+
Values:
962+
DEFAULT (0):
963+
The default priority level.
964+
URGENT (1):
965+
The urgent priority level. The labeling
966+
manager should allocate labeler resource to the
967+
urgent task queue to respect this priority
968+
level.
969+
"""
922970
DEFAULT = 0
923971
URGENT = 1
924972

@@ -963,7 +1011,18 @@ class ReviewDocumentResponse(proto.Message):
9631011
"""
9641012

9651013
class State(proto.Enum):
966-
r"""Possible states of the review operation."""
1014+
r"""Possible states of the review operation.
1015+
1016+
Values:
1017+
STATE_UNSPECIFIED (0):
1018+
The default value. This value is used if the
1019+
state is omitted.
1020+
REJECTED (1):
1021+
The review operation is rejected by the
1022+
reviewer.
1023+
SUCCEEDED (2):
1024+
The review operation is succeeded.
1025+
"""
9671026
STATE_UNSPECIFIED = 0
9681027
REJECTED = 1
9691028
SUCCEEDED = 2

packages/google-cloud-documentai/google/cloud/documentai_v1/types/document_schema.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,22 @@ class OccurrenceType(proto.Enum):
119119
r"""Types of occurrences of the entity type in the document.
120120
Note: this represents the number of instances of an entity
121121
types, not number of mentions of a given entity instance.
122+
123+
Values:
124+
OCCURRENCE_TYPE_UNSPECIFIED (0):
125+
Unspecified occurrence type.
126+
OPTIONAL_ONCE (1):
127+
There will be zero or one instance of this
128+
entity type.
129+
OPTIONAL_MULTIPLE (2):
130+
The entity type will appear zero or multiple
131+
times.
132+
REQUIRED_ONCE (3):
133+
The entity type will only appear exactly
134+
once.
135+
REQUIRED_MULTIPLE (4):
136+
The entity type will appear once or more
137+
times.
122138
"""
123139
OCCURRENCE_TYPE_UNSPECIFIED = 0
124140
OPTIONAL_ONCE = 1

packages/google-cloud-documentai/google/cloud/documentai_v1/types/operation_metadata.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,22 @@ class CommonOperationMetadata(proto.Message):
4444
"""
4545

4646
class State(proto.Enum):
47-
r"""State of the longrunning operation."""
47+
r"""State of the longrunning operation.
48+
49+
Values:
50+
STATE_UNSPECIFIED (0):
51+
Unspecified state.
52+
RUNNING (1):
53+
Operation is still running.
54+
CANCELLING (2):
55+
Operation is being cancelled.
56+
SUCCEEDED (3):
57+
Operation succeeded.
58+
FAILED (4):
59+
Operation failed.
60+
CANCELLED (5):
61+
Operation is cancelled.
62+
"""
4863
STATE_UNSPECIFIED = 0
4964
RUNNING = 1
5065
CANCELLING = 2

packages/google-cloud-documentai/google/cloud/documentai_v1/types/processor.py

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,30 @@ class ProcessorVersion(proto.Message):
6464
"""
6565

6666
class State(proto.Enum):
67-
r"""The possible states of the processor version."""
67+
r"""The possible states of the processor version.
68+
69+
Values:
70+
STATE_UNSPECIFIED (0):
71+
The processor version is in an unspecified
72+
state.
73+
DEPLOYED (1):
74+
The processor version is deployed and can be
75+
used for processing.
76+
DEPLOYING (2):
77+
The processor version is being deployed.
78+
UNDEPLOYED (3):
79+
The processor version is not deployed and
80+
cannot be used for processing.
81+
UNDEPLOYING (4):
82+
The processor version is being undeployed.
83+
CREATING (5):
84+
The processor version is being created.
85+
DELETING (6):
86+
The processor version is being deleted.
87+
FAILED (7):
88+
The processor version failed and is in an
89+
indeterminate state.
90+
"""
6891
STATE_UNSPECIFIED = 0
6992
DEPLOYED = 1
7093
DEPLOYING = 2
@@ -171,7 +194,41 @@ class Processor(proto.Message):
171194
"""
172195

173196
class State(proto.Enum):
174-
r"""The possible states of the processor."""
197+
r"""The possible states of the processor.
198+
199+
Values:
200+
STATE_UNSPECIFIED (0):
201+
The processor is in an unspecified state.
202+
ENABLED (1):
203+
The processor is enabled, i.e., has an
204+
enabled version which can currently serve
205+
processing requests and all the feature
206+
dependencies have been successfully initialized.
207+
DISABLED (2):
208+
The processor is disabled.
209+
ENABLING (3):
210+
The processor is being enabled, will become ``ENABLED`` if
211+
successful.
212+
DISABLING (4):
213+
The processor is being disabled, will become ``DISABLED`` if
214+
successful.
215+
CREATING (5):
216+
The processor is being created, will become either
217+
``ENABLED`` (for successful creation) or ``FAILED`` (for
218+
failed ones). Once a processor is in this state, it can then
219+
be used for document processing, but the feature
220+
dependencies of the processor might not be fully created
221+
yet.
222+
FAILED (6):
223+
The processor failed during creation or
224+
initialization of feature dependencies. The user
225+
should delete the processor and recreate one as
226+
all the functionalities of the processor are
227+
disabled.
228+
DELETING (7):
229+
The processor is being deleted, will be
230+
removed if successful.
231+
"""
175232
STATE_UNSPECIFIED = 0
176233
ENABLED = 1
177234
DISABLED = 2

packages/google-cloud-documentai/google/cloud/documentai_v1beta2/services/document_understanding_service/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ def sample_process_document():
646646
# Done; return the response.
647647
return response
648648

649-
def __enter__(self):
649+
def __enter__(self) -> "DocumentUnderstandingServiceClient":
650650
return self
651651

652652
def __exit__(self, type, value, traceback):

0 commit comments

Comments
 (0)