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

Commit ea874a7

Browse files
fix(deps): Require google-api-core >=1.34.0, >=2.11.0 (#424)
* fix(deps): Require google-api-core >=1.34.0, >=2.11.0 fix: Drop usage of pkg_resources fix: Fix timeout default values docs(samples): Snippetgen should call await on the operation coroutine before calling result PiperOrigin-RevId: 493260409 Source-Link: googleapis/googleapis@fea4387 Source-Link: https://github.com/googleapis/googleapis-gen/commit/387b7344c7529ee44be84e613b19a820508c612b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzg3YjczNDRjNzUyOWVlNDRiZTg0ZTYxM2IxOWE4MjA1MDhjNjEyYiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * add gapic_version.py * fix(deps): require google-api-core>=1.34.0,>=2.11.0 * chore: use templated setup.py and owlbot.py * update version in gapic_version.py * work around generator bug Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <partheniou@google.com>
1 parent 6b917f4 commit ea874a7

File tree

41 files changed

+375
-253
lines changed

Some content is hidden

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

41 files changed

+375
-253
lines changed

.coveragerc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,3 @@ exclude_lines =
1010
pragma: NO COVER
1111
# Ignore debug-only repr
1212
def __repr__
13-
# Ignore pkg_resources exceptions.
14-
# This is added at the module level as a safeguard for if someone
15-
# generates the code and tries to run it without pip installing. This
16-
# makes it virtually impossible to test properly.
17-
except pkg_resources.DistributionNotFound

.github/release-please.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
releaseType: python
22
handleGHRelease: true
3+
manifest: true
34
# NOTE: this section is generated by synthtool.languages.python
45
# See https://github.com/googleapis/synthtool/blob/master/synthtool/languages/python.py
56
branches:

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "2.4.0"
3+
}

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__ = "0.1.0"
16+
__version__ = "2.4.0" # {x-release-please-version}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2022 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+
__version__ = "2.4.0" # {x-release-please-version}

google/cloud/documentai_v1/services/document_processor_service/async_client.py

Lines changed: 36 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
from google.api_core.client_options import ClientOptions
3535
from google.auth import credentials as ga_credentials # type: ignore
3636
from google.oauth2 import service_account # type: ignore
37-
import pkg_resources
37+
38+
from google.cloud.documentai_v1 import gapic_version as package_version
3839

3940
try:
4041
OptionalRetry = Union[retries.Retry, gapic_v1.method._MethodDefault]
@@ -265,7 +266,7 @@ async def process_document(
265266
*,
266267
name: Optional[str] = None,
267268
retry: OptionalRetry = gapic_v1.method.DEFAULT,
268-
timeout: Optional[float] = None,
269+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
269270
metadata: Sequence[Tuple[str, str]] = (),
270271
) -> document_processor_service.ProcessResponse:
271272
r"""Processes a single document.
@@ -392,7 +393,7 @@ async def batch_process_documents(
392393
*,
393394
name: Optional[str] = None,
394395
retry: OptionalRetry = gapic_v1.method.DEFAULT,
395-
timeout: Optional[float] = None,
396+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
396397
metadata: Sequence[Tuple[str, str]] = (),
397398
) -> operation_async.AsyncOperation:
398399
r"""LRO endpoint to batch process many documents. The output is
@@ -423,7 +424,7 @@ async def sample_batch_process_documents():
423424
424425
print("Waiting for operation to complete...")
425426
426-
response = await operation.result()
427+
response = (await operation).result()
427428
428429
# Handle the response
429430
print(response)
@@ -527,7 +528,7 @@ async def fetch_processor_types(
527528
*,
528529
parent: Optional[str] = None,
529530
retry: OptionalRetry = gapic_v1.method.DEFAULT,
530-
timeout: Optional[float] = None,
531+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
531532
metadata: Sequence[Tuple[str, str]] = (),
532533
) -> document_processor_service.FetchProcessorTypesResponse:
533534
r"""Fetches processor types. Note that we do not use
@@ -634,7 +635,7 @@ async def list_processor_types(
634635
*,
635636
parent: Optional[str] = None,
636637
retry: OptionalRetry = gapic_v1.method.DEFAULT,
637-
timeout: Optional[float] = None,
638+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
638639
metadata: Sequence[Tuple[str, str]] = (),
639640
) -> pagers.ListProcessorTypesAsyncPager:
640641
r"""Lists the processor types that exist.
@@ -753,7 +754,7 @@ async def list_processors(
753754
*,
754755
parent: Optional[str] = None,
755756
retry: OptionalRetry = gapic_v1.method.DEFAULT,
756-
timeout: Optional[float] = None,
757+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
757758
metadata: Sequence[Tuple[str, str]] = (),
758759
) -> pagers.ListProcessorsAsyncPager:
759760
r"""Lists all processors which belong to this project.
@@ -870,7 +871,7 @@ async def get_processor(
870871
*,
871872
name: Optional[str] = None,
872873
retry: OptionalRetry = gapic_v1.method.DEFAULT,
873-
timeout: Optional[float] = None,
874+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
874875
metadata: Sequence[Tuple[str, str]] = (),
875876
) -> processor.Processor:
876877
r"""Gets a processor detail.
@@ -975,7 +976,7 @@ async def get_processor_version(
975976
*,
976977
name: Optional[str] = None,
977978
retry: OptionalRetry = gapic_v1.method.DEFAULT,
978-
timeout: Optional[float] = None,
979+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
979980
metadata: Sequence[Tuple[str, str]] = (),
980981
) -> processor.ProcessorVersion:
981982
r"""Gets a processor version detail.
@@ -1086,7 +1087,7 @@ async def list_processor_versions(
10861087
*,
10871088
parent: Optional[str] = None,
10881089
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1089-
timeout: Optional[float] = None,
1090+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
10901091
metadata: Sequence[Tuple[str, str]] = (),
10911092
) -> pagers.ListProcessorVersionsAsyncPager:
10921093
r"""Lists all versions of a processor.
@@ -1203,7 +1204,7 @@ async def delete_processor_version(
12031204
*,
12041205
name: Optional[str] = None,
12051206
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1206-
timeout: Optional[float] = None,
1207+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
12071208
metadata: Sequence[Tuple[str, str]] = (),
12081209
) -> operation_async.AsyncOperation:
12091210
r"""Deletes the processor version, all artifacts under
@@ -1234,7 +1235,7 @@ async def sample_delete_processor_version():
12341235
12351236
print("Waiting for operation to complete...")
12361237
1237-
response = await operation.result()
1238+
response = (await operation).result()
12381239
12391240
# Handle the response
12401241
print(response)
@@ -1330,7 +1331,7 @@ async def deploy_processor_version(
13301331
*,
13311332
name: Optional[str] = None,
13321333
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1333-
timeout: Optional[float] = None,
1334+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
13341335
metadata: Sequence[Tuple[str, str]] = (),
13351336
) -> operation_async.AsyncOperation:
13361337
r"""Deploys the processor version.
@@ -1360,7 +1361,7 @@ async def sample_deploy_processor_version():
13601361
13611362
print("Waiting for operation to complete...")
13621363
1363-
response = await operation.result()
1364+
response = (await operation).result()
13641365
13651366
# Handle the response
13661367
print(response)
@@ -1450,7 +1451,7 @@ async def undeploy_processor_version(
14501451
*,
14511452
name: Optional[str] = None,
14521453
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1453-
timeout: Optional[float] = None,
1454+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
14541455
metadata: Sequence[Tuple[str, str]] = (),
14551456
) -> operation_async.AsyncOperation:
14561457
r"""Undeploys the processor version.
@@ -1480,7 +1481,7 @@ async def sample_undeploy_processor_version():
14801481
14811482
print("Waiting for operation to complete...")
14821483
1483-
response = await operation.result()
1484+
response = (await operation).result()
14841485
14851486
# Handle the response
14861487
print(response)
@@ -1571,7 +1572,7 @@ async def create_processor(
15711572
parent: Optional[str] = None,
15721573
processor: Optional[gcd_processor.Processor] = None,
15731574
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1574-
timeout: Optional[float] = None,
1575+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
15751576
metadata: Sequence[Tuple[str, str]] = (),
15761577
) -> gcd_processor.Processor:
15771578
r"""Creates a processor from the type processor that the
@@ -1692,7 +1693,7 @@ async def delete_processor(
16921693
*,
16931694
name: Optional[str] = None,
16941695
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1695-
timeout: Optional[float] = None,
1696+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
16961697
metadata: Sequence[Tuple[str, str]] = (),
16971698
) -> operation_async.AsyncOperation:
16981699
r"""Deletes the processor, unloads all deployed model
@@ -1724,7 +1725,7 @@ async def sample_delete_processor():
17241725
17251726
print("Waiting for operation to complete...")
17261727
1727-
response = await operation.result()
1728+
response = (await operation).result()
17281729
17291730
# Handle the response
17301731
print(response)
@@ -1819,7 +1820,7 @@ async def enable_processor(
18191820
] = None,
18201821
*,
18211822
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1822-
timeout: Optional[float] = None,
1823+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
18231824
metadata: Sequence[Tuple[str, str]] = (),
18241825
) -> operation_async.AsyncOperation:
18251826
r"""Enables a processor
@@ -1849,7 +1850,7 @@ async def sample_enable_processor():
18491850
18501851
print("Waiting for operation to complete...")
18511852
1852-
response = await operation.result()
1853+
response = (await operation).result()
18531854
18541855
# Handle the response
18551856
print(response)
@@ -1916,7 +1917,7 @@ async def disable_processor(
19161917
] = None,
19171918
*,
19181919
retry: OptionalRetry = gapic_v1.method.DEFAULT,
1919-
timeout: Optional[float] = None,
1920+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
19201921
metadata: Sequence[Tuple[str, str]] = (),
19211922
) -> operation_async.AsyncOperation:
19221923
r"""Disables a processor
@@ -1946,7 +1947,7 @@ async def sample_disable_processor():
19461947
19471948
print("Waiting for operation to complete...")
19481949
1949-
response = await operation.result()
1950+
response = (await operation).result()
19501951
19511952
# Handle the response
19521953
print(response)
@@ -2013,7 +2014,7 @@ async def set_default_processor_version(
20132014
] = None,
20142015
*,
20152016
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2016-
timeout: Optional[float] = None,
2017+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
20172018
metadata: Sequence[Tuple[str, str]] = (),
20182019
) -> operation_async.AsyncOperation:
20192020
r"""Set the default (active) version of a
@@ -2049,7 +2050,7 @@ async def sample_set_default_processor_version():
20492050
20502051
print("Waiting for operation to complete...")
20512052
2052-
response = await operation.result()
2053+
response = (await operation).result()
20532054
20542055
# Handle the response
20552056
print(response)
@@ -2120,7 +2121,7 @@ async def review_document(
21202121
*,
21212122
human_review_config: Optional[str] = None,
21222123
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2123-
timeout: Optional[float] = None,
2124+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
21242125
metadata: Sequence[Tuple[str, str]] = (),
21252126
) -> operation_async.AsyncOperation:
21262127
r"""Send a document for Human Review. The input document
@@ -2155,7 +2156,7 @@ async def sample_review_document():
21552156
21562157
print("Waiting for operation to complete...")
21572158
2158-
response = await operation.result()
2159+
response = (await operation).result()
21592160
21602161
# Handle the response
21612162
print(response)
@@ -2254,7 +2255,7 @@ async def list_operations(
22542255
request: Optional[operations_pb2.ListOperationsRequest] = None,
22552256
*,
22562257
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2257-
timeout: Optional[float] = None,
2258+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
22582259
metadata: Sequence[Tuple[str, str]] = (),
22592260
) -> operations_pb2.ListOperationsResponse:
22602261
r"""Lists operations that match the specified filter in the request.
@@ -2308,7 +2309,7 @@ async def get_operation(
23082309
request: Optional[operations_pb2.GetOperationRequest] = None,
23092310
*,
23102311
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2311-
timeout: Optional[float] = None,
2312+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
23122313
metadata: Sequence[Tuple[str, str]] = (),
23132314
) -> operations_pb2.Operation:
23142315
r"""Gets the latest state of a long-running operation.
@@ -2362,7 +2363,7 @@ async def cancel_operation(
23622363
request: Optional[operations_pb2.CancelOperationRequest] = None,
23632364
*,
23642365
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2365-
timeout: Optional[float] = None,
2366+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
23662367
metadata: Sequence[Tuple[str, str]] = (),
23672368
) -> None:
23682369
r"""Starts asynchronous cancellation on a long-running operation.
@@ -2416,7 +2417,7 @@ async def get_location(
24162417
request: Optional[locations_pb2.GetLocationRequest] = None,
24172418
*,
24182419
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2419-
timeout: Optional[float] = None,
2420+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
24202421
metadata: Sequence[Tuple[str, str]] = (),
24212422
) -> locations_pb2.Location:
24222423
r"""Gets information about a location.
@@ -2470,7 +2471,7 @@ async def list_locations(
24702471
request: Optional[locations_pb2.ListLocationsRequest] = None,
24712472
*,
24722473
retry: OptionalRetry = gapic_v1.method.DEFAULT,
2473-
timeout: Optional[float] = None,
2474+
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
24742475
metadata: Sequence[Tuple[str, str]] = (),
24752476
) -> locations_pb2.ListLocationsResponse:
24762477
r"""Lists information about the supported locations for this service.
@@ -2526,14 +2527,9 @@ async def __aexit__(self, exc_type, exc, tb):
25262527
await self.transport.close()
25272528

25282529

2529-
try:
2530-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2531-
gapic_version=pkg_resources.get_distribution(
2532-
"google-cloud-documentai",
2533-
).version,
2534-
)
2535-
except pkg_resources.DistributionNotFound:
2536-
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
2530+
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
2531+
gapic_version=package_version.__version__
2532+
)
25372533

25382534

25392535
__all__ = ("DocumentProcessorServiceAsyncClient",)

0 commit comments

Comments
 (0)