Skip to content
Permalink
Browse files
chore: upgrade gapic-generator-python to 0.46.3 (#146)
PiperOrigin-RevId: 373649163

Source-Link: googleapis/googleapis@7e1b14e

Source-Link: https://github.com/googleapis/googleapis-gen/commit/0a3c7d272d697796db75857bac73905c68e498c3


feat: Use non-regionalized default host name for documentai.googleapis.com
feat: add confidence field to the PageAnchor.PageRef in document.proto.
fix: add async client to %name_%version/init.py
chore: add autogenerated snippets
chore: remove auth, policy, and options from the reserved names list
feat: support self-signed JWT flow for service accounts
chore: enable GAPIC metadata generation
chore: sort subpackages in %namespace/%name/init.py
  • Loading branch information
gcf-owl-bot[bot] committed May 16, 2021
1 parent c5609b6 commit be671a832839d6efeae76d168b7913a9408572b4
Showing with 1,916 additions and 1,504 deletions.
  1. +14 −14 google/cloud/documentai/__init__.py
  2. +4 −3 google/cloud/documentai_v1/__init__.py
  3. +53 −0 google/cloud/documentai_v1/gapic_metadata.json
  4. +0 −1 google/cloud/documentai_v1/services/__init__.py
  5. +0 −2 google/cloud/documentai_v1/services/document_processor_service/__init__.py
  6. +14 −25 google/cloud/documentai_v1/services/document_processor_service/async_client.py
  7. +35 −41 google/cloud/documentai_v1/services/document_processor_service/client.py
  8. +0 −2 google/cloud/documentai_v1/services/document_processor_service/transports/__init__.py
  9. +93 −30 google/cloud/documentai_v1/services/document_processor_service/transports/base.py
  10. +18 −18 google/cloud/documentai_v1/services/document_processor_service/transports/grpc.py
  11. +18 −19 google/cloud/documentai_v1/services/document_processor_service/transports/grpc_asyncio.py
  12. +0 −2 google/cloud/documentai_v1/types/__init__.py
  13. +87 −190 google/cloud/documentai_v1/types/document.py
  14. +6 −15 google/cloud/documentai_v1/types/document_io.py
  15. +20 −51 google/cloud/documentai_v1/types/document_processor_service.py
  16. +4 −10 google/cloud/documentai_v1/types/geometry.py
  17. +6 −3 google/cloud/documentai_v1beta2/__init__.py
  18. +43 −0 google/cloud/documentai_v1beta2/gapic_metadata.json
  19. +0 −1 google/cloud/documentai_v1beta2/services/__init__.py
  20. +0 −2 google/cloud/documentai_v1beta2/services/document_understanding_service/__init__.py
  21. +13 −22 google/cloud/documentai_v1beta2/services/document_understanding_service/async_client.py
  22. +31 −33 google/cloud/documentai_v1beta2/services/document_understanding_service/client.py
  23. +0 −2 google/cloud/documentai_v1beta2/services/document_understanding_service/transports/__init__.py
  24. +88 −26 google/cloud/documentai_v1beta2/services/document_understanding_service/transports/base.py
  25. +14 −14 google/cloud/documentai_v1beta2/services/document_understanding_service/transports/grpc.py
  26. +14 −15 google/cloud/documentai_v1beta2/services/document_understanding_service/transports/grpc_asyncio.py
  27. +0 −2 google/cloud/documentai_v1beta2/types/__init__.py
  28. +48 −128 google/cloud/documentai_v1beta2/types/document.py
  29. +24 −61 google/cloud/documentai_v1beta2/types/document_understanding.py
  30. +4 −10 google/cloud/documentai_v1beta2/types/geometry.py
  31. +4 −3 google/cloud/documentai_v1beta3/__init__.py
  32. +53 −0 google/cloud/documentai_v1beta3/gapic_metadata.json
  33. +0 −1 google/cloud/documentai_v1beta3/services/__init__.py
  34. +0 −2 google/cloud/documentai_v1beta3/services/document_processor_service/__init__.py
  35. +14 −25 google/cloud/documentai_v1beta3/services/document_processor_service/async_client.py
  36. +35 −41 google/cloud/documentai_v1beta3/services/document_processor_service/client.py
  37. +0 −2 google/cloud/documentai_v1beta3/services/document_processor_service/transports/__init__.py
  38. +93 −30 google/cloud/documentai_v1beta3/services/document_processor_service/transports/base.py
  39. +18 −18 google/cloud/documentai_v1beta3/services/document_processor_service/transports/grpc.py
  40. +18 −19 google/cloud/documentai_v1beta3/services/document_processor_service/transports/grpc_asyncio.py
  41. +0 −2 google/cloud/documentai_v1beta3/types/__init__.py
  42. +87 −190 google/cloud/documentai_v1beta3/types/document.py
  43. +6 −15 google/cloud/documentai_v1beta3/types/document_io.py
  44. +28 −72 google/cloud/documentai_v1beta3/types/document_processor_service.py
  45. +4 −10 google/cloud/documentai_v1beta3/types/geometry.py
  46. +15 −0 tests/__init__.py
  47. +15 −0 tests/unit/__init__.py
  48. +15 −0 tests/unit/gapic/__init__.py
  49. +0 −1 tests/unit/gapic/documentai_v1/__init__.py
  50. +293 −122 tests/unit/gapic/documentai_v1/test_document_processor_service.py
  51. +0 −1 tests/unit/gapic/documentai_v1beta2/__init__.py
  52. +274 −83 tests/unit/gapic/documentai_v1beta2/test_document_understanding_service.py
  53. +0 −1 tests/unit/gapic/documentai_v1beta3/__init__.py
  54. +293 −124 tests/unit/gapic/documentai_v1beta3/test_document_processor_service.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,12 +14,13 @@
# limitations under the License.
#

from google.cloud.documentai_v1.services.document_processor_service.async_client import (
DocumentProcessorServiceAsyncClient,
)
from google.cloud.documentai_v1.services.document_processor_service.client import (
DocumentProcessorServiceClient,
)
from google.cloud.documentai_v1.services.document_processor_service.async_client import (
DocumentProcessorServiceAsyncClient,
)

from google.cloud.documentai_v1.types.document import Document
from google.cloud.documentai_v1.types.document_io import BatchDocumentsInputConfig
from google.cloud.documentai_v1.types.document_io import DocumentOutputConfig
@@ -59,26 +59,26 @@
from google.cloud.documentai_v1.types.geometry import Vertex

__all__ = (
"BatchDocumentsInputConfig",
"BatchProcessMetadata",
"BatchProcessRequest",
"BatchProcessResponse",
"BoundingPoly",
"CommonOperationMetadata",
"DocumentProcessorServiceClient",
"DocumentProcessorServiceAsyncClient",
"Document",
"BatchDocumentsInputConfig",
"DocumentOutputConfig",
"DocumentProcessorServiceAsyncClient",
"DocumentProcessorServiceClient",
"GcsDocument",
"GcsDocuments",
"GcsPrefix",
"RawDocument",
"BatchProcessMetadata",
"BatchProcessRequest",
"BatchProcessResponse",
"CommonOperationMetadata",
"HumanReviewStatus",
"NormalizedVertex",
"ProcessRequest",
"ProcessResponse",
"RawDocument",
"ReviewDocumentOperationMetadata",
"ReviewDocumentRequest",
"ReviewDocumentResponse",
"BoundingPoly",
"NormalizedVertex",
"Vertex",
)
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,6 +15,8 @@
#

from .services.document_processor_service import DocumentProcessorServiceClient
from .services.document_processor_service import DocumentProcessorServiceAsyncClient

from .types.document import Document
from .types.document_io import BatchDocumentsInputConfig
from .types.document_io import DocumentOutputConfig
@@ -37,8 +38,8 @@
from .types.geometry import NormalizedVertex
from .types.geometry import Vertex


__all__ = (
"DocumentProcessorServiceAsyncClient",
"BatchDocumentsInputConfig",
"BatchProcessMetadata",
"BatchProcessRequest",
@@ -47,6 +48,7 @@
"CommonOperationMetadata",
"Document",
"DocumentOutputConfig",
"DocumentProcessorServiceClient",
"GcsDocument",
"GcsDocuments",
"GcsPrefix",
@@ -59,5 +61,4 @@
"ReviewDocumentRequest",
"ReviewDocumentResponse",
"Vertex",
"DocumentProcessorServiceClient",
)
@@ -0,0 +1,53 @@
{
"comment": "This file maps proto services/RPCs to the corresponding library clients/methods",
"language": "python",
"libraryPackage": "google.cloud.documentai_v1",
"protoPackage": "google.cloud.documentai.v1",
"schema": "1.0",
"services": {
"DocumentProcessorService": {
"clients": {
"grpc": {
"libraryClient": "DocumentProcessorServiceClient",
"rpcs": {
"BatchProcessDocuments": {
"methods": [
"batch_process_documents"
]
},
"ProcessDocument": {
"methods": [
"process_document"
]
},
"ReviewDocument": {
"methods": [
"review_document"
]
}
}
},
"grpc-async": {
"libraryClient": "DocumentProcessorServiceAsyncClient",
"rpcs": {
"BatchProcessDocuments": {
"methods": [
"batch_process_documents"
]
},
"ProcessDocument": {
"methods": [
"process_document"
]
},
"ReviewDocument": {
"methods": [
"review_document"
]
}
}
}
}
}
}
}
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,7 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

from .client import DocumentProcessorServiceClient
from .async_client import DocumentProcessorServiceAsyncClient

@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,25 +13,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

from collections import OrderedDict
import functools
import re
from typing import Dict, Sequence, Tuple, Type, Union
import pkg_resources

import google.api_core.client_options as ClientOptions # type: ignore
from google.api_core import exceptions # type: ignore
from google.api_core import exceptions as core_exceptions # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core import retry as retries # type: ignore
from google.auth import credentials # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.oauth2 import service_account # type: ignore

from google.api_core import operation # type: ignore
from google.api_core import operation_async # type: ignore
from google.cloud.documentai_v1.types import document
from google.cloud.documentai_v1.types import document_processor_service

from .transports.base import DocumentProcessorServiceTransport, DEFAULT_CLIENT_INFO
from .transports.grpc_asyncio import DocumentProcessorServiceGrpcAsyncIOTransport
from .client import DocumentProcessorServiceClient
@@ -61,33 +58,28 @@ class DocumentProcessorServiceAsyncClient:
parse_processor_path = staticmethod(
DocumentProcessorServiceClient.parse_processor_path
)

common_billing_account_path = staticmethod(
DocumentProcessorServiceClient.common_billing_account_path
)
parse_common_billing_account_path = staticmethod(
DocumentProcessorServiceClient.parse_common_billing_account_path
)

common_folder_path = staticmethod(DocumentProcessorServiceClient.common_folder_path)
parse_common_folder_path = staticmethod(
DocumentProcessorServiceClient.parse_common_folder_path
)

common_organization_path = staticmethod(
DocumentProcessorServiceClient.common_organization_path
)
parse_common_organization_path = staticmethod(
DocumentProcessorServiceClient.parse_common_organization_path
)

common_project_path = staticmethod(
DocumentProcessorServiceClient.common_project_path
)
parse_common_project_path = staticmethod(
DocumentProcessorServiceClient.parse_common_project_path
)

common_location_path = staticmethod(
DocumentProcessorServiceClient.common_location_path
)
@@ -97,7 +89,8 @@ class DocumentProcessorServiceAsyncClient:

@classmethod
def from_service_account_info(cls, info: dict, *args, **kwargs):
"""Creates an instance of this client using the provided credentials info.
"""Creates an instance of this client using the provided credentials
info.
Args:
info (dict): The service account private key info.
@@ -112,7 +105,7 @@ def from_service_account_info(cls, info: dict, *args, **kwargs):
@classmethod
def from_service_account_file(cls, filename: str, *args, **kwargs):
"""Creates an instance of this client using the provided credentials
file.
file.
Args:
filename (str): The path to the service account private key json
@@ -129,7 +122,7 @@ def from_service_account_file(cls, filename: str, *args, **kwargs):

@property
def transport(self) -> DocumentProcessorServiceTransport:
"""Return the transport used by the client instance.
"""Returns the transport used by the client instance.
Returns:
DocumentProcessorServiceTransport: The transport used by the client instance.
@@ -144,12 +137,12 @@ def transport(self) -> DocumentProcessorServiceTransport:
def __init__(
self,
*,
credentials: credentials.Credentials = None,
credentials: ga_credentials.Credentials = None,
transport: Union[str, DocumentProcessorServiceTransport] = "grpc_asyncio",
client_options: ClientOptions = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
) -> None:
"""Instantiate the document processor service client.
"""Instantiates the document processor service client.
Args:
credentials (Optional[google.auth.credentials.Credentials]): The
@@ -181,7 +174,6 @@ def __init__(
google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
creation failed for any reason.
"""

self._client = DocumentProcessorServiceClient(
credentials=credentials,
transport=transport,
@@ -211,7 +203,6 @@ async def process_document(
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -238,7 +229,6 @@ async def process_document(

# If we have keyword arguments corresponding to fields on the
# request, apply these.

if name is not None:
request.name = name

@@ -251,7 +241,8 @@ async def process_document(
maximum=60.0,
multiplier=1.3,
predicate=retries.if_exception_type(
exceptions.DeadlineExceeded, exceptions.ServiceUnavailable,
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
),
deadline=120.0,
),
@@ -294,7 +285,6 @@ async def batch_process_documents(
This corresponds to the ``name`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -324,7 +314,6 @@ async def batch_process_documents(

# If we have keyword arguments corresponding to fields on the
# request, apply these.

if name is not None:
request.name = name

@@ -337,7 +326,8 @@ async def batch_process_documents(
maximum=60.0,
multiplier=1.3,
predicate=retries.if_exception_type(
exceptions.DeadlineExceeded, exceptions.ServiceUnavailable,
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
),
deadline=120.0,
),
@@ -389,7 +379,6 @@ async def review_document(
This corresponds to the ``human_review_config`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
@@ -419,7 +408,6 @@ async def review_document(

# If we have keyword arguments corresponding to fields on the
# request, apply these.

if human_review_config is not None:
request.human_review_config = human_review_config

@@ -432,7 +420,8 @@ async def review_document(
maximum=60.0,
multiplier=1.3,
predicate=retries.if_exception_type(
exceptions.DeadlineExceeded, exceptions.ServiceUnavailable,
core_exceptions.DeadlineExceeded,
core_exceptions.ServiceUnavailable,
),
deadline=120.0,
),

0 comments on commit be671a8

Please sign in to comment.