Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit c309f8f

Browse files
feat(v1): Move CommonOperationMetadata into a separate file for potential reuse (#158)
PiperOrigin-RevId: 377562108 Source-Link: googleapis/googleapis@3e0f7eb Source-Link: https://github.com/googleapis/googleapis-gen/commit/70f4e20f116713d800e280ce0479fa2adb47d53d
1 parent a1a92b2 commit c309f8f

File tree

6 files changed

+66
-40
lines changed

6 files changed

+66
-40
lines changed

google/cloud/documentai/__init__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@
3737
from google.cloud.documentai_v1.types.document_processor_service import (
3838
BatchProcessResponse,
3939
)
40-
from google.cloud.documentai_v1.types.document_processor_service import (
41-
CommonOperationMetadata,
42-
)
4340
from google.cloud.documentai_v1.types.document_processor_service import (
4441
HumanReviewStatus,
4542
)
@@ -57,6 +54,7 @@
5754
from google.cloud.documentai_v1.types.geometry import BoundingPoly
5855
from google.cloud.documentai_v1.types.geometry import NormalizedVertex
5956
from google.cloud.documentai_v1.types.geometry import Vertex
57+
from google.cloud.documentai_v1.types.operation_metadata import CommonOperationMetadata
6058

6159
__all__ = (
6260
"DocumentProcessorServiceClient",
@@ -71,7 +69,6 @@
7169
"BatchProcessMetadata",
7270
"BatchProcessRequest",
7371
"BatchProcessResponse",
74-
"CommonOperationMetadata",
7572
"HumanReviewStatus",
7673
"ProcessRequest",
7774
"ProcessResponse",
@@ -81,4 +78,5 @@
8178
"BoundingPoly",
8279
"NormalizedVertex",
8380
"Vertex",
81+
"CommonOperationMetadata",
8482
)

google/cloud/documentai_v1/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
from .types.document_processor_service import BatchProcessMetadata
2828
from .types.document_processor_service import BatchProcessRequest
2929
from .types.document_processor_service import BatchProcessResponse
30-
from .types.document_processor_service import CommonOperationMetadata
3130
from .types.document_processor_service import HumanReviewStatus
3231
from .types.document_processor_service import ProcessRequest
3332
from .types.document_processor_service import ProcessResponse
@@ -37,6 +36,7 @@
3736
from .types.geometry import BoundingPoly
3837
from .types.geometry import NormalizedVertex
3938
from .types.geometry import Vertex
39+
from .types.operation_metadata import CommonOperationMetadata
4040

4141
__all__ = (
4242
"DocumentProcessorServiceAsyncClient",

google/cloud/documentai_v1/types/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
BatchProcessMetadata,
2727
BatchProcessRequest,
2828
BatchProcessResponse,
29-
CommonOperationMetadata,
3029
HumanReviewStatus,
3130
ProcessRequest,
3231
ProcessResponse,
@@ -39,6 +38,7 @@
3938
NormalizedVertex,
4039
Vertex,
4140
)
41+
from .operation_metadata import CommonOperationMetadata
4242

4343
__all__ = (
4444
"Document",
@@ -51,7 +51,6 @@
5151
"BatchProcessMetadata",
5252
"BatchProcessRequest",
5353
"BatchProcessResponse",
54-
"CommonOperationMetadata",
5554
"HumanReviewStatus",
5655
"ProcessRequest",
5756
"ProcessResponse",
@@ -61,4 +60,5 @@
6160
"BoundingPoly",
6261
"NormalizedVertex",
6362
"Vertex",
63+
"CommonOperationMetadata",
6464
)

google/cloud/documentai_v1/types/document_processor_service.py

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from google.cloud.documentai_v1.types import document as gcd_document
1919
from google.cloud.documentai_v1.types import document_io
20+
from google.cloud.documentai_v1.types import operation_metadata
2021
from google.protobuf import timestamp_pb2 # type: ignore
2122
from google.rpc import status_pb2 # type: ignore
2223

@@ -33,7 +34,6 @@
3334
"ReviewDocumentRequest",
3435
"ReviewDocumentResponse",
3536
"ReviewDocumentOperationMetadata",
36-
"CommonOperationMetadata",
3737
},
3838
)
3939

@@ -242,37 +242,8 @@ class ReviewDocumentOperationMetadata(proto.Message):
242242
"""
243243

244244
common_metadata = proto.Field(
245-
proto.MESSAGE, number=5, message="CommonOperationMetadata",
245+
proto.MESSAGE, number=5, message=operation_metadata.CommonOperationMetadata,
246246
)
247247

248248

249-
class CommonOperationMetadata(proto.Message):
250-
r"""The common metadata for long running operations.
251-
Attributes:
252-
state (google.cloud.documentai_v1.types.CommonOperationMetadata.State):
253-
The state of the operation.
254-
state_message (str):
255-
A message providing more details about the
256-
current state of processing.
257-
create_time (google.protobuf.timestamp_pb2.Timestamp):
258-
The creation time of the operation.
259-
update_time (google.protobuf.timestamp_pb2.Timestamp):
260-
The last update time of the operation.
261-
"""
262-
263-
class State(proto.Enum):
264-
r"""State of the longrunning operation."""
265-
STATE_UNSPECIFIED = 0
266-
RUNNING = 1
267-
CANCELLING = 2
268-
SUCCEEDED = 3
269-
FAILED = 4
270-
CANCELLED = 5
271-
272-
state = proto.Field(proto.ENUM, number=1, enum=State,)
273-
state_message = proto.Field(proto.STRING, number=2,)
274-
create_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,)
275-
update_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,)
276-
277-
278249
__all__ = tuple(sorted(__protobuf__.manifest))

google/cloud/documentai_v1/types/geometry.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ class Vertex(proto.Message):
3131
x (int):
3232
X coordinate.
3333
y (int):
34-
Y coordinate.
34+
Y coordinate (starts from the top of the
35+
image).
3536
"""
3637

3738
x = proto.Field(proto.INT32, number=1,)
@@ -47,7 +48,8 @@ class NormalizedVertex(proto.Message):
4748
x (float):
4849
X coordinate.
4950
y (float):
50-
Y coordinate.
51+
Y coordinate (starts from the top of the
52+
image).
5153
"""
5254

5355
x = proto.Field(proto.FLOAT, number=1,)
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2020 Google LLC
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
import proto # type: ignore
17+
18+
from google.protobuf import timestamp_pb2 # type: ignore
19+
20+
21+
__protobuf__ = proto.module(
22+
package="google.cloud.documentai.v1", manifest={"CommonOperationMetadata",},
23+
)
24+
25+
26+
class CommonOperationMetadata(proto.Message):
27+
r"""The common metadata for long running operations.
28+
Attributes:
29+
state (google.cloud.documentai_v1.types.CommonOperationMetadata.State):
30+
The state of the operation.
31+
state_message (str):
32+
A message providing more details about the
33+
current state of processing.
34+
create_time (google.protobuf.timestamp_pb2.Timestamp):
35+
The creation time of the operation.
36+
update_time (google.protobuf.timestamp_pb2.Timestamp):
37+
The last update time of the operation.
38+
"""
39+
40+
class State(proto.Enum):
41+
r"""State of the longrunning operation."""
42+
STATE_UNSPECIFIED = 0
43+
RUNNING = 1
44+
CANCELLING = 2
45+
SUCCEEDED = 3
46+
FAILED = 4
47+
CANCELLED = 5
48+
49+
state = proto.Field(proto.ENUM, number=1, enum=State,)
50+
state_message = proto.Field(proto.STRING, number=2,)
51+
create_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,)
52+
update_time = proto.Field(proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp,)
53+
54+
55+
__all__ = tuple(sorted(__protobuf__.manifest))

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy