Skip to content

Commit 9722673

Browse files
gcf-owl-bot[bot]partheaohmayr
authored
docs: [google-cloud-documentai] updated comments (#12676)
BEGIN_COMMIT_OVERRIDE docs: updated comments END_COMMIT_OVERRIDE - [ ] Regenerate this pull request now. PiperOrigin-RevId: 631869949 Source-Link: googleapis/googleapis@a5dcade Source-Link: googleapis/googleapis-gen@697b6d8 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRvY3VtZW50YWkvLk93bEJvdC55YW1sIiwiaCI6IjY5N2I2ZDg4ZjBlYjc3YmNiYTRjYzg2NGI2YTg1MjQ0OTBkNDk5MTcifQ== --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com> Co-authored-by: ohmayr <omairnaveed@ymail.com>
1 parent 11fb7ce commit 9722673

28 files changed

Lines changed: 8623 additions & 968 deletions

File tree

packages/google-cloud-documentai/google/cloud/documentai/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "2.27.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-documentai/google/cloud/documentai_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "2.27.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

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

Lines changed: 231 additions & 204 deletions
Large diffs are not rendered by default.

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

Lines changed: 105 additions & 132 deletions
Large diffs are not rendered by default.

packages/google-cloud-documentai/google/cloud/documentai_v1/services/document_processor_service/transports/grpc.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def __init__(
5858
credentials: Optional[ga_credentials.Credentials] = None,
5959
credentials_file: Optional[str] = None,
6060
scopes: Optional[Sequence[str]] = None,
61-
channel: Optional[grpc.Channel] = None,
61+
channel: Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]] = None,
6262
api_mtls_endpoint: Optional[str] = None,
6363
client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
6464
ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
@@ -78,14 +78,17 @@ def __init__(
7878
credentials identify the application to the service; if none
7979
are specified, the client will attempt to ascertain the
8080
credentials from the environment.
81-
This argument is ignored if ``channel`` is provided.
81+
This argument is ignored if a ``channel`` instance is provided.
8282
credentials_file (Optional[str]): A file with credentials that can
8383
be loaded with :func:`google.auth.load_credentials_from_file`.
84-
This argument is ignored if ``channel`` is provided.
84+
This argument is ignored if a ``channel`` instance is provided.
8585
scopes (Optional(Sequence[str])): A list of scopes. This argument is
86-
ignored if ``channel`` is provided.
87-
channel (Optional[grpc.Channel]): A ``Channel`` instance through
88-
which to make calls.
86+
ignored if a ``channel`` instance is provided.
87+
channel (Optional[Union[grpc.Channel, Callable[..., grpc.Channel]]]):
88+
A ``Channel`` instance through which to make calls, or a Callable
89+
that constructs and returns one. If set to None, ``self.create_channel``
90+
is used to create the channel. If a Callable is given, it will be called
91+
with the same arguments as used in ``self.create_channel``.
8992
api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
9093
If provided, it overrides the ``host`` argument and tries to create
9194
a mutual TLS channel with client SSL credentials from
@@ -95,11 +98,11 @@ def __init__(
9598
private key bytes, both in PEM format. It is ignored if
9699
``api_mtls_endpoint`` is None.
97100
ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
98-
for the grpc channel. It is ignored if ``channel`` is provided.
101+
for the grpc channel. It is ignored if a ``channel`` instance is provided.
99102
client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
100103
A callback to provide client certificate bytes and private key bytes,
101104
both in PEM format. It is used to configure a mutual TLS channel. It is
102-
ignored if ``channel`` or ``ssl_channel_credentials`` is provided.
105+
ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
103106
quota_project_id (Optional[str]): An optional project to use for billing
104107
and quota.
105108
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
@@ -126,7 +129,7 @@ def __init__(
126129
if client_cert_source:
127130
warnings.warn("client_cert_source is deprecated", DeprecationWarning)
128131

129-
if channel:
132+
if isinstance(channel, grpc.Channel):
130133
# Ignore credentials if a channel was passed.
131134
credentials = False
132135
# If a channel was explicitly provided, set it.
@@ -167,7 +170,9 @@ def __init__(
167170
)
168171

169172
if not self._grpc_channel:
170-
self._grpc_channel = type(self).create_channel(
173+
# initialize with the provided callable or the default channel
174+
channel_init = channel or type(self).create_channel
175+
self._grpc_channel = channel_init(
171176
self._host,
172177
# use the credentials which are saved
173178
credentials=self._credentials,

packages/google-cloud-documentai/google/cloud/documentai_v1/services/document_processor_service/transports/grpc_asyncio.py

Lines changed: 161 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
1717
import warnings
1818

19+
from google.api_core import exceptions as core_exceptions
1920
from google.api_core import gapic_v1, grpc_helpers_async, operations_v1
21+
from google.api_core import retry_async as retries
2022
from google.auth import credentials as ga_credentials # type: ignore
2123
from google.auth.transport.grpc import SslCredentials # type: ignore
2224
from google.cloud.location import locations_pb2 # type: ignore
@@ -73,7 +75,6 @@ def create_channel(
7375
the credentials from the environment.
7476
credentials_file (Optional[str]): A file with credentials that can
7577
be loaded with :func:`google.auth.load_credentials_from_file`.
76-
This argument is ignored if ``channel`` is provided.
7778
scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
7879
service. These are only used when credentials are not specified and
7980
are passed to :func:`google.auth.default`.
@@ -103,7 +104,7 @@ def __init__(
103104
credentials: Optional[ga_credentials.Credentials] = None,
104105
credentials_file: Optional[str] = None,
105106
scopes: Optional[Sequence[str]] = None,
106-
channel: Optional[aio.Channel] = None,
107+
channel: Optional[Union[aio.Channel, Callable[..., aio.Channel]]] = None,
107108
api_mtls_endpoint: Optional[str] = None,
108109
client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
109110
ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
@@ -123,15 +124,18 @@ def __init__(
123124
credentials identify the application to the service; if none
124125
are specified, the client will attempt to ascertain the
125126
credentials from the environment.
126-
This argument is ignored if ``channel`` is provided.
127+
This argument is ignored if a ``channel`` instance is provided.
127128
credentials_file (Optional[str]): A file with credentials that can
128129
be loaded with :func:`google.auth.load_credentials_from_file`.
129-
This argument is ignored if ``channel`` is provided.
130+
This argument is ignored if a ``channel`` instance is provided.
130131
scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
131132
service. These are only used when credentials are not specified and
132133
are passed to :func:`google.auth.default`.
133-
channel (Optional[aio.Channel]): A ``Channel`` instance through
134-
which to make calls.
134+
channel (Optional[Union[aio.Channel, Callable[..., aio.Channel]]]):
135+
A ``Channel`` instance through which to make calls, or a Callable
136+
that constructs and returns one. If set to None, ``self.create_channel``
137+
is used to create the channel. If a Callable is given, it will be called
138+
with the same arguments as used in ``self.create_channel``.
135139
api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
136140
If provided, it overrides the ``host`` argument and tries to create
137141
a mutual TLS channel with client SSL credentials from
@@ -141,11 +145,11 @@ def __init__(
141145
private key bytes, both in PEM format. It is ignored if
142146
``api_mtls_endpoint`` is None.
143147
ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
144-
for the grpc channel. It is ignored if ``channel`` is provided.
148+
for the grpc channel. It is ignored if a ``channel`` instance is provided.
145149
client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
146150
A callback to provide client certificate bytes and private key bytes,
147151
both in PEM format. It is used to configure a mutual TLS channel. It is
148-
ignored if ``channel`` or ``ssl_channel_credentials`` is provided.
152+
ignored if a ``channel`` instance or ``ssl_channel_credentials`` is provided.
149153
quota_project_id (Optional[str]): An optional project to use for billing
150154
and quota.
151155
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
@@ -172,7 +176,7 @@ def __init__(
172176
if client_cert_source:
173177
warnings.warn("client_cert_source is deprecated", DeprecationWarning)
174178

175-
if channel:
179+
if isinstance(channel, aio.Channel):
176180
# Ignore credentials if a channel was passed.
177181
credentials = False
178182
# If a channel was explicitly provided, set it.
@@ -212,7 +216,9 @@ def __init__(
212216
)
213217

214218
if not self._grpc_channel:
215-
self._grpc_channel = type(self).create_channel(
219+
# initialize with the provided callable or the default channel
220+
channel_init = channel or type(self).create_channel
221+
self._grpc_channel = channel_init(
216222
self._host,
217223
# use the credentials which are saved
218224
credentials=self._credentials,
@@ -915,6 +921,151 @@ def list_evaluations(
915921
)
916922
return self._stubs["list_evaluations"]
917923

924+
def _prep_wrapped_messages(self, client_info):
925+
"""Precompute the wrapped methods, overriding the base class method to use async wrappers."""
926+
self._wrapped_methods = {
927+
self.process_document: gapic_v1.method_async.wrap_method(
928+
self.process_document,
929+
default_retry=retries.AsyncRetry(
930+
initial=0.1,
931+
maximum=60.0,
932+
multiplier=1.3,
933+
predicate=retries.if_exception_type(
934+
core_exceptions.DeadlineExceeded,
935+
core_exceptions.ServiceUnavailable,
936+
),
937+
deadline=300.0,
938+
),
939+
default_timeout=300.0,
940+
client_info=client_info,
941+
),
942+
self.batch_process_documents: gapic_v1.method_async.wrap_method(
943+
self.batch_process_documents,
944+
default_retry=retries.AsyncRetry(
945+
initial=0.1,
946+
maximum=60.0,
947+
multiplier=1.3,
948+
predicate=retries.if_exception_type(
949+
core_exceptions.DeadlineExceeded,
950+
core_exceptions.ServiceUnavailable,
951+
),
952+
deadline=120.0,
953+
),
954+
default_timeout=120.0,
955+
client_info=client_info,
956+
),
957+
self.fetch_processor_types: gapic_v1.method_async.wrap_method(
958+
self.fetch_processor_types,
959+
default_timeout=None,
960+
client_info=client_info,
961+
),
962+
self.list_processor_types: gapic_v1.method_async.wrap_method(
963+
self.list_processor_types,
964+
default_timeout=None,
965+
client_info=client_info,
966+
),
967+
self.get_processor_type: gapic_v1.method_async.wrap_method(
968+
self.get_processor_type,
969+
default_timeout=None,
970+
client_info=client_info,
971+
),
972+
self.list_processors: gapic_v1.method_async.wrap_method(
973+
self.list_processors,
974+
default_timeout=None,
975+
client_info=client_info,
976+
),
977+
self.get_processor: gapic_v1.method_async.wrap_method(
978+
self.get_processor,
979+
default_timeout=None,
980+
client_info=client_info,
981+
),
982+
self.train_processor_version: gapic_v1.method_async.wrap_method(
983+
self.train_processor_version,
984+
default_timeout=None,
985+
client_info=client_info,
986+
),
987+
self.get_processor_version: gapic_v1.method_async.wrap_method(
988+
self.get_processor_version,
989+
default_timeout=None,
990+
client_info=client_info,
991+
),
992+
self.list_processor_versions: gapic_v1.method_async.wrap_method(
993+
self.list_processor_versions,
994+
default_timeout=None,
995+
client_info=client_info,
996+
),
997+
self.delete_processor_version: gapic_v1.method_async.wrap_method(
998+
self.delete_processor_version,
999+
default_timeout=None,
1000+
client_info=client_info,
1001+
),
1002+
self.deploy_processor_version: gapic_v1.method_async.wrap_method(
1003+
self.deploy_processor_version,
1004+
default_timeout=None,
1005+
client_info=client_info,
1006+
),
1007+
self.undeploy_processor_version: gapic_v1.method_async.wrap_method(
1008+
self.undeploy_processor_version,
1009+
default_timeout=None,
1010+
client_info=client_info,
1011+
),
1012+
self.create_processor: gapic_v1.method_async.wrap_method(
1013+
self.create_processor,
1014+
default_timeout=None,
1015+
client_info=client_info,
1016+
),
1017+
self.delete_processor: gapic_v1.method_async.wrap_method(
1018+
self.delete_processor,
1019+
default_timeout=None,
1020+
client_info=client_info,
1021+
),
1022+
self.enable_processor: gapic_v1.method_async.wrap_method(
1023+
self.enable_processor,
1024+
default_timeout=None,
1025+
client_info=client_info,
1026+
),
1027+
self.disable_processor: gapic_v1.method_async.wrap_method(
1028+
self.disable_processor,
1029+
default_timeout=None,
1030+
client_info=client_info,
1031+
),
1032+
self.set_default_processor_version: gapic_v1.method_async.wrap_method(
1033+
self.set_default_processor_version,
1034+
default_timeout=None,
1035+
client_info=client_info,
1036+
),
1037+
self.review_document: gapic_v1.method_async.wrap_method(
1038+
self.review_document,
1039+
default_retry=retries.AsyncRetry(
1040+
initial=0.1,
1041+
maximum=60.0,
1042+
multiplier=1.3,
1043+
predicate=retries.if_exception_type(
1044+
core_exceptions.DeadlineExceeded,
1045+
core_exceptions.ServiceUnavailable,
1046+
),
1047+
deadline=120.0,
1048+
),
1049+
default_timeout=120.0,
1050+
client_info=client_info,
1051+
),
1052+
self.evaluate_processor_version: gapic_v1.method_async.wrap_method(
1053+
self.evaluate_processor_version,
1054+
default_timeout=None,
1055+
client_info=client_info,
1056+
),
1057+
self.get_evaluation: gapic_v1.method_async.wrap_method(
1058+
self.get_evaluation,
1059+
default_timeout=None,
1060+
client_info=client_info,
1061+
),
1062+
self.list_evaluations: gapic_v1.method_async.wrap_method(
1063+
self.list_evaluations,
1064+
default_timeout=None,
1065+
client_info=client_info,
1066+
),
1067+
}
1068+
9181069
def close(self):
9191070
return self.grpc_channel.close()
9201071

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,8 @@ class StyleInfo(proto.Message):
611611
pixel_font_size (float):
612612
Font size in pixels, equal to *unrounded
613613
[font_size][google.cloud.documentai.v1.Document.Page.Token.StyleInfo.font_size]*
614-
\* *resolution* ÷ ``72.0``.
614+
615+
- *resolution* ÷ ``72.0``.
615616
letter_spacing (float):
616617
Letter spacing in points.
617618
font_type (str):

packages/google-cloud-documentai/google/cloud/documentai_v1beta2/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "2.27.0" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

0 commit comments

Comments
 (0)