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

Commit

Permalink
chore: upgrade gapic-generator-python to 0.46.3 (#146)
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 373649163

Source-Link: googleapis/googleapis@7e1b14e

Source-Link: googleapis/googleapis-gen@0a3c7d2


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 be671a8
Show file tree
Hide file tree
Showing 54 changed files with 1,916 additions and 1,504 deletions.
28 changes: 14 additions & 14 deletions google/cloud/documentai/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -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
Expand Down Expand Up @@ -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",
)
7 changes: 4 additions & 3 deletions google/cloud/documentai_v1/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -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
Expand All @@ -37,8 +38,8 @@
from .types.geometry import NormalizedVertex
from .types.geometry import Vertex


__all__ = (
"DocumentProcessorServiceAsyncClient",
"BatchDocumentsInputConfig",
"BatchProcessMetadata",
"BatchProcessRequest",
Expand All @@ -47,6 +48,7 @@
"CommonOperationMetadata",
"Document",
"DocumentOutputConfig",
"DocumentProcessorServiceClient",
"GcsDocument",
"GcsDocuments",
"GcsPrefix",
Expand All @@ -59,5 +61,4 @@
"ReviewDocumentRequest",
"ReviewDocumentResponse",
"Vertex",
"DocumentProcessorServiceClient",
)
53 changes: 53 additions & 0 deletions google/cloud/documentai_v1/gapic_metadata.json
@@ -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 change: 0 additions & 1 deletion google/cloud/documentai_v1/services/__init__.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-

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

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -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

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

# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -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
Expand Down Expand Up @@ -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
)
Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand All @@ -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

Expand All @@ -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,
),
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand All @@ -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,
),
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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

Expand All @@ -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,
),
Expand Down

0 comments on commit be671a8

Please sign in to comment.