diff --git a/docs/documentai_v1/types.rst b/docs/documentai_v1/types.rst index 68ac7119..ddfb0aac 100644 --- a/docs/documentai_v1/types.rst +++ b/docs/documentai_v1/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Documentai v1 API .. automodule:: google.cloud.documentai_v1.types :members: - :undoc-members: :show-inheritance: diff --git a/docs/documentai_v1beta2/types.rst b/docs/documentai_v1beta2/types.rst index 9edede43..35540dd0 100644 --- a/docs/documentai_v1beta2/types.rst +++ b/docs/documentai_v1beta2/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Documentai v1beta2 API .. automodule:: google.cloud.documentai_v1beta2.types :members: - :undoc-members: :show-inheritance: diff --git a/docs/documentai_v1beta3/types.rst b/docs/documentai_v1beta3/types.rst index 7e22aabc..31b489da 100644 --- a/docs/documentai_v1beta3/types.rst +++ b/docs/documentai_v1beta3/types.rst @@ -3,5 +3,4 @@ Types for Google Cloud Documentai v1beta3 API .. automodule:: google.cloud.documentai_v1beta3.types :members: - :undoc-members: :show-inheritance: diff --git a/google/cloud/documentai_v1/services/document_processor_service/async_client.py b/google/cloud/documentai_v1/services/document_processor_service/async_client.py index fa49e4cc..b08da39e 100644 --- a/google/cloud/documentai_v1/services/document_processor_service/async_client.py +++ b/google/cloud/documentai_v1/services/document_processor_service/async_client.py @@ -16,7 +16,17 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 @@ -203,9 +213,9 @@ def transport(self) -> DocumentProcessorServiceTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, DocumentProcessorServiceTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the document processor service client. @@ -249,11 +259,13 @@ def __init__( async def process_document( self, - request: Union[document_processor_service.ProcessRequest, dict] = None, + request: Optional[ + Union[document_processor_service.ProcessRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> document_processor_service.ProcessResponse: r"""Processes a single document. @@ -289,7 +301,7 @@ async def sample_process_document(): print(response) Args: - request (Union[google.cloud.documentai_v1.types.ProcessRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1.types.ProcessRequest, dict]]): The request object. Request message for the process document method. name (:class:`str`): @@ -374,11 +386,13 @@ async def sample_process_document(): async def batch_process_documents( self, - request: Union[document_processor_service.BatchProcessRequest, dict] = None, + request: Optional[ + Union[document_processor_service.BatchProcessRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""LRO endpoint to batch process many documents. The output is @@ -415,7 +429,7 @@ async def sample_batch_process_documents(): print(response) Args: - request (Union[google.cloud.documentai_v1.types.BatchProcessRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1.types.BatchProcessRequest, dict]]): The request object. Request message for batch process document method. name (:class:`str`): @@ -507,13 +521,13 @@ async def sample_batch_process_documents(): async def fetch_processor_types( self, - request: Union[ - document_processor_service.FetchProcessorTypesRequest, dict + request: Optional[ + Union[document_processor_service.FetchProcessorTypesRequest, dict] ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> document_processor_service.FetchProcessorTypesResponse: r"""Fetches processor types. Note that we do not use @@ -546,7 +560,7 @@ async def sample_fetch_processor_types(): print(response) Args: - request (Union[google.cloud.documentai_v1.types.FetchProcessorTypesRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1.types.FetchProcessorTypesRequest, dict]]): The request object. Request message for fetch processor types. parent (:class:`str`): @@ -614,13 +628,13 @@ async def sample_fetch_processor_types(): async def list_processor_types( self, - request: Union[ - document_processor_service.ListProcessorTypesRequest, dict + request: Optional[ + Union[document_processor_service.ListProcessorTypesRequest, dict] ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListProcessorTypesAsyncPager: r"""Lists the processor types that exist. @@ -653,7 +667,7 @@ async def sample_list_processor_types(): print(response) Args: - request (Union[google.cloud.documentai_v1.types.ListProcessorTypesRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1.types.ListProcessorTypesRequest, dict]]): The request object. Request message for list processor types. parent (:class:`str`): @@ -733,11 +747,13 @@ async def sample_list_processor_types(): async def list_processors( self, - request: Union[document_processor_service.ListProcessorsRequest, dict] = None, + request: Optional[ + Union[document_processor_service.ListProcessorsRequest, dict] + ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListProcessorsAsyncPager: r"""Lists all processors which belong to this project. @@ -770,7 +786,7 @@ async def sample_list_processors(): print(response) Args: - request (Union[google.cloud.documentai_v1.types.ListProcessorsRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1.types.ListProcessorsRequest, dict]]): The request object. Request message for list all processors belongs to a project. parent (:class:`str`): @@ -848,11 +864,13 @@ async def sample_list_processors(): async def get_processor( self, - request: Union[document_processor_service.GetProcessorRequest, dict] = None, + request: Optional[ + Union[document_processor_service.GetProcessorRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> processor.Processor: r"""Gets a processor detail. @@ -884,7 +902,7 @@ async def sample_get_processor(): print(response) Args: - request (Union[google.cloud.documentai_v1.types.GetProcessorRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1.types.GetProcessorRequest, dict]]): The request object. Request message for get processor. name (:class:`str`): Required. The processor resource @@ -951,13 +969,13 @@ async def sample_get_processor(): async def get_processor_version( self, - request: Union[ - document_processor_service.GetProcessorVersionRequest, dict + request: Optional[ + Union[document_processor_service.GetProcessorVersionRequest, dict] ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> processor.ProcessorVersion: r"""Gets a processor version detail. @@ -989,7 +1007,7 @@ async def sample_get_processor_version(): print(response) Args: - request (Union[google.cloud.documentai_v1.types.GetProcessorVersionRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1.types.GetProcessorVersionRequest, dict]]): The request object. Request message for get processor version. name (:class:`str`): @@ -1062,13 +1080,13 @@ async def sample_get_processor_version(): async def list_processor_versions( self, - request: Union[ - document_processor_service.ListProcessorVersionsRequest, dict + request: Optional[ + Union[document_processor_service.ListProcessorVersionsRequest, dict] ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListProcessorVersionsAsyncPager: r"""Lists all versions of a processor. @@ -1101,7 +1119,7 @@ async def sample_list_processor_versions(): print(response) Args: - request (Union[google.cloud.documentai_v1.types.ListProcessorVersionsRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1.types.ListProcessorVersionsRequest, dict]]): The request object. Request message for list all processor versions belongs to a processor. parent (:class:`str`): @@ -1179,13 +1197,13 @@ async def sample_list_processor_versions(): async def delete_processor_version( self, - request: Union[ - document_processor_service.DeleteProcessorVersionRequest, dict + request: Optional[ + Union[document_processor_service.DeleteProcessorVersionRequest, dict] ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deletes the processor version, all artifacts under @@ -1222,7 +1240,7 @@ async def sample_delete_processor_version(): print(response) Args: - request (Union[google.cloud.documentai_v1.types.DeleteProcessorVersionRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1.types.DeleteProcessorVersionRequest, dict]]): The request object. Request message for the delete processor version method. name (:class:`str`): @@ -1306,13 +1324,13 @@ async def sample_delete_processor_version(): async def deploy_processor_version( self, - request: Union[ - document_processor_service.DeployProcessorVersionRequest, dict + request: Optional[ + Union[document_processor_service.DeployProcessorVersionRequest, dict] ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deploys the processor version. @@ -1348,7 +1366,7 @@ async def sample_deploy_processor_version(): print(response) Args: - request (Union[google.cloud.documentai_v1.types.DeployProcessorVersionRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1.types.DeployProcessorVersionRequest, dict]]): The request object. Request message for the deploy processor version method. name (:class:`str`): @@ -1426,13 +1444,13 @@ async def sample_deploy_processor_version(): async def undeploy_processor_version( self, - request: Union[ - document_processor_service.UndeployProcessorVersionRequest, dict + request: Optional[ + Union[document_processor_service.UndeployProcessorVersionRequest, dict] ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Undeploys the processor version. @@ -1468,7 +1486,7 @@ async def sample_undeploy_processor_version(): print(response) Args: - request (Union[google.cloud.documentai_v1.types.UndeployProcessorVersionRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1.types.UndeployProcessorVersionRequest, dict]]): The request object. Request message for the undeploy processor version method. name (:class:`str`): @@ -1546,12 +1564,14 @@ async def sample_undeploy_processor_version(): async def create_processor( self, - request: Union[document_processor_service.CreateProcessorRequest, dict] = None, + request: Optional[ + Union[document_processor_service.CreateProcessorRequest, dict] + ] = None, *, - parent: str = None, - processor: gcd_processor.Processor = None, + parent: Optional[str] = None, + processor: Optional[gcd_processor.Processor] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gcd_processor.Processor: r"""Creates a processor from the type processor that the @@ -1585,7 +1605,7 @@ async def sample_create_processor(): print(response) Args: - request (Union[google.cloud.documentai_v1.types.CreateProcessorRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1.types.CreateProcessorRequest, dict]]): The request object. Request message for create a processor. Notice this request is sent to a regionalized backend service, and if the processor type is not @@ -1666,11 +1686,13 @@ async def sample_create_processor(): async def delete_processor( self, - request: Union[document_processor_service.DeleteProcessorRequest, dict] = None, + request: Optional[ + Union[document_processor_service.DeleteProcessorRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deletes the processor, unloads all deployed model @@ -1708,7 +1730,7 @@ async def sample_delete_processor(): print(response) Args: - request (Union[google.cloud.documentai_v1.types.DeleteProcessorRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1.types.DeleteProcessorRequest, dict]]): The request object. Request message for the delete processor method. name (:class:`str`): @@ -1792,10 +1814,12 @@ async def sample_delete_processor(): async def enable_processor( self, - request: Union[document_processor_service.EnableProcessorRequest, dict] = None, + request: Optional[ + Union[document_processor_service.EnableProcessorRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Enables a processor @@ -1831,7 +1855,7 @@ async def sample_enable_processor(): print(response) Args: - request (Union[google.cloud.documentai_v1.types.EnableProcessorRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1.types.EnableProcessorRequest, dict]]): The request object. Request message for the enable processor method. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -1887,10 +1911,12 @@ async def sample_enable_processor(): async def disable_processor( self, - request: Union[document_processor_service.DisableProcessorRequest, dict] = None, + request: Optional[ + Union[document_processor_service.DisableProcessorRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Disables a processor @@ -1926,7 +1952,7 @@ async def sample_disable_processor(): print(response) Args: - request (Union[google.cloud.documentai_v1.types.DisableProcessorRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1.types.DisableProcessorRequest, dict]]): The request object. Request message for the disable processor method. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -1982,12 +2008,12 @@ async def sample_disable_processor(): async def set_default_processor_version( self, - request: Union[ - document_processor_service.SetDefaultProcessorVersionRequest, dict + request: Optional[ + Union[document_processor_service.SetDefaultProcessorVersionRequest, dict] ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Set the default (active) version of a @@ -2029,7 +2055,7 @@ async def sample_set_default_processor_version(): print(response) Args: - request (Union[google.cloud.documentai_v1.types.SetDefaultProcessorVersionRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1.types.SetDefaultProcessorVersionRequest, dict]]): The request object. Request message for the set default processor version method. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -2088,11 +2114,13 @@ async def sample_set_default_processor_version(): async def review_document( self, - request: Union[document_processor_service.ReviewDocumentRequest, dict] = None, + request: Optional[ + Union[document_processor_service.ReviewDocumentRequest, dict] + ] = None, *, - human_review_config: str = None, + human_review_config: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Send a document for Human Review. The input document @@ -2133,7 +2161,7 @@ async def sample_review_document(): print(response) Args: - request (Union[google.cloud.documentai_v1.types.ReviewDocumentRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1.types.ReviewDocumentRequest, dict]]): The request object. Request message for review document method. human_review_config (:class:`str`): @@ -2223,10 +2251,10 @@ async def sample_review_document(): async def list_operations( self, - request: operations_pb2.ListOperationsRequest = None, + request: Optional[operations_pb2.ListOperationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Lists operations that match the specified filter in the request. @@ -2277,10 +2305,10 @@ async def list_operations( async def get_operation( self, - request: operations_pb2.GetOperationRequest = None, + request: Optional[operations_pb2.GetOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Gets the latest state of a long-running operation. @@ -2331,10 +2359,10 @@ async def get_operation( async def cancel_operation( self, - request: operations_pb2.CancelOperationRequest = None, + request: Optional[operations_pb2.CancelOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Starts asynchronous cancellation on a long-running operation. @@ -2385,10 +2413,10 @@ async def cancel_operation( async def get_location( self, - request: locations_pb2.GetLocationRequest = None, + request: Optional[locations_pb2.GetLocationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2439,10 +2467,10 @@ async def get_location( async def list_locations( self, - request: locations_pb2.ListLocationsRequest = None, + request: Optional[locations_pb2.ListLocationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. diff --git a/google/cloud/documentai_v1/services/document_processor_service/client.py b/google/cloud/documentai_v1/services/document_processor_service/client.py index 355f2711..f861ba72 100644 --- a/google/cloud/documentai_v1/services/document_processor_service/client.py +++ b/google/cloud/documentai_v1/services/document_processor_service/client.py @@ -16,7 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -72,7 +83,7 @@ class DocumentProcessorServiceClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[DocumentProcessorServiceTransport]: """Returns an appropriate transport class. @@ -420,7 +431,7 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, DocumentProcessorServiceTransport, None] = None, + transport: Optional[Union[str, DocumentProcessorServiceTransport]] = None, client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -518,11 +529,13 @@ def __init__( def process_document( self, - request: Union[document_processor_service.ProcessRequest, dict] = None, + request: Optional[ + Union[document_processor_service.ProcessRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> document_processor_service.ProcessResponse: r"""Processes a single document. @@ -633,11 +646,13 @@ def sample_process_document(): def batch_process_documents( self, - request: Union[document_processor_service.BatchProcessRequest, dict] = None, + request: Optional[ + Union[document_processor_service.BatchProcessRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""LRO endpoint to batch process many documents. The output is @@ -756,13 +771,13 @@ def sample_batch_process_documents(): def fetch_processor_types( self, - request: Union[ - document_processor_service.FetchProcessorTypesRequest, dict + request: Optional[ + Union[document_processor_service.FetchProcessorTypesRequest, dict] ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> document_processor_service.FetchProcessorTypesResponse: r"""Fetches processor types. Note that we do not use @@ -865,13 +880,13 @@ def sample_fetch_processor_types(): def list_processor_types( self, - request: Union[ - document_processor_service.ListProcessorTypesRequest, dict + request: Optional[ + Union[document_processor_service.ListProcessorTypesRequest, dict] ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListProcessorTypesPager: r"""Lists the processor types that exist. @@ -986,11 +1001,13 @@ def sample_list_processor_types(): def list_processors( self, - request: Union[document_processor_service.ListProcessorsRequest, dict] = None, + request: Optional[ + Union[document_processor_service.ListProcessorsRequest, dict] + ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListProcessorsPager: r"""Lists all processors which belong to this project. @@ -1101,11 +1118,13 @@ def sample_list_processors(): def get_processor( self, - request: Union[document_processor_service.GetProcessorRequest, dict] = None, + request: Optional[ + Union[document_processor_service.GetProcessorRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> processor.Processor: r"""Gets a processor detail. @@ -1204,13 +1223,13 @@ def sample_get_processor(): def get_processor_version( self, - request: Union[ - document_processor_service.GetProcessorVersionRequest, dict + request: Optional[ + Union[document_processor_service.GetProcessorVersionRequest, dict] ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> processor.ProcessorVersion: r"""Gets a processor version detail. @@ -1317,13 +1336,13 @@ def sample_get_processor_version(): def list_processor_versions( self, - request: Union[ - document_processor_service.ListProcessorVersionsRequest, dict + request: Optional[ + Union[document_processor_service.ListProcessorVersionsRequest, dict] ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListProcessorVersionsPager: r"""Lists all versions of a processor. @@ -1436,13 +1455,13 @@ def sample_list_processor_versions(): def delete_processor_version( self, - request: Union[ - document_processor_service.DeleteProcessorVersionRequest, dict + request: Optional[ + Union[document_processor_service.DeleteProcessorVersionRequest, dict] ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Deletes the processor version, all artifacts under @@ -1565,13 +1584,13 @@ def sample_delete_processor_version(): def deploy_processor_version( self, - request: Union[ - document_processor_service.DeployProcessorVersionRequest, dict + request: Optional[ + Union[document_processor_service.DeployProcessorVersionRequest, dict] ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Deploys the processor version. @@ -1687,13 +1706,13 @@ def sample_deploy_processor_version(): def undeploy_processor_version( self, - request: Union[ - document_processor_service.UndeployProcessorVersionRequest, dict + request: Optional[ + Union[document_processor_service.UndeployProcessorVersionRequest, dict] ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Undeploys the processor version. @@ -1813,12 +1832,14 @@ def sample_undeploy_processor_version(): def create_processor( self, - request: Union[document_processor_service.CreateProcessorRequest, dict] = None, + request: Optional[ + Union[document_processor_service.CreateProcessorRequest, dict] + ] = None, *, - parent: str = None, - processor: gcd_processor.Processor = None, + parent: Optional[str] = None, + processor: Optional[gcd_processor.Processor] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gcd_processor.Processor: r"""Creates a processor from the type processor that the @@ -1933,11 +1954,13 @@ def sample_create_processor(): def delete_processor( self, - request: Union[document_processor_service.DeleteProcessorRequest, dict] = None, + request: Optional[ + Union[document_processor_service.DeleteProcessorRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Deletes the processor, unloads all deployed model @@ -2059,10 +2082,12 @@ def sample_delete_processor(): def enable_processor( self, - request: Union[document_processor_service.EnableProcessorRequest, dict] = None, + request: Optional[ + Union[document_processor_service.EnableProcessorRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Enables a processor @@ -2155,10 +2180,12 @@ def sample_enable_processor(): def disable_processor( self, - request: Union[document_processor_service.DisableProcessorRequest, dict] = None, + request: Optional[ + Union[document_processor_service.DisableProcessorRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Disables a processor @@ -2251,12 +2278,12 @@ def sample_disable_processor(): def set_default_processor_version( self, - request: Union[ - document_processor_service.SetDefaultProcessorVersionRequest, dict + request: Optional[ + Union[document_processor_service.SetDefaultProcessorVersionRequest, dict] ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Set the default (active) version of a @@ -2364,11 +2391,13 @@ def sample_set_default_processor_version(): def review_document( self, - request: Union[document_processor_service.ReviewDocumentRequest, dict] = None, + request: Optional[ + Union[document_processor_service.ReviewDocumentRequest, dict] + ] = None, *, - human_review_config: str = None, + human_review_config: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Send a document for Human Review. The input document @@ -2502,10 +2531,10 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: operations_pb2.ListOperationsRequest = None, + request: Optional[operations_pb2.ListOperationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Lists operations that match the specified filter in the request. @@ -2556,10 +2585,10 @@ def list_operations( def get_operation( self, - request: operations_pb2.GetOperationRequest = None, + request: Optional[operations_pb2.GetOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Gets the latest state of a long-running operation. @@ -2610,10 +2639,10 @@ def get_operation( def cancel_operation( self, - request: operations_pb2.CancelOperationRequest = None, + request: Optional[operations_pb2.CancelOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Starts asynchronous cancellation on a long-running operation. @@ -2664,10 +2693,10 @@ def cancel_operation( def get_location( self, - request: locations_pb2.GetLocationRequest = None, + request: Optional[locations_pb2.GetLocationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2718,10 +2747,10 @@ def get_location( def list_locations( self, - request: locations_pb2.ListLocationsRequest = None, + request: Optional[locations_pb2.ListLocationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. diff --git a/google/cloud/documentai_v1/services/document_processor_service/transports/base.py b/google/cloud/documentai_v1/services/document_processor_service/transports/base.py index 719c003d..70a6139c 100644 --- a/google/cloud/documentai_v1/services/document_processor_service/transports/base.py +++ b/google/cloud/documentai_v1/services/document_processor_service/transports/base.py @@ -52,7 +52,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/documentai_v1/services/document_processor_service/transports/grpc.py b/google/cloud/documentai_v1/services/document_processor_service/transports/grpc.py index 8f317b50..666a6852 100644 --- a/google/cloud/documentai_v1/services/document_processor_service/transports/grpc.py +++ b/google/cloud/documentai_v1/services/document_processor_service/transports/grpc.py @@ -54,14 +54,14 @@ def __init__( self, *, host: str = "documentai.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -189,8 +189,8 @@ def __init__( def create_channel( cls, host: str = "documentai.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/documentai_v1/services/document_processor_service/transports/grpc_asyncio.py b/google/cloud/documentai_v1/services/document_processor_service/transports/grpc_asyncio.py index ada76f0f..39901026 100644 --- a/google/cloud/documentai_v1/services/document_processor_service/transports/grpc_asyncio.py +++ b/google/cloud/documentai_v1/services/document_processor_service/transports/grpc_asyncio.py @@ -56,7 +56,7 @@ class DocumentProcessorServiceGrpcAsyncIOTransport(DocumentProcessorServiceTrans def create_channel( cls, host: str = "documentai.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -99,15 +99,15 @@ def __init__( self, *, host: str = "documentai.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/documentai_v1/types/barcode.py b/google/cloud/documentai_v1/types/barcode.py index ab8a0e63..4f4209c7 100644 --- a/google/cloud/documentai_v1/types/barcode.py +++ b/google/cloud/documentai_v1/types/barcode.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -65,15 +67,15 @@ class Barcode(proto.Message): ``'MEBKM:TITLE:Google;URL:https://www.google.com;;'``. """ - format_ = proto.Field( + format_: str = proto.Field( proto.STRING, number=1, ) - value_format = proto.Field( + value_format: str = proto.Field( proto.STRING, number=2, ) - raw_value = proto.Field( + raw_value: str = proto.Field( proto.STRING, number=3, ) diff --git a/google/cloud/documentai_v1/types/document.py b/google/cloud/documentai_v1/types/document.py index b2e72fd3..df7bf303 100644 --- a/google/cloud/documentai_v1/types/document.py +++ b/google/cloud/documentai_v1/types/document.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import timestamp_pb2 # type: ignore from google.rpc import status_pb2 # type: ignore from google.type import color_pb2 # type: ignore @@ -69,21 +71,21 @@ class Document(proto.Message): text (str): Optional. UTF-8 encoded text in reading order from the document. - text_styles (Sequence[google.cloud.documentai_v1.types.Document.Style]): + text_styles (MutableSequence[google.cloud.documentai_v1.types.Document.Style]): Placeholder. Styles for the [Document.text][google.cloud.documentai.v1.Document.text]. - pages (Sequence[google.cloud.documentai_v1.types.Document.Page]): + pages (MutableSequence[google.cloud.documentai_v1.types.Document.Page]): Visual page layout for the [Document][google.cloud.documentai.v1.Document]. - entities (Sequence[google.cloud.documentai_v1.types.Document.Entity]): + entities (MutableSequence[google.cloud.documentai_v1.types.Document.Entity]): A list of entities detected on [Document.text][google.cloud.documentai.v1.Document.text]. For document shards, entities in this list may cross shard boundaries. - entity_relations (Sequence[google.cloud.documentai_v1.types.Document.EntityRelation]): + entity_relations (MutableSequence[google.cloud.documentai_v1.types.Document.EntityRelation]): Placeholder. Relationship among [Document.entities][google.cloud.documentai.v1.Document.entities]. - text_changes (Sequence[google.cloud.documentai_v1.types.Document.TextChange]): + text_changes (MutableSequence[google.cloud.documentai_v1.types.Document.TextChange]): Placeholder. A list of text corrections made to [Document.text][google.cloud.documentai.v1.Document.text]. This is usually used for annotating corrections to OCR @@ -97,7 +99,7 @@ class Document(proto.Message): error (google.rpc.status_pb2.Status): Any error that occurred while processing this document. - revisions (Sequence[google.cloud.documentai_v1.types.Document.Revision]): + revisions (MutableSequence[google.cloud.documentai_v1.types.Document.Revision]): Placeholder. Revision history of this document. """ @@ -118,15 +120,15 @@ class ShardInfo(proto.Message): the overall document global text. """ - shard_index = proto.Field( + shard_index: int = proto.Field( proto.INT64, number=1, ) - shard_count = proto.Field( + shard_count: int = proto.Field( proto.INT64, number=2, ) - text_offset = proto.Field( + text_offset: int = proto.Field( proto.INT64, number=3, ) @@ -170,48 +172,48 @@ class FontSize(proto.Message): (in, px, pt, etc.). """ - size = proto.Field( + size: float = proto.Field( proto.FLOAT, number=1, ) - unit = proto.Field( + unit: str = proto.Field( proto.STRING, number=2, ) - text_anchor = proto.Field( + text_anchor: "Document.TextAnchor" = proto.Field( proto.MESSAGE, number=1, message="Document.TextAnchor", ) - color = proto.Field( + color: color_pb2.Color = proto.Field( proto.MESSAGE, number=2, message=color_pb2.Color, ) - background_color = proto.Field( + background_color: color_pb2.Color = proto.Field( proto.MESSAGE, number=3, message=color_pb2.Color, ) - font_weight = proto.Field( + font_weight: str = proto.Field( proto.STRING, number=4, ) - text_style = proto.Field( + text_style: str = proto.Field( proto.STRING, number=5, ) - text_decoration = proto.Field( + text_decoration: str = proto.Field( proto.STRING, number=6, ) - font_size = proto.Field( + font_size: "Document.Style.FontSize" = proto.Field( proto.MESSAGE, number=7, message="Document.Style.FontSize", ) - font_family = proto.Field( + font_family: str = proto.Field( proto.STRING, number=8, ) @@ -232,7 +234,7 @@ class Page(proto.Message): preprocessed to remove any skew, rotation, and distortions such that the annotation bounding boxes can be upright and axis-aligned. - transforms (Sequence[google.cloud.documentai_v1.types.Document.Page.Matrix]): + transforms (MutableSequence[google.cloud.documentai_v1.types.Document.Page.Matrix]): Transformation matrices that were applied to the original document image to produce [Page.image][google.cloud.documentai.v1.Document.Page.image]. @@ -241,38 +243,38 @@ class Page(proto.Message): layout (google.cloud.documentai_v1.types.Document.Page.Layout): [Layout][google.cloud.documentai.v1.Document.Page.Layout] for the page. - detected_languages (Sequence[google.cloud.documentai_v1.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. - blocks (Sequence[google.cloud.documentai_v1.types.Document.Page.Block]): + blocks (MutableSequence[google.cloud.documentai_v1.types.Document.Page.Block]): A list of visually detected text blocks on the page. A block has a set of lines (collected into paragraphs) that have a common line-spacing and orientation. - paragraphs (Sequence[google.cloud.documentai_v1.types.Document.Page.Paragraph]): + paragraphs (MutableSequence[google.cloud.documentai_v1.types.Document.Page.Paragraph]): A list of visually detected text paragraphs on the page. A collection of lines that a human would perceive as a paragraph. - lines (Sequence[google.cloud.documentai_v1.types.Document.Page.Line]): + lines (MutableSequence[google.cloud.documentai_v1.types.Document.Page.Line]): A list of visually detected text lines on the page. A collection of tokens that a human would perceive as a line. - tokens (Sequence[google.cloud.documentai_v1.types.Document.Page.Token]): + tokens (MutableSequence[google.cloud.documentai_v1.types.Document.Page.Token]): A list of visually detected tokens on the page. - visual_elements (Sequence[google.cloud.documentai_v1.types.Document.Page.VisualElement]): + visual_elements (MutableSequence[google.cloud.documentai_v1.types.Document.Page.VisualElement]): A list of detected non-text visual elements e.g. checkbox, signature etc. on the page. - tables (Sequence[google.cloud.documentai_v1.types.Document.Page.Table]): + tables (MutableSequence[google.cloud.documentai_v1.types.Document.Page.Table]): A list of visually detected tables on the page. - form_fields (Sequence[google.cloud.documentai_v1.types.Document.Page.FormField]): + form_fields (MutableSequence[google.cloud.documentai_v1.types.Document.Page.FormField]): A list of visually detected form fields on the page. - symbols (Sequence[google.cloud.documentai_v1.types.Document.Page.Symbol]): + symbols (MutableSequence[google.cloud.documentai_v1.types.Document.Page.Symbol]): A list of visually detected symbols on the page. - detected_barcodes (Sequence[google.cloud.documentai_v1.types.Document.Page.DetectedBarcode]): + detected_barcodes (MutableSequence[google.cloud.documentai_v1.types.Document.Page.DetectedBarcode]): A list of detected barcodes. image_quality_scores (google.cloud.documentai_v1.types.Document.Page.ImageQualityScores): Image Quality Scores. @@ -292,15 +294,15 @@ class Dimension(proto.Message): Dimension unit. """ - width = proto.Field( + width: float = proto.Field( proto.FLOAT, number=1, ) - height = proto.Field( + height: float = proto.Field( proto.FLOAT, number=2, ) - unit = proto.Field( + unit: str = proto.Field( proto.STRING, number=3, ) @@ -319,19 +321,19 @@ class Image(proto.Message): Height of the image in pixels. """ - content = proto.Field( + content: bytes = proto.Field( proto.BYTES, number=1, ) - mime_type = proto.Field( + mime_type: str = proto.Field( proto.STRING, number=2, ) - width = proto.Field( + width: int = proto.Field( proto.INT32, number=3, ) - height = proto.Field( + height: int = proto.Field( proto.INT32, number=4, ) @@ -355,19 +357,19 @@ class Matrix(proto.Message): The matrix data. """ - rows = proto.Field( + rows: int = proto.Field( proto.INT32, number=1, ) - cols = proto.Field( + cols: int = proto.Field( proto.INT32, number=2, ) - type_ = proto.Field( + type_: int = proto.Field( proto.INT32, number=3, ) - data = proto.Field( + data: bytes = proto.Field( proto.BYTES, number=4, ) @@ -401,21 +403,21 @@ class Orientation(proto.Enum): PAGE_DOWN = 3 PAGE_LEFT = 4 - text_anchor = proto.Field( + text_anchor: "Document.TextAnchor" = proto.Field( proto.MESSAGE, number=1, message="Document.TextAnchor", ) - confidence = proto.Field( + confidence: float = proto.Field( proto.FLOAT, number=2, ) - bounding_poly = proto.Field( + bounding_poly: geometry.BoundingPoly = proto.Field( proto.MESSAGE, number=3, message=geometry.BoundingPoly, ) - orientation = proto.Field( + orientation: "Document.Page.Layout.Orientation" = proto.Field( proto.ENUM, number=4, enum="Document.Page.Layout.Orientation", @@ -429,24 +431,26 @@ class Block(proto.Message): layout (google.cloud.documentai_v1.types.Document.Page.Layout): [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Block][google.cloud.documentai.v1.Document.Page.Block]. - detected_languages (Sequence[google.cloud.documentai_v1.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. provenance (google.cloud.documentai_v1.types.Document.Provenance): The history of this annotation. """ - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=2, message="Document.Page.DetectedLanguage", ) - provenance = proto.Field( + provenance: "Document.Provenance" = proto.Field( proto.MESSAGE, number=3, message="Document.Provenance", @@ -461,24 +465,26 @@ class Paragraph(proto.Message): [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Paragraph][google.cloud.documentai.v1.Document.Page.Paragraph]. - detected_languages (Sequence[google.cloud.documentai_v1.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. provenance (google.cloud.documentai_v1.types.Document.Provenance): The history of this annotation. """ - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=2, message="Document.Page.DetectedLanguage", ) - provenance = proto.Field( + provenance: "Document.Provenance" = proto.Field( proto.MESSAGE, number=3, message="Document.Provenance", @@ -493,24 +499,26 @@ class Line(proto.Message): layout (google.cloud.documentai_v1.types.Document.Page.Layout): [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Line][google.cloud.documentai.v1.Document.Page.Line]. - detected_languages (Sequence[google.cloud.documentai_v1.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. provenance (google.cloud.documentai_v1.types.Document.Provenance): The history of this annotation. """ - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=2, message="Document.Page.DetectedLanguage", ) - provenance = proto.Field( + provenance: "Document.Provenance" = proto.Field( proto.MESSAGE, number=3, message="Document.Provenance", @@ -526,7 +534,7 @@ class Token(proto.Message): detected_break (google.cloud.documentai_v1.types.Document.Page.Token.DetectedBreak): Detected break at the end of a [Token][google.cloud.documentai.v1.Document.Page.Token]. - detected_languages (Sequence[google.cloud.documentai_v1.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. provenance (google.cloud.documentai_v1.types.Document.Provenance): @@ -549,28 +557,30 @@ class Type(proto.Enum): WIDE_SPACE = 2 HYPHEN = 3 - type_ = proto.Field( + type_: "Document.Page.Token.DetectedBreak.Type" = proto.Field( proto.ENUM, number=1, enum="Document.Page.Token.DetectedBreak.Type", ) - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - detected_break = proto.Field( + detected_break: "Document.Page.Token.DetectedBreak" = proto.Field( proto.MESSAGE, number=2, message="Document.Page.Token.DetectedBreak", ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=3, message="Document.Page.DetectedLanguage", ) - provenance = proto.Field( + provenance: "Document.Provenance" = proto.Field( proto.MESSAGE, number=4, message="Document.Provenance", @@ -584,17 +594,19 @@ class Symbol(proto.Message): [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Symbol][google.cloud.documentai.v1.Document.Page.Symbol]. - detected_languages (Sequence[google.cloud.documentai_v1.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. """ - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=2, message="Document.Page.DetectedLanguage", @@ -612,21 +624,23 @@ class VisualElement(proto.Message): type_ (str): Type of the [VisualElement][google.cloud.documentai.v1.Document.Page.VisualElement]. - detected_languages (Sequence[google.cloud.documentai_v1.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. """ - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - type_ = proto.Field( + type_: str = proto.Field( proto.STRING, number=2, ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=3, message="Document.Page.DetectedLanguage", @@ -639,11 +653,11 @@ class Table(proto.Message): layout (google.cloud.documentai_v1.types.Document.Page.Layout): [Layout][google.cloud.documentai.v1.Document.Page.Layout] for [Table][google.cloud.documentai.v1.Document.Page.Table]. - header_rows (Sequence[google.cloud.documentai_v1.types.Document.Page.Table.TableRow]): + header_rows (MutableSequence[google.cloud.documentai_v1.types.Document.Page.Table.TableRow]): Header rows of the table. - body_rows (Sequence[google.cloud.documentai_v1.types.Document.Page.Table.TableRow]): + body_rows (MutableSequence[google.cloud.documentai_v1.types.Document.Page.Table.TableRow]): Body rows of the table. - detected_languages (Sequence[google.cloud.documentai_v1.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. provenance (google.cloud.documentai_v1.types.Document.Provenance): @@ -654,11 +668,13 @@ class TableRow(proto.Message): r"""A row of table cells. Attributes: - cells (Sequence[google.cloud.documentai_v1.types.Document.Page.Table.TableCell]): + cells (MutableSequence[google.cloud.documentai_v1.types.Document.Page.Table.TableCell]): Cells that make up this row. """ - cells = proto.RepeatedField( + cells: MutableSequence[ + "Document.Page.Table.TableCell" + ] = proto.RepeatedField( proto.MESSAGE, number=1, message="Document.Page.Table.TableCell", @@ -676,51 +692,59 @@ class TableCell(proto.Message): How many rows this cell spans. col_span (int): How many columns this cell spans. - detected_languages (Sequence[google.cloud.documentai_v1.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. """ - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - row_span = proto.Field( + row_span: int = proto.Field( proto.INT32, number=2, ) - col_span = proto.Field( + col_span: int = proto.Field( proto.INT32, number=3, ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=4, message="Document.Page.DetectedLanguage", ) - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - header_rows = proto.RepeatedField( + header_rows: MutableSequence[ + "Document.Page.Table.TableRow" + ] = proto.RepeatedField( proto.MESSAGE, number=2, message="Document.Page.Table.TableRow", ) - body_rows = proto.RepeatedField( + body_rows: MutableSequence[ + "Document.Page.Table.TableRow" + ] = proto.RepeatedField( proto.MESSAGE, number=3, message="Document.Page.Table.TableRow", ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=4, message="Document.Page.DetectedLanguage", ) - provenance = proto.Field( + provenance: "Document.Provenance" = proto.Field( proto.MESSAGE, number=5, message="Document.Provenance", @@ -741,10 +765,10 @@ class FormField(proto.Message): for the [FormField][google.cloud.documentai.v1.Document.Page.FormField] value. - name_detected_languages (Sequence[google.cloud.documentai_v1.types.Document.Page.DetectedLanguage]): + name_detected_languages (MutableSequence[google.cloud.documentai_v1.types.Document.Page.DetectedLanguage]): A list of detected languages for name together with confidence. - value_detected_languages (Sequence[google.cloud.documentai_v1.types.Document.Page.DetectedLanguage]): + value_detected_languages (MutableSequence[google.cloud.documentai_v1.types.Document.Page.DetectedLanguage]): A list of detected languages for value together with confidence. value_type (str): @@ -768,39 +792,43 @@ class FormField(proto.Message): The history of this annotation. """ - field_name = proto.Field( + field_name: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - field_value = proto.Field( + field_value: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=2, message="Document.Page.Layout", ) - name_detected_languages = proto.RepeatedField( + name_detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=3, message="Document.Page.DetectedLanguage", ) - value_detected_languages = proto.RepeatedField( + value_detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=4, message="Document.Page.DetectedLanguage", ) - value_type = proto.Field( + value_type: str = proto.Field( proto.STRING, number=5, ) - corrected_key_text = proto.Field( + corrected_key_text: str = proto.Field( proto.STRING, number=6, ) - corrected_value_text = proto.Field( + corrected_value_text: str = proto.Field( proto.STRING, number=7, ) - provenance = proto.Field( + provenance: "Document.Provenance" = proto.Field( proto.MESSAGE, number=8, message="Document.Provenance", @@ -819,12 +847,12 @@ class DetectedBarcode(proto.Message): [DetectedBarcode][google.cloud.documentai.v1.Document.Page.DetectedBarcode]. """ - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - barcode = proto.Field( + barcode: gcd_barcode.Barcode = proto.Field( proto.MESSAGE, number=2, message=gcd_barcode.Barcode, @@ -842,11 +870,11 @@ class DetectedLanguage(proto.Message): Confidence of detected language. Range ``[0, 1]``. """ - language_code = proto.Field( + language_code: str = proto.Field( proto.STRING, number=1, ) - confidence = proto.Field( + confidence: float = proto.Field( proto.FLOAT, number=2, ) @@ -858,7 +886,7 @@ class ImageQualityScores(proto.Message): quality_score (float): The overall quality score. Range ``[0, 1]`` where 1 is perfect quality. - detected_defects (Sequence[google.cloud.documentai_v1.types.Document.Page.ImageQualityScores.DetectedDefect]): + detected_defects (MutableSequence[google.cloud.documentai_v1.types.Document.Page.ImageQualityScores.DetectedDefect]): A list of detected defects. """ @@ -882,105 +910,113 @@ class DetectedDefect(proto.Message): indicates strong confidence of that the defect exists. """ - type_ = proto.Field( + type_: str = proto.Field( proto.STRING, number=1, ) - confidence = proto.Field( + confidence: float = proto.Field( proto.FLOAT, number=2, ) - quality_score = proto.Field( + quality_score: float = proto.Field( proto.FLOAT, number=1, ) - detected_defects = proto.RepeatedField( + detected_defects: MutableSequence[ + "Document.Page.ImageQualityScores.DetectedDefect" + ] = proto.RepeatedField( proto.MESSAGE, number=2, message="Document.Page.ImageQualityScores.DetectedDefect", ) - page_number = proto.Field( + page_number: int = proto.Field( proto.INT32, number=1, ) - image = proto.Field( + image: "Document.Page.Image" = proto.Field( proto.MESSAGE, number=13, message="Document.Page.Image", ) - transforms = proto.RepeatedField( + transforms: MutableSequence["Document.Page.Matrix"] = proto.RepeatedField( proto.MESSAGE, number=14, message="Document.Page.Matrix", ) - dimension = proto.Field( + dimension: "Document.Page.Dimension" = proto.Field( proto.MESSAGE, number=2, message="Document.Page.Dimension", ) - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=3, message="Document.Page.Layout", ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=4, message="Document.Page.DetectedLanguage", ) - blocks = proto.RepeatedField( + blocks: MutableSequence["Document.Page.Block"] = proto.RepeatedField( proto.MESSAGE, number=5, message="Document.Page.Block", ) - paragraphs = proto.RepeatedField( + paragraphs: MutableSequence["Document.Page.Paragraph"] = proto.RepeatedField( proto.MESSAGE, number=6, message="Document.Page.Paragraph", ) - lines = proto.RepeatedField( + lines: MutableSequence["Document.Page.Line"] = proto.RepeatedField( proto.MESSAGE, number=7, message="Document.Page.Line", ) - tokens = proto.RepeatedField( + tokens: MutableSequence["Document.Page.Token"] = proto.RepeatedField( proto.MESSAGE, number=8, message="Document.Page.Token", ) - visual_elements = proto.RepeatedField( + visual_elements: MutableSequence[ + "Document.Page.VisualElement" + ] = proto.RepeatedField( proto.MESSAGE, number=9, message="Document.Page.VisualElement", ) - tables = proto.RepeatedField( + tables: MutableSequence["Document.Page.Table"] = proto.RepeatedField( proto.MESSAGE, number=10, message="Document.Page.Table", ) - form_fields = proto.RepeatedField( + form_fields: MutableSequence["Document.Page.FormField"] = proto.RepeatedField( proto.MESSAGE, number=11, message="Document.Page.FormField", ) - symbols = proto.RepeatedField( + symbols: MutableSequence["Document.Page.Symbol"] = proto.RepeatedField( proto.MESSAGE, number=12, message="Document.Page.Symbol", ) - detected_barcodes = proto.RepeatedField( + detected_barcodes: MutableSequence[ + "Document.Page.DetectedBarcode" + ] = proto.RepeatedField( proto.MESSAGE, number=15, message="Document.Page.DetectedBarcode", ) - image_quality_scores = proto.Field( + image_quality_scores: "Document.Page.ImageQualityScores" = proto.Field( proto.MESSAGE, number=17, message="Document.Page.ImageQualityScores", ) - provenance = proto.Field( + provenance: "Document.Provenance" = proto.Field( proto.MESSAGE, number=16, message="Document.Provenance", @@ -1019,7 +1055,7 @@ class Entity(proto.Message): the type (e.g. address) is not supported for certain parsers. This field is also only populated for certain supported document types. - properties (Sequence[google.cloud.documentai_v1.types.Document.Entity]): + properties (MutableSequence[google.cloud.documentai_v1.types.Document.Entity]): Optional. Entities can be nested to form a hierarchical data structure representing the content in the document. @@ -1094,96 +1130,96 @@ class NormalizedValue(proto.Message): text format. """ - money_value = proto.Field( + money_value: money_pb2.Money = proto.Field( proto.MESSAGE, number=2, oneof="structured_value", message=money_pb2.Money, ) - date_value = proto.Field( + date_value: date_pb2.Date = proto.Field( proto.MESSAGE, number=3, oneof="structured_value", message=date_pb2.Date, ) - datetime_value = proto.Field( + datetime_value: datetime_pb2.DateTime = proto.Field( proto.MESSAGE, number=4, oneof="structured_value", message=datetime_pb2.DateTime, ) - address_value = proto.Field( + address_value: postal_address_pb2.PostalAddress = proto.Field( proto.MESSAGE, number=5, oneof="structured_value", message=postal_address_pb2.PostalAddress, ) - boolean_value = proto.Field( + boolean_value: bool = proto.Field( proto.BOOL, number=6, oneof="structured_value", ) - integer_value = proto.Field( + integer_value: int = proto.Field( proto.INT32, number=7, oneof="structured_value", ) - float_value = proto.Field( + float_value: float = proto.Field( proto.FLOAT, number=8, oneof="structured_value", ) - text = proto.Field( + text: str = proto.Field( proto.STRING, number=1, ) - text_anchor = proto.Field( + text_anchor: "Document.TextAnchor" = proto.Field( proto.MESSAGE, number=1, message="Document.TextAnchor", ) - type_ = proto.Field( + type_: str = proto.Field( proto.STRING, number=2, ) - mention_text = proto.Field( + mention_text: str = proto.Field( proto.STRING, number=3, ) - mention_id = proto.Field( + mention_id: str = proto.Field( proto.STRING, number=4, ) - confidence = proto.Field( + confidence: float = proto.Field( proto.FLOAT, number=5, ) - page_anchor = proto.Field( + page_anchor: "Document.PageAnchor" = proto.Field( proto.MESSAGE, number=6, message="Document.PageAnchor", ) - id = proto.Field( + id: str = proto.Field( proto.STRING, number=7, ) - normalized_value = proto.Field( + normalized_value: "Document.Entity.NormalizedValue" = proto.Field( proto.MESSAGE, number=9, message="Document.Entity.NormalizedValue", ) - properties = proto.RepeatedField( + properties: MutableSequence["Document.Entity"] = proto.RepeatedField( proto.MESSAGE, number=10, message="Document.Entity", ) - provenance = proto.Field( + provenance: "Document.Provenance" = proto.Field( proto.MESSAGE, number=11, message="Document.Provenance", ) - redacted = proto.Field( + redacted: bool = proto.Field( proto.BOOL, number=12, ) @@ -1201,15 +1237,15 @@ class EntityRelation(proto.Message): Relationship description. """ - subject_id = proto.Field( + subject_id: str = proto.Field( proto.STRING, number=1, ) - object_id = proto.Field( + object_id: str = proto.Field( proto.STRING, number=2, ) - relation = proto.Field( + relation: str = proto.Field( proto.STRING, number=3, ) @@ -1219,7 +1255,7 @@ class TextAnchor(proto.Message): [Document.text][google.cloud.documentai.v1.Document.text]. Attributes: - text_segments (Sequence[google.cloud.documentai_v1.types.Document.TextAnchor.TextSegment]): + text_segments (MutableSequence[google.cloud.documentai_v1.types.Document.TextAnchor.TextSegment]): The text segments from the [Document.text][google.cloud.documentai.v1.Document.text]. content (str): @@ -1246,21 +1282,23 @@ class TextSegment(proto.Message): [Document.text][google.cloud.documentai.v1.Document.text]. """ - start_index = proto.Field( + start_index: int = proto.Field( proto.INT64, number=1, ) - end_index = proto.Field( + end_index: int = proto.Field( proto.INT64, number=2, ) - text_segments = proto.RepeatedField( + text_segments: MutableSequence[ + "Document.TextAnchor.TextSegment" + ] = proto.RepeatedField( proto.MESSAGE, number=1, message="Document.TextAnchor.TextSegment", ) - content = proto.Field( + content: str = proto.Field( proto.STRING, number=2, ) @@ -1272,7 +1310,7 @@ class PageAnchor(proto.Message): optionally reference specific layout element types. Attributes: - page_refs (Sequence[google.cloud.documentai_v1.types.Document.PageAnchor.PageRef]): + page_refs (MutableSequence[google.cloud.documentai_v1.types.Document.PageAnchor.PageRef]): One or more references to visual page elements """ @@ -1315,30 +1353,30 @@ class LayoutType(proto.Enum): TABLE = 6 FORM_FIELD = 7 - page = proto.Field( + page: int = proto.Field( proto.INT64, number=1, ) - layout_type = proto.Field( + layout_type: "Document.PageAnchor.PageRef.LayoutType" = proto.Field( proto.ENUM, number=2, enum="Document.PageAnchor.PageRef.LayoutType", ) - layout_id = proto.Field( + layout_id: str = proto.Field( proto.STRING, number=3, ) - bounding_poly = proto.Field( + bounding_poly: geometry.BoundingPoly = proto.Field( proto.MESSAGE, number=4, message=geometry.BoundingPoly, ) - confidence = proto.Field( + confidence: float = proto.Field( proto.FLOAT, number=5, ) - page_refs = proto.RepeatedField( + page_refs: MutableSequence["Document.PageAnchor.PageRef"] = proto.RepeatedField( proto.MESSAGE, number=1, message="Document.PageAnchor.PageRef", @@ -1355,7 +1393,7 @@ class Provenance(proto.Message): id (int): The Id of this operation. Needs to be unique within the scope of the revision. - parents (Sequence[google.cloud.documentai_v1.types.Document.Provenance.Parent]): + parents (MutableSequence[google.cloud.documentai_v1.types.Document.Provenance.Parent]): References to the original elements that are replaced. type_ (google.cloud.documentai_v1.types.Document.Provenance.OperationType): @@ -1391,33 +1429,33 @@ class Parent(proto.Message): The id of the parent provenance. """ - revision = proto.Field( + revision: int = proto.Field( proto.INT32, number=1, ) - index = proto.Field( + index: int = proto.Field( proto.INT32, number=3, ) - id = proto.Field( + id: int = proto.Field( proto.INT32, number=2, ) - revision = proto.Field( + revision: int = proto.Field( proto.INT32, number=1, ) - id = proto.Field( + id: int = proto.Field( proto.INT32, number=2, ) - parents = proto.RepeatedField( + parents: MutableSequence["Document.Provenance.Parent"] = proto.RepeatedField( proto.MESSAGE, number=3, message="Document.Provenance.Parent", ) - type_ = proto.Field( + type_: "Document.Provenance.OperationType" = proto.Field( proto.ENUM, number=4, enum="Document.Provenance.OperationType", @@ -1447,11 +1485,11 @@ class Revision(proto.Message): id (str): Id of the revision. Unique within the context of the document. - parent (Sequence[int]): + parent (MutableSequence[int]): The revisions that this revision is based on. This can include one or more parent (when documents are merged.) This field represents the index into the ``revisions`` field. - parent_ids (Sequence[str]): + parent_ids (MutableSequence[str]): The revisions that this revision is based on. Must include all the ids that have anything to do with this revision - eg. there are ``provenance.parent.revision`` fields that @@ -1475,43 +1513,43 @@ class HumanReview(proto.Message): is ``rejected``. """ - state = proto.Field( + state: str = proto.Field( proto.STRING, number=1, ) - state_message = proto.Field( + state_message: str = proto.Field( proto.STRING, number=2, ) - agent = proto.Field( + agent: str = proto.Field( proto.STRING, number=4, oneof="source", ) - processor = proto.Field( + processor: str = proto.Field( proto.STRING, number=5, oneof="source", ) - id = proto.Field( + id: str = proto.Field( proto.STRING, number=1, ) - parent = proto.RepeatedField( + parent: MutableSequence[int] = proto.RepeatedField( proto.INT32, number=2, ) - parent_ids = proto.RepeatedField( + parent_ids: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=7, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, ) - human_review = proto.Field( + human_review: "Document.Revision.HumanReview" = proto.Field( proto.MESSAGE, number=6, message="Document.Revision.HumanReview", @@ -1530,79 +1568,79 @@ class TextChange(proto.Message): changed_text (str): The text that replaces the text identified in the ``text_anchor``. - provenance (Sequence[google.cloud.documentai_v1.types.Document.Provenance]): + provenance (MutableSequence[google.cloud.documentai_v1.types.Document.Provenance]): The history of this annotation. """ - text_anchor = proto.Field( + text_anchor: "Document.TextAnchor" = proto.Field( proto.MESSAGE, number=1, message="Document.TextAnchor", ) - changed_text = proto.Field( + changed_text: str = proto.Field( proto.STRING, number=2, ) - provenance = proto.RepeatedField( + provenance: MutableSequence["Document.Provenance"] = proto.RepeatedField( proto.MESSAGE, number=3, message="Document.Provenance", ) - uri = proto.Field( + uri: str = proto.Field( proto.STRING, number=1, oneof="source", ) - content = proto.Field( + content: bytes = proto.Field( proto.BYTES, number=2, oneof="source", ) - mime_type = proto.Field( + mime_type: str = proto.Field( proto.STRING, number=3, ) - text = proto.Field( + text: str = proto.Field( proto.STRING, number=4, ) - text_styles = proto.RepeatedField( + text_styles: MutableSequence[Style] = proto.RepeatedField( proto.MESSAGE, number=5, message=Style, ) - pages = proto.RepeatedField( + pages: MutableSequence[Page] = proto.RepeatedField( proto.MESSAGE, number=6, message=Page, ) - entities = proto.RepeatedField( + entities: MutableSequence[Entity] = proto.RepeatedField( proto.MESSAGE, number=7, message=Entity, ) - entity_relations = proto.RepeatedField( + entity_relations: MutableSequence[EntityRelation] = proto.RepeatedField( proto.MESSAGE, number=8, message=EntityRelation, ) - text_changes = proto.RepeatedField( + text_changes: MutableSequence[TextChange] = proto.RepeatedField( proto.MESSAGE, number=14, message=TextChange, ) - shard_info = proto.Field( + shard_info: ShardInfo = proto.Field( proto.MESSAGE, number=9, message=ShardInfo, ) - error = proto.Field( + error: status_pb2.Status = proto.Field( proto.MESSAGE, number=10, message=status_pb2.Status, ) - revisions = proto.RepeatedField( + revisions: MutableSequence[Revision] = proto.RepeatedField( proto.MESSAGE, number=13, message=Revision, diff --git a/google/cloud/documentai_v1/types/document_io.py b/google/cloud/documentai_v1/types/document_io.py index 86ac128b..c09b8ba3 100644 --- a/google/cloud/documentai_v1/types/document_io.py +++ b/google/cloud/documentai_v1/types/document_io.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import field_mask_pb2 # type: ignore import proto # type: ignore @@ -41,11 +43,11 @@ class RawDocument(proto.Message): [content][google.cloud.documentai.v1.RawDocument.content]. """ - content = proto.Field( + content: bytes = proto.Field( proto.BYTES, number=1, ) - mime_type = proto.Field( + mime_type: str = proto.Field( proto.STRING, number=2, ) @@ -61,11 +63,11 @@ class GcsDocument(proto.Message): An IANA MIME type (RFC6838) of the content. """ - gcs_uri = proto.Field( + gcs_uri: str = proto.Field( proto.STRING, number=1, ) - mime_type = proto.Field( + mime_type: str = proto.Field( proto.STRING, number=2, ) @@ -75,11 +77,11 @@ class GcsDocuments(proto.Message): r"""Specifies a set of documents on Cloud Storage. Attributes: - documents (Sequence[google.cloud.documentai_v1.types.GcsDocument]): + documents (MutableSequence[google.cloud.documentai_v1.types.GcsDocument]): The list of documents. """ - documents = proto.RepeatedField( + documents: MutableSequence["GcsDocument"] = proto.RepeatedField( proto.MESSAGE, number=1, message="GcsDocument", @@ -95,7 +97,7 @@ class GcsPrefix(proto.Message): The URI prefix. """ - gcs_uri_prefix = proto.Field( + gcs_uri_prefix: str = proto.Field( proto.STRING, number=1, ) @@ -125,13 +127,13 @@ class BatchDocumentsInputConfig(proto.Message): This field is a member of `oneof`_ ``source``. """ - gcs_prefix = proto.Field( + gcs_prefix: "GcsPrefix" = proto.Field( proto.MESSAGE, number=1, oneof="source", message="GcsPrefix", ) - gcs_documents = proto.Field( + gcs_documents: "GcsDocuments" = proto.Field( proto.MESSAGE, number=2, oneof="source", @@ -168,17 +170,17 @@ class GcsOutputConfig(proto.Message): ``pages.{page_field_name}``. """ - gcs_uri = proto.Field( + gcs_uri: str = proto.Field( proto.STRING, number=1, ) - field_mask = proto.Field( + field_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, ) - gcs_output_config = proto.Field( + gcs_output_config: GcsOutputConfig = proto.Field( proto.MESSAGE, number=1, oneof="destination", diff --git a/google/cloud/documentai_v1/types/document_processor_service.py b/google/cloud/documentai_v1/types/document_processor_service.py index 0aab79dd..3c5d97dc 100644 --- a/google/cloud/documentai_v1/types/document_processor_service.py +++ b/google/cloud/documentai_v1/types/document_processor_service.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore from google.rpc import status_pb2 # type: ignore @@ -112,27 +114,27 @@ class ProcessRequest(proto.Message): ``pages.{page_field_name}``. """ - inline_document = proto.Field( + inline_document: gcd_document.Document = proto.Field( proto.MESSAGE, number=4, oneof="source", message=gcd_document.Document, ) - raw_document = proto.Field( + raw_document: document_io.RawDocument = proto.Field( proto.MESSAGE, number=5, oneof="source", message=document_io.RawDocument, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - skip_human_review = proto.Field( + skip_human_review: bool = proto.Field( proto.BOOL, number=3, ) - field_mask = proto.Field( + field_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=6, message=field_mask_pb2.FieldMask, @@ -165,16 +167,16 @@ class State(proto.Enum): IN_PROGRESS = 3 ERROR = 4 - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=1, enum=State, ) - state_message = proto.Field( + state_message: str = proto.Field( proto.STRING, number=2, ) - human_review_operation = proto.Field( + human_review_operation: str = proto.Field( proto.STRING, number=3, ) @@ -192,12 +194,12 @@ class ProcessResponse(proto.Message): document. """ - document = proto.Field( + document: gcd_document.Document = proto.Field( proto.MESSAGE, number=1, message=gcd_document.Document, ) - human_review_status = proto.Field( + human_review_status: "HumanReviewStatus" = proto.Field( proto.MESSAGE, number=3, message="HumanReviewStatus", @@ -225,21 +227,21 @@ class BatchProcessRequest(proto.Message): skipped for this request. Default to false. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - input_documents = proto.Field( + input_documents: document_io.BatchDocumentsInputConfig = proto.Field( proto.MESSAGE, number=5, message=document_io.BatchDocumentsInputConfig, ) - document_output_config = proto.Field( + document_output_config: document_io.DocumentOutputConfig = proto.Field( proto.MESSAGE, number=6, message=document_io.DocumentOutputConfig, ) - skip_human_review = proto.Field( + skip_human_review: bool = proto.Field( proto.BOOL, number=4, ) @@ -263,7 +265,7 @@ class BatchProcessMetadata(proto.Message): The creation time of the operation. update_time (google.protobuf.timestamp_pb2.Timestamp): The last update time of the operation. - individual_process_statuses (Sequence[google.cloud.documentai_v1.types.BatchProcessMetadata.IndividualProcessStatus]): + individual_process_statuses (MutableSequence[google.cloud.documentai_v1.types.BatchProcessMetadata.IndividualProcessStatus]): The list of response details of each document. """ @@ -300,45 +302,47 @@ class IndividualProcessStatus(proto.Message): document. """ - input_gcs_source = proto.Field( + input_gcs_source: str = proto.Field( proto.STRING, number=1, ) - status = proto.Field( + status: status_pb2.Status = proto.Field( proto.MESSAGE, number=2, message=status_pb2.Status, ) - output_gcs_destination = proto.Field( + output_gcs_destination: str = proto.Field( proto.STRING, number=3, ) - human_review_status = proto.Field( + human_review_status: "HumanReviewStatus" = proto.Field( proto.MESSAGE, number=5, message="HumanReviewStatus", ) - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=1, enum=State, ) - state_message = proto.Field( + state_message: str = proto.Field( proto.STRING, number=2, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, ) - individual_process_statuses = proto.RepeatedField( + individual_process_statuses: MutableSequence[ + IndividualProcessStatus + ] = proto.RepeatedField( proto.MESSAGE, number=5, message=IndividualProcessStatus, @@ -356,7 +360,7 @@ class FetchProcessorTypesRequest(proto.Message): ``projects/{project}/locations/{location}`` """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) @@ -366,11 +370,13 @@ class FetchProcessorTypesResponse(proto.Message): r"""Response message for fetch processor types. Attributes: - processor_types (Sequence[google.cloud.documentai_v1.types.ProcessorType]): + processor_types (MutableSequence[google.cloud.documentai_v1.types.ProcessorType]): The list of processor types. """ - processor_types = proto.RepeatedField( + processor_types: MutableSequence[ + processor_type.ProcessorType + ] = proto.RepeatedField( proto.MESSAGE, number=1, message=processor_type.ProcessorType, @@ -396,15 +402,15 @@ class ListProcessorTypesRequest(proto.Message): empty if at the end of the list. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) @@ -414,7 +420,7 @@ class ListProcessorTypesResponse(proto.Message): r"""Response message for list processor types. Attributes: - processor_types (Sequence[google.cloud.documentai_v1.types.ProcessorType]): + processor_types (MutableSequence[google.cloud.documentai_v1.types.ProcessorType]): The processor types. next_page_token (str): Points to the next page, otherwise empty. @@ -424,12 +430,14 @@ class ListProcessorTypesResponse(proto.Message): def raw_page(self): return self - processor_types = proto.RepeatedField( + processor_types: MutableSequence[ + processor_type.ProcessorType + ] = proto.RepeatedField( proto.MESSAGE, number=1, message=processor_type.ProcessorType, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -454,15 +462,15 @@ class ListProcessorsRequest(proto.Message): next processor. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) @@ -472,7 +480,7 @@ class ListProcessorsResponse(proto.Message): r"""Response message for list processors. Attributes: - processors (Sequence[google.cloud.documentai_v1.types.Processor]): + processors (MutableSequence[google.cloud.documentai_v1.types.Processor]): The list of processors. next_page_token (str): Points to the next processor, otherwise @@ -483,12 +491,12 @@ class ListProcessorsResponse(proto.Message): def raw_page(self): return self - processors = proto.RepeatedField( + processors: MutableSequence[gcd_processor.Processor] = proto.RepeatedField( proto.MESSAGE, number=1, message=gcd_processor.Processor, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -502,7 +510,7 @@ class GetProcessorRequest(proto.Message): Required. The processor resource name. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -516,7 +524,7 @@ class GetProcessorVersionRequest(proto.Message): Required. The processor resource name. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -542,15 +550,15 @@ class ListProcessorVersionsRequest(proto.Message): the next processor version. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) @@ -560,7 +568,7 @@ class ListProcessorVersionsResponse(proto.Message): r"""Response message for list processors. Attributes: - processor_versions (Sequence[google.cloud.documentai_v1.types.ProcessorVersion]): + processor_versions (MutableSequence[google.cloud.documentai_v1.types.ProcessorVersion]): The list of processors. next_page_token (str): Points to the next processor, otherwise @@ -571,12 +579,14 @@ class ListProcessorVersionsResponse(proto.Message): def raw_page(self): return self - processor_versions = proto.RepeatedField( + processor_versions: MutableSequence[ + gcd_processor.ProcessorVersion + ] = proto.RepeatedField( proto.MESSAGE, number=1, message=gcd_processor.ProcessorVersion, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -591,7 +601,7 @@ class DeleteProcessorVersionRequest(proto.Message): to be deleted. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -607,7 +617,7 @@ class DeleteProcessorVersionMetadata(proto.Message): operation. """ - common_metadata = proto.Field( + common_metadata: operation_metadata.CommonOperationMetadata = proto.Field( proto.MESSAGE, number=1, message=operation_metadata.CommonOperationMetadata, @@ -623,7 +633,7 @@ class DeployProcessorVersionRequest(proto.Message): to be deployed. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -643,7 +653,7 @@ class DeployProcessorVersionMetadata(proto.Message): operation. """ - common_metadata = proto.Field( + common_metadata: operation_metadata.CommonOperationMetadata = proto.Field( proto.MESSAGE, number=1, message=operation_metadata.CommonOperationMetadata, @@ -659,7 +669,7 @@ class UndeployProcessorVersionRequest(proto.Message): to be undeployed. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -679,7 +689,7 @@ class UndeployProcessorVersionMetadata(proto.Message): operation. """ - common_metadata = proto.Field( + common_metadata: operation_metadata.CommonOperationMetadata = proto.Field( proto.MESSAGE, number=1, message=operation_metadata.CommonOperationMetadata, @@ -702,11 +712,11 @@ class CreateProcessorRequest(proto.Message): processor is under CMEK if CMEK fields are set. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - processor = proto.Field( + processor: gcd_processor.Processor = proto.Field( proto.MESSAGE, number=2, message=gcd_processor.Processor, @@ -722,7 +732,7 @@ class DeleteProcessorRequest(proto.Message): deleted. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -738,7 +748,7 @@ class DeleteProcessorMetadata(proto.Message): operation. """ - common_metadata = proto.Field( + common_metadata: operation_metadata.CommonOperationMetadata = proto.Field( proto.MESSAGE, number=5, message=operation_metadata.CommonOperationMetadata, @@ -754,7 +764,7 @@ class EnableProcessorRequest(proto.Message): enabled. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -777,7 +787,7 @@ class EnableProcessorMetadata(proto.Message): operation. """ - common_metadata = proto.Field( + common_metadata: operation_metadata.CommonOperationMetadata = proto.Field( proto.MESSAGE, number=5, message=operation_metadata.CommonOperationMetadata, @@ -793,7 +803,7 @@ class DisableProcessorRequest(proto.Message): disabled. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -816,7 +826,7 @@ class DisableProcessorMetadata(proto.Message): operation. """ - common_metadata = proto.Field( + common_metadata: operation_metadata.CommonOperationMetadata = proto.Field( proto.MESSAGE, number=5, message=operation_metadata.CommonOperationMetadata, @@ -838,11 +848,11 @@ class SetDefaultProcessorVersionRequest(proto.Message): ``projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}`` """ - processor = proto.Field( + processor: str = proto.Field( proto.STRING, number=1, ) - default_processor_version = proto.Field( + default_processor_version: str = proto.Field( proto.STRING, number=2, ) @@ -862,7 +872,7 @@ class SetDefaultProcessorVersionMetadata(proto.Message): operation. """ - common_metadata = proto.Field( + common_metadata: operation_metadata.CommonOperationMetadata = proto.Field( proto.MESSAGE, number=1, message=operation_metadata.CommonOperationMetadata, @@ -897,26 +907,26 @@ class Priority(proto.Enum): DEFAULT = 0 URGENT = 1 - inline_document = proto.Field( + inline_document: gcd_document.Document = proto.Field( proto.MESSAGE, number=4, oneof="source", message=gcd_document.Document, ) - human_review_config = proto.Field( + human_review_config: str = proto.Field( proto.STRING, number=1, ) - enable_schema_validation = proto.Field( + enable_schema_validation: bool = proto.Field( proto.BOOL, number=3, ) - priority = proto.Field( + priority: Priority = proto.Field( proto.ENUM, number=5, enum=Priority, ) - document_schema = proto.Field( + document_schema: gcd_document_schema.DocumentSchema = proto.Field( proto.MESSAGE, number=6, message=gcd_document_schema.DocumentSchema, @@ -943,16 +953,16 @@ class State(proto.Enum): REJECTED = 1 SUCCEEDED = 2 - gcs_destination = proto.Field( + gcs_destination: str = proto.Field( proto.STRING, number=1, ) - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=2, enum=State, ) - rejection_reason = proto.Field( + rejection_reason: str = proto.Field( proto.STRING, number=3, ) @@ -970,12 +980,12 @@ class ReviewDocumentOperationMetadata(proto.Message): The Crowd Compute question ID. """ - common_metadata = proto.Field( + common_metadata: operation_metadata.CommonOperationMetadata = proto.Field( proto.MESSAGE, number=5, message=operation_metadata.CommonOperationMetadata, ) - question_id = proto.Field( + question_id: str = proto.Field( proto.STRING, number=6, ) diff --git a/google/cloud/documentai_v1/types/document_schema.py b/google/cloud/documentai_v1/types/document_schema.py index 3e566517..c8716beb 100644 --- a/google/cloud/documentai_v1/types/document_schema.py +++ b/google/cloud/documentai_v1/types/document_schema.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -32,7 +34,7 @@ class DocumentSchema(proto.Message): Display name to show to users. description (str): Description of the schema. - entity_types (Sequence[google.cloud.documentai_v1.types.DocumentSchema.EntityType]): + entity_types (MutableSequence[google.cloud.documentai_v1.types.DocumentSchema.EntityType]): Entity types of the schema. metadata (google.cloud.documentai_v1.types.DocumentSchema.Metadata): Metadata of the schema. @@ -74,10 +76,10 @@ class EntityType(proto.Message): type. For example ``line_item/amount``. This convention is deprecated, but will still be honored for backward compatibility. - base_types (Sequence[str]): + base_types (MutableSequence[str]): The entity type that this type is derived from. For now, one and only one should be set. - properties (Sequence[google.cloud.documentai_v1.types.DocumentSchema.EntityType.Property]): + properties (MutableSequence[google.cloud.documentai_v1.types.DocumentSchema.EntityType.Property]): Describing the nested structure, or composition of an entity. """ @@ -86,12 +88,12 @@ class EnumValues(proto.Message): r"""Defines the a list of enum values. Attributes: - values (Sequence[str]): + values (MutableSequence[str]): The individual values that this enum values type can include. """ - values = proto.RepeatedField( + values: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) @@ -124,39 +126,43 @@ class OccurrenceType(proto.Enum): REQUIRED_ONCE = 3 REQUIRED_MULTIPLE = 4 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - value_type = proto.Field( + value_type: str = proto.Field( proto.STRING, number=2, ) - occurrence_type = proto.Field( - proto.ENUM, - number=3, - enum="DocumentSchema.EntityType.Property.OccurrenceType", + occurrence_type: "DocumentSchema.EntityType.Property.OccurrenceType" = ( + proto.Field( + proto.ENUM, + number=3, + enum="DocumentSchema.EntityType.Property.OccurrenceType", + ) ) - enum_values = proto.Field( + enum_values: "DocumentSchema.EntityType.EnumValues" = proto.Field( proto.MESSAGE, number=14, oneof="value_source", message="DocumentSchema.EntityType.EnumValues", ) - display_name = proto.Field( + display_name: str = proto.Field( proto.STRING, number=13, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - base_types = proto.RepeatedField( + base_types: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=2, ) - properties = proto.RepeatedField( + properties: MutableSequence[ + "DocumentSchema.EntityType.Property" + ] = proto.RepeatedField( proto.MESSAGE, number=6, message="DocumentSchema.EntityType.Property", @@ -184,37 +190,37 @@ class Metadata(proto.Message): checked. """ - document_splitter = proto.Field( + document_splitter: bool = proto.Field( proto.BOOL, number=1, ) - document_allow_multiple_labels = proto.Field( + document_allow_multiple_labels: bool = proto.Field( proto.BOOL, number=2, ) - prefixed_naming_on_properties = proto.Field( + prefixed_naming_on_properties: bool = proto.Field( proto.BOOL, number=6, ) - skip_naming_validation = proto.Field( + skip_naming_validation: bool = proto.Field( proto.BOOL, number=7, ) - display_name = proto.Field( + display_name: str = proto.Field( proto.STRING, number=1, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=2, ) - entity_types = proto.RepeatedField( + entity_types: MutableSequence[EntityType] = proto.RepeatedField( proto.MESSAGE, number=3, message=EntityType, ) - metadata = proto.Field( + metadata: Metadata = proto.Field( proto.MESSAGE, number=4, message=Metadata, diff --git a/google/cloud/documentai_v1/types/geometry.py b/google/cloud/documentai_v1/types/geometry.py index 4794fcda..eabf1e72 100644 --- a/google/cloud/documentai_v1/types/geometry.py +++ b/google/cloud/documentai_v1/types/geometry.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -38,11 +40,11 @@ class Vertex(proto.Message): image). """ - x = proto.Field( + x: int = proto.Field( proto.INT32, number=1, ) - y = proto.Field( + y: int = proto.Field( proto.INT32, number=2, ) @@ -61,11 +63,11 @@ class NormalizedVertex(proto.Message): image). """ - x = proto.Field( + x: float = proto.Field( proto.FLOAT, number=1, ) - y = proto.Field( + y: float = proto.Field( proto.FLOAT, number=2, ) @@ -75,18 +77,18 @@ class BoundingPoly(proto.Message): r"""A bounding polygon for the detected image annotation. Attributes: - vertices (Sequence[google.cloud.documentai_v1.types.Vertex]): + vertices (MutableSequence[google.cloud.documentai_v1.types.Vertex]): The bounding polygon vertices. - normalized_vertices (Sequence[google.cloud.documentai_v1.types.NormalizedVertex]): + normalized_vertices (MutableSequence[google.cloud.documentai_v1.types.NormalizedVertex]): The bounding polygon normalized vertices. """ - vertices = proto.RepeatedField( + vertices: MutableSequence["Vertex"] = proto.RepeatedField( proto.MESSAGE, number=1, message="Vertex", ) - normalized_vertices = proto.RepeatedField( + normalized_vertices: MutableSequence["NormalizedVertex"] = proto.RepeatedField( proto.MESSAGE, number=2, message="NormalizedVertex", diff --git a/google/cloud/documentai_v1/types/operation_metadata.py b/google/cloud/documentai_v1/types/operation_metadata.py index 6be63fee..cf69485d 100644 --- a/google/cloud/documentai_v1/types/operation_metadata.py +++ b/google/cloud/documentai_v1/types/operation_metadata.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore @@ -50,25 +52,25 @@ class State(proto.Enum): FAILED = 4 CANCELLED = 5 - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=1, enum=State, ) - state_message = proto.Field( + state_message: str = proto.Field( proto.STRING, number=2, ) - resource = proto.Field( + resource: str = proto.Field( proto.STRING, number=5, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, diff --git a/google/cloud/documentai_v1/types/processor.py b/google/cloud/documentai_v1/types/processor.py index 8c820e9b..876b04e1 100644 --- a/google/cloud/documentai_v1/types/processor.py +++ b/google/cloud/documentai_v1/types/processor.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore @@ -85,52 +87,52 @@ class DeprecationInfo(proto.Message): used as a replacement. """ - deprecation_time = proto.Field( + deprecation_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp, ) - replacement_processor_version = proto.Field( + replacement_processor_version: str = proto.Field( proto.STRING, number=2, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - display_name = proto.Field( + display_name: str = proto.Field( proto.STRING, number=2, ) - document_schema = proto.Field( + document_schema: gcd_document_schema.DocumentSchema = proto.Field( proto.MESSAGE, number=12, message=gcd_document_schema.DocumentSchema, ) - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=6, enum=State, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp, ) - kms_key_name = proto.Field( + kms_key_name: str = proto.Field( proto.STRING, number=9, ) - kms_key_version_name = proto.Field( + kms_key_version_name: str = proto.Field( proto.STRING, number=10, ) - google_managed = proto.Field( + google_managed: bool = proto.Field( proto.BOOL, number=11, ) - deprecation_info = proto.Field( + deprecation_info: DeprecationInfo = proto.Field( proto.MESSAGE, number=13, message=DeprecationInfo, @@ -179,37 +181,37 @@ class State(proto.Enum): FAILED = 6 DELETING = 7 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - type_ = proto.Field( + type_: str = proto.Field( proto.STRING, number=2, ) - display_name = proto.Field( + display_name: str = proto.Field( proto.STRING, number=3, ) - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=4, enum=State, ) - default_processor_version = proto.Field( + default_processor_version: str = proto.Field( proto.STRING, number=9, ) - process_endpoint = proto.Field( + process_endpoint: str = proto.Field( proto.STRING, number=6, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp, ) - kms_key_name = proto.Field( + kms_key_name: str = proto.Field( proto.STRING, number=8, ) diff --git a/google/cloud/documentai_v1/types/processor_type.py b/google/cloud/documentai_v1/types/processor_type.py index 80582438..8a99ef5c 100644 --- a/google/cloud/documentai_v1/types/processor_type.py +++ b/google/cloud/documentai_v1/types/processor_type.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.api import launch_stage_pb2 # type: ignore import proto # type: ignore @@ -38,7 +40,7 @@ class ProcessorType(proto.Message): category (str): The processor category, used by UI to group processor types. - available_locations (Sequence[google.cloud.documentai_v1.types.ProcessorType.LocationInfo]): + available_locations (MutableSequence[google.cloud.documentai_v1.types.ProcessorType.LocationInfo]): The locations in which this processor is available. allow_creation (bool): @@ -59,33 +61,33 @@ class LocationInfo(proto.Message): The location id, currently must be one of [us, eu]. """ - location_id = proto.Field( + location_id: str = proto.Field( proto.STRING, number=1, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - type_ = proto.Field( + type_: str = proto.Field( proto.STRING, number=2, ) - category = proto.Field( + category: str = proto.Field( proto.STRING, number=3, ) - available_locations = proto.RepeatedField( + available_locations: MutableSequence[LocationInfo] = proto.RepeatedField( proto.MESSAGE, number=4, message=LocationInfo, ) - allow_creation = proto.Field( + allow_creation: bool = proto.Field( proto.BOOL, number=6, ) - launch_stage = proto.Field( + launch_stage: launch_stage_pb2.LaunchStage = proto.Field( proto.ENUM, number=8, enum=launch_stage_pb2.LaunchStage, diff --git a/google/cloud/documentai_v1beta2/services/document_understanding_service/async_client.py b/google/cloud/documentai_v1beta2/services/document_understanding_service/async_client.py index 45cb7b9a..d69ab1ac 100644 --- a/google/cloud/documentai_v1beta2/services/document_understanding_service/async_client.py +++ b/google/cloud/documentai_v1beta2/services/document_understanding_service/async_client.py @@ -16,7 +16,17 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 @@ -170,9 +180,9 @@ def transport(self) -> DocumentUnderstandingServiceTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, DocumentUnderstandingServiceTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the document understanding service client. @@ -216,13 +226,15 @@ def __init__( async def batch_process_documents( self, - request: Union[ - document_understanding.BatchProcessDocumentsRequest, dict + request: Optional[ + Union[document_understanding.BatchProcessDocumentsRequest, dict] ] = None, *, - requests: Sequence[document_understanding.ProcessDocumentRequest] = None, + requests: Optional[ + MutableSequence[document_understanding.ProcessDocumentRequest] + ] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""LRO endpoint to batch process many documents. The output is @@ -263,11 +275,11 @@ async def sample_batch_process_documents(): print(response) Args: - request (Union[google.cloud.documentai_v1beta2.types.BatchProcessDocumentsRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1beta2.types.BatchProcessDocumentsRequest, dict]]): The request object. Request to batch process documents as an asynchronous operation. The output is written to Cloud Storage as JSON in the [Document] format. - requests (:class:`Sequence[google.cloud.documentai_v1beta2.types.ProcessDocumentRequest]`): + requests (:class:`MutableSequence[google.cloud.documentai_v1beta2.types.ProcessDocumentRequest]`): Required. Individual requests for each document. @@ -350,10 +362,12 @@ async def sample_batch_process_documents(): async def process_document( self, - request: Union[document_understanding.ProcessDocumentRequest, dict] = None, + request: Optional[ + Union[document_understanding.ProcessDocumentRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> document.Document: r"""Processes a single document. @@ -389,7 +403,7 @@ async def sample_process_document(): print(response) Args: - request (Union[google.cloud.documentai_v1beta2.types.ProcessDocumentRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1beta2.types.ProcessDocumentRequest, dict]]): The request object. Request to process one document. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. diff --git a/google/cloud/documentai_v1beta2/services/document_understanding_service/client.py b/google/cloud/documentai_v1beta2/services/document_understanding_service/client.py index 99f73fe0..a3dbf341 100644 --- a/google/cloud/documentai_v1beta2/services/document_understanding_service/client.py +++ b/google/cloud/documentai_v1beta2/services/document_understanding_service/client.py @@ -16,7 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -63,7 +74,7 @@ class DocumentUnderstandingServiceClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[DocumentUnderstandingServiceTransport]: """Returns an appropriate transport class. @@ -321,7 +332,7 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, DocumentUnderstandingServiceTransport, None] = None, + transport: Optional[Union[str, DocumentUnderstandingServiceTransport]] = None, client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -419,13 +430,15 @@ def __init__( def batch_process_documents( self, - request: Union[ - document_understanding.BatchProcessDocumentsRequest, dict + request: Optional[ + Union[document_understanding.BatchProcessDocumentsRequest, dict] ] = None, *, - requests: Sequence[document_understanding.ProcessDocumentRequest] = None, + requests: Optional[ + MutableSequence[document_understanding.ProcessDocumentRequest] + ] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""LRO endpoint to batch process many documents. The output is @@ -470,7 +483,7 @@ def sample_batch_process_documents(): The request object. Request to batch process documents as an asynchronous operation. The output is written to Cloud Storage as JSON in the [Document] format. - requests (Sequence[google.cloud.documentai_v1beta2.types.ProcessDocumentRequest]): + requests (MutableSequence[google.cloud.documentai_v1beta2.types.ProcessDocumentRequest]): Required. Individual requests for each document. @@ -543,10 +556,12 @@ def sample_batch_process_documents(): def process_document( self, - request: Union[document_understanding.ProcessDocumentRequest, dict] = None, + request: Optional[ + Union[document_understanding.ProcessDocumentRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> document.Document: r"""Processes a single document. diff --git a/google/cloud/documentai_v1beta2/services/document_understanding_service/transports/base.py b/google/cloud/documentai_v1beta2/services/document_understanding_service/transports/base.py index 1cf40b9b..cd1dd55b 100644 --- a/google/cloud/documentai_v1beta2/services/document_understanding_service/transports/base.py +++ b/google/cloud/documentai_v1beta2/services/document_understanding_service/transports/base.py @@ -49,7 +49,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/documentai_v1beta2/services/document_understanding_service/transports/grpc.py b/google/cloud/documentai_v1beta2/services/document_understanding_service/transports/grpc.py index f15b74bc..38bc6a1f 100644 --- a/google/cloud/documentai_v1beta2/services/document_understanding_service/transports/grpc.py +++ b/google/cloud/documentai_v1beta2/services/document_understanding_service/transports/grpc.py @@ -49,14 +49,14 @@ def __init__( self, *, host: str = "documentai.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -184,8 +184,8 @@ def __init__( def create_channel( cls, host: str = "documentai.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/documentai_v1beta2/services/document_understanding_service/transports/grpc_asyncio.py b/google/cloud/documentai_v1beta2/services/document_understanding_service/transports/grpc_asyncio.py index 5f8ff6fd..ab70c156 100644 --- a/google/cloud/documentai_v1beta2/services/document_understanding_service/transports/grpc_asyncio.py +++ b/google/cloud/documentai_v1beta2/services/document_understanding_service/transports/grpc_asyncio.py @@ -53,7 +53,7 @@ class DocumentUnderstandingServiceGrpcAsyncIOTransport( def create_channel( cls, host: str = "documentai.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -96,15 +96,15 @@ def __init__( self, *, host: str = "documentai.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/documentai_v1beta2/types/document.py b/google/cloud/documentai_v1beta2/types/document.py index 92e50574..89633a8c 100644 --- a/google/cloud/documentai_v1beta2/types/document.py +++ b/google/cloud/documentai_v1beta2/types/document.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.rpc import status_pb2 # type: ignore from google.type import color_pb2 # type: ignore import proto # type: ignore @@ -64,18 +66,18 @@ class Document(proto.Message): text (str): UTF-8 encoded text in reading order from the document. - text_styles (Sequence[google.cloud.documentai_v1beta2.types.Document.Style]): + text_styles (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Style]): Styles for the [Document.text][google.cloud.documentai.v1beta2.Document.text]. - pages (Sequence[google.cloud.documentai_v1beta2.types.Document.Page]): + pages (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Page]): Visual page layout for the [Document][google.cloud.documentai.v1beta2.Document]. - entities (Sequence[google.cloud.documentai_v1beta2.types.Document.Entity]): + entities (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Entity]): A list of entities detected on [Document.text][google.cloud.documentai.v1beta2.Document.text]. For document shards, entities in this list may cross shard boundaries. - entity_relations (Sequence[google.cloud.documentai_v1beta2.types.Document.EntityRelation]): + entity_relations (MutableSequence[google.cloud.documentai_v1beta2.types.Document.EntityRelation]): Relationship among [Document.entities][google.cloud.documentai.v1beta2.Document.entities]. shard_info (google.cloud.documentai_v1beta2.types.Document.ShardInfo): @@ -83,7 +85,7 @@ class Document(proto.Message): document is sharded part of a larger document. If the document is not sharded, this message is not specified. - labels (Sequence[google.cloud.documentai_v1beta2.types.Document.Label]): + labels (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Label]): [Label][google.cloud.documentai.v1beta2.Document.Label]s for this document. error (google.rpc.status_pb2.Status): @@ -107,15 +109,15 @@ class ShardInfo(proto.Message): in the overall document global text. """ - shard_index = proto.Field( + shard_index: int = proto.Field( proto.INT64, number=1, ) - shard_count = proto.Field( + shard_count: int = proto.Field( proto.INT64, number=2, ) - text_offset = proto.Field( + text_offset: int = proto.Field( proto.INT64, number=3, ) @@ -150,16 +152,16 @@ class Label(proto.Message): assignment. """ - automl_model = proto.Field( + automl_model: str = proto.Field( proto.STRING, number=2, oneof="source", ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - confidence = proto.Field( + confidence: float = proto.Field( proto.FLOAT, number=3, ) @@ -200,43 +202,43 @@ class FontSize(proto.Message): (in, px, pt, etc.). """ - size = proto.Field( + size: float = proto.Field( proto.FLOAT, number=1, ) - unit = proto.Field( + unit: str = proto.Field( proto.STRING, number=2, ) - text_anchor = proto.Field( + text_anchor: "Document.TextAnchor" = proto.Field( proto.MESSAGE, number=1, message="Document.TextAnchor", ) - color = proto.Field( + color: color_pb2.Color = proto.Field( proto.MESSAGE, number=2, message=color_pb2.Color, ) - background_color = proto.Field( + background_color: color_pb2.Color = proto.Field( proto.MESSAGE, number=3, message=color_pb2.Color, ) - font_weight = proto.Field( + font_weight: str = proto.Field( proto.STRING, number=4, ) - text_style = proto.Field( + text_style: str = proto.Field( proto.STRING, number=5, ) - text_decoration = proto.Field( + text_decoration: str = proto.Field( proto.STRING, number=6, ) - font_size = proto.Field( + font_size: "Document.Style.FontSize" = proto.Field( proto.MESSAGE, number=7, message="Document.Style.FontSize", @@ -258,32 +260,32 @@ class Page(proto.Message): layout (google.cloud.documentai_v1beta2.types.Document.Page.Layout): [Layout][google.cloud.documentai.v1beta2.Document.Page.Layout] for the page. - detected_languages (Sequence[google.cloud.documentai_v1beta2.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. - blocks (Sequence[google.cloud.documentai_v1beta2.types.Document.Page.Block]): + blocks (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Page.Block]): A list of visually detected text blocks on the page. A block has a set of lines (collected into paragraphs) that have a common line-spacing and orientation. - paragraphs (Sequence[google.cloud.documentai_v1beta2.types.Document.Page.Paragraph]): + paragraphs (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Page.Paragraph]): A list of visually detected text paragraphs on the page. A collection of lines that a human would perceive as a paragraph. - lines (Sequence[google.cloud.documentai_v1beta2.types.Document.Page.Line]): + lines (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Page.Line]): A list of visually detected text lines on the page. A collection of tokens that a human would perceive as a line. - tokens (Sequence[google.cloud.documentai_v1beta2.types.Document.Page.Token]): + tokens (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Page.Token]): A list of visually detected tokens on the page. - visual_elements (Sequence[google.cloud.documentai_v1beta2.types.Document.Page.VisualElement]): + visual_elements (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Page.VisualElement]): A list of detected non-text visual elements e.g. checkbox, signature etc. on the page. - tables (Sequence[google.cloud.documentai_v1beta2.types.Document.Page.Table]): + tables (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Page.Table]): A list of visually detected tables on the page. - form_fields (Sequence[google.cloud.documentai_v1beta2.types.Document.Page.FormField]): + form_fields (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Page.FormField]): A list of visually detected form fields on the page. """ @@ -300,15 +302,15 @@ class Dimension(proto.Message): Dimension unit. """ - width = proto.Field( + width: float = proto.Field( proto.FLOAT, number=1, ) - height = proto.Field( + height: float = proto.Field( proto.FLOAT, number=2, ) - unit = proto.Field( + unit: str = proto.Field( proto.STRING, number=3, ) @@ -345,26 +347,26 @@ class Orientation(proto.Enum): PAGE_DOWN = 3 PAGE_LEFT = 4 - text_anchor = proto.Field( + text_anchor: "Document.TextAnchor" = proto.Field( proto.MESSAGE, number=1, message="Document.TextAnchor", ) - confidence = proto.Field( + confidence: float = proto.Field( proto.FLOAT, number=2, ) - bounding_poly = proto.Field( + bounding_poly: geometry.BoundingPoly = proto.Field( proto.MESSAGE, number=3, message=geometry.BoundingPoly, ) - orientation = proto.Field( + orientation: "Document.Page.Layout.Orientation" = proto.Field( proto.ENUM, number=4, enum="Document.Page.Layout.Orientation", ) - id = proto.Field( + id: str = proto.Field( proto.STRING, number=5, ) @@ -378,17 +380,19 @@ class Block(proto.Message): [Layout][google.cloud.documentai.v1beta2.Document.Page.Layout] for [Block][google.cloud.documentai.v1beta2.Document.Page.Block]. - detected_languages (Sequence[google.cloud.documentai_v1beta2.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. """ - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=2, message="Document.Page.DetectedLanguage", @@ -403,17 +407,19 @@ class Paragraph(proto.Message): [Layout][google.cloud.documentai.v1beta2.Document.Page.Layout] for [Paragraph][google.cloud.documentai.v1beta2.Document.Page.Paragraph]. - detected_languages (Sequence[google.cloud.documentai_v1beta2.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. """ - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=2, message="Document.Page.DetectedLanguage", @@ -429,17 +435,19 @@ class Line(proto.Message): [Layout][google.cloud.documentai.v1beta2.Document.Page.Layout] for [Line][google.cloud.documentai.v1beta2.Document.Page.Line]. - detected_languages (Sequence[google.cloud.documentai_v1beta2.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. """ - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=2, message="Document.Page.DetectedLanguage", @@ -456,7 +464,7 @@ class Token(proto.Message): detected_break (google.cloud.documentai_v1beta2.types.Document.Page.Token.DetectedBreak): Detected break at the end of a [Token][google.cloud.documentai.v1beta2.Document.Page.Token]. - detected_languages (Sequence[google.cloud.documentai_v1beta2.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. """ @@ -477,23 +485,25 @@ class Type(proto.Enum): WIDE_SPACE = 2 HYPHEN = 3 - type_ = proto.Field( + type_: "Document.Page.Token.DetectedBreak.Type" = proto.Field( proto.ENUM, number=1, enum="Document.Page.Token.DetectedBreak.Type", ) - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - detected_break = proto.Field( + detected_break: "Document.Page.Token.DetectedBreak" = proto.Field( proto.MESSAGE, number=2, message="Document.Page.Token.DetectedBreak", ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=3, message="Document.Page.DetectedLanguage", @@ -511,21 +521,23 @@ class VisualElement(proto.Message): type_ (str): Type of the [VisualElement][google.cloud.documentai.v1beta2.Document.Page.VisualElement]. - detected_languages (Sequence[google.cloud.documentai_v1beta2.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. """ - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - type_ = proto.Field( + type_: str = proto.Field( proto.STRING, number=2, ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=3, message="Document.Page.DetectedLanguage", @@ -539,11 +551,11 @@ class Table(proto.Message): [Layout][google.cloud.documentai.v1beta2.Document.Page.Layout] for [Table][google.cloud.documentai.v1beta2.Document.Page.Table]. - header_rows (Sequence[google.cloud.documentai_v1beta2.types.Document.Page.Table.TableRow]): + header_rows (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Page.Table.TableRow]): Header rows of the table. - body_rows (Sequence[google.cloud.documentai_v1beta2.types.Document.Page.Table.TableRow]): + body_rows (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Page.Table.TableRow]): Body rows of the table. - detected_languages (Sequence[google.cloud.documentai_v1beta2.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. """ @@ -552,11 +564,13 @@ class TableRow(proto.Message): r"""A row of table cells. Attributes: - cells (Sequence[google.cloud.documentai_v1beta2.types.Document.Page.Table.TableCell]): + cells (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Page.Table.TableCell]): Cells that make up this row. """ - cells = proto.RepeatedField( + cells: MutableSequence[ + "Document.Page.Table.TableCell" + ] = proto.RepeatedField( proto.MESSAGE, number=1, message="Document.Page.Table.TableCell", @@ -574,46 +588,54 @@ class TableCell(proto.Message): How many rows this cell spans. col_span (int): How many columns this cell spans. - detected_languages (Sequence[google.cloud.documentai_v1beta2.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. """ - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - row_span = proto.Field( + row_span: int = proto.Field( proto.INT32, number=2, ) - col_span = proto.Field( + col_span: int = proto.Field( proto.INT32, number=3, ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=4, message="Document.Page.DetectedLanguage", ) - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - header_rows = proto.RepeatedField( + header_rows: MutableSequence[ + "Document.Page.Table.TableRow" + ] = proto.RepeatedField( proto.MESSAGE, number=2, message="Document.Page.Table.TableRow", ) - body_rows = proto.RepeatedField( + body_rows: MutableSequence[ + "Document.Page.Table.TableRow" + ] = proto.RepeatedField( proto.MESSAGE, number=3, message="Document.Page.Table.TableRow", ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=4, message="Document.Page.DetectedLanguage", @@ -634,10 +656,10 @@ class FormField(proto.Message): for the [FormField][google.cloud.documentai.v1beta2.Document.Page.FormField] value. - name_detected_languages (Sequence[google.cloud.documentai_v1beta2.types.Document.Page.DetectedLanguage]): + name_detected_languages (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Page.DetectedLanguage]): A list of detected languages for name together with confidence. - value_detected_languages (Sequence[google.cloud.documentai_v1beta2.types.Document.Page.DetectedLanguage]): + value_detected_languages (MutableSequence[google.cloud.documentai_v1beta2.types.Document.Page.DetectedLanguage]): A list of detected languages for value together with confidence. value_type (str): @@ -655,35 +677,39 @@ class FormField(proto.Message): export value text. """ - field_name = proto.Field( + field_name: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - field_value = proto.Field( + field_value: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=2, message="Document.Page.Layout", ) - name_detected_languages = proto.RepeatedField( + name_detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=3, message="Document.Page.DetectedLanguage", ) - value_detected_languages = proto.RepeatedField( + value_detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=4, message="Document.Page.DetectedLanguage", ) - value_type = proto.Field( + value_type: str = proto.Field( proto.STRING, number=5, ) - corrected_key_text = proto.Field( + corrected_key_text: str = proto.Field( proto.STRING, number=6, ) - corrected_value_text = proto.Field( + corrected_value_text: str = proto.Field( proto.STRING, number=7, ) @@ -700,65 +726,69 @@ class DetectedLanguage(proto.Message): Confidence of detected language. Range [0, 1]. """ - language_code = proto.Field( + language_code: str = proto.Field( proto.STRING, number=1, ) - confidence = proto.Field( + confidence: float = proto.Field( proto.FLOAT, number=2, ) - page_number = proto.Field( + page_number: int = proto.Field( proto.INT32, number=1, ) - dimension = proto.Field( + dimension: "Document.Page.Dimension" = proto.Field( proto.MESSAGE, number=2, message="Document.Page.Dimension", ) - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=3, message="Document.Page.Layout", ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=4, message="Document.Page.DetectedLanguage", ) - blocks = proto.RepeatedField( + blocks: MutableSequence["Document.Page.Block"] = proto.RepeatedField( proto.MESSAGE, number=5, message="Document.Page.Block", ) - paragraphs = proto.RepeatedField( + paragraphs: MutableSequence["Document.Page.Paragraph"] = proto.RepeatedField( proto.MESSAGE, number=6, message="Document.Page.Paragraph", ) - lines = proto.RepeatedField( + lines: MutableSequence["Document.Page.Line"] = proto.RepeatedField( proto.MESSAGE, number=7, message="Document.Page.Line", ) - tokens = proto.RepeatedField( + tokens: MutableSequence["Document.Page.Token"] = proto.RepeatedField( proto.MESSAGE, number=8, message="Document.Page.Token", ) - visual_elements = proto.RepeatedField( + visual_elements: MutableSequence[ + "Document.Page.VisualElement" + ] = proto.RepeatedField( proto.MESSAGE, number=9, message="Document.Page.VisualElement", ) - tables = proto.RepeatedField( + tables: MutableSequence["Document.Page.Table"] = proto.RepeatedField( proto.MESSAGE, number=10, message="Document.Page.Table", ) - form_fields = proto.RepeatedField( + form_fields: MutableSequence["Document.Page.FormField"] = proto.RepeatedField( proto.MESSAGE, number=11, message="Document.Page.FormField", @@ -790,33 +820,33 @@ class Entity(proto.Message): value in the entity list for this document. """ - text_anchor = proto.Field( + text_anchor: "Document.TextAnchor" = proto.Field( proto.MESSAGE, number=1, message="Document.TextAnchor", ) - type_ = proto.Field( + type_: str = proto.Field( proto.STRING, number=2, ) - mention_text = proto.Field( + mention_text: str = proto.Field( proto.STRING, number=3, ) - mention_id = proto.Field( + mention_id: str = proto.Field( proto.STRING, number=4, ) - confidence = proto.Field( + confidence: float = proto.Field( proto.FLOAT, number=5, ) - page_anchor = proto.Field( + page_anchor: "Document.PageAnchor" = proto.Field( proto.MESSAGE, number=6, message="Document.PageAnchor", ) - id = proto.Field( + id: str = proto.Field( proto.STRING, number=7, ) @@ -834,15 +864,15 @@ class EntityRelation(proto.Message): Relationship description. """ - subject_id = proto.Field( + subject_id: str = proto.Field( proto.STRING, number=1, ) - object_id = proto.Field( + object_id: str = proto.Field( proto.STRING, number=2, ) - relation = proto.Field( + relation: str = proto.Field( proto.STRING, number=3, ) @@ -852,7 +882,7 @@ class TextAnchor(proto.Message): [Document.text][google.cloud.documentai.v1beta2.Document.text]. Attributes: - text_segments (Sequence[google.cloud.documentai_v1beta2.types.Document.TextAnchor.TextSegment]): + text_segments (MutableSequence[google.cloud.documentai_v1beta2.types.Document.TextAnchor.TextSegment]): The text segments from the [Document.text][google.cloud.documentai.v1beta2.Document.text]. content (str): @@ -878,21 +908,23 @@ class TextSegment(proto.Message): [Document.text][google.cloud.documentai.v1beta2.Document.text]. """ - start_index = proto.Field( + start_index: int = proto.Field( proto.INT64, number=1, ) - end_index = proto.Field( + end_index: int = proto.Field( proto.INT64, number=2, ) - text_segments = proto.RepeatedField( + text_segments: MutableSequence[ + "Document.TextAnchor.TextSegment" + ] = proto.RepeatedField( proto.MESSAGE, number=1, message="Document.TextAnchor.TextSegment", ) - content = proto.Field( + content: str = proto.Field( proto.STRING, number=2, ) @@ -902,7 +934,7 @@ class PageAnchor(proto.Message): [Document.pages][google.cloud.documentai.v1beta2.Document.pages]. Attributes: - page_refs (Sequence[google.cloud.documentai_v1beta2.types.Document.PageAnchor.PageRef]): + page_refs (MutableSequence[google.cloud.documentai_v1beta2.types.Document.PageAnchor.PageRef]): One or more references to visual page elements """ @@ -939,75 +971,75 @@ class LayoutType(proto.Enum): TABLE = 6 FORM_FIELD = 7 - page = proto.Field( + page: int = proto.Field( proto.INT64, number=1, ) - layout_type = proto.Field( + layout_type: "Document.PageAnchor.PageRef.LayoutType" = proto.Field( proto.ENUM, number=2, enum="Document.PageAnchor.PageRef.LayoutType", ) - layout_id = proto.Field( + layout_id: str = proto.Field( proto.STRING, number=3, ) - page_refs = proto.RepeatedField( + page_refs: MutableSequence["Document.PageAnchor.PageRef"] = proto.RepeatedField( proto.MESSAGE, number=1, message="Document.PageAnchor.PageRef", ) - uri = proto.Field( + uri: str = proto.Field( proto.STRING, number=1, oneof="source", ) - content = proto.Field( + content: bytes = proto.Field( proto.BYTES, number=2, oneof="source", ) - mime_type = proto.Field( + mime_type: str = proto.Field( proto.STRING, number=3, ) - text = proto.Field( + text: str = proto.Field( proto.STRING, number=4, ) - text_styles = proto.RepeatedField( + text_styles: MutableSequence[Style] = proto.RepeatedField( proto.MESSAGE, number=5, message=Style, ) - pages = proto.RepeatedField( + pages: MutableSequence[Page] = proto.RepeatedField( proto.MESSAGE, number=6, message=Page, ) - entities = proto.RepeatedField( + entities: MutableSequence[Entity] = proto.RepeatedField( proto.MESSAGE, number=7, message=Entity, ) - entity_relations = proto.RepeatedField( + entity_relations: MutableSequence[EntityRelation] = proto.RepeatedField( proto.MESSAGE, number=8, message=EntityRelation, ) - shard_info = proto.Field( + shard_info: ShardInfo = proto.Field( proto.MESSAGE, number=9, message=ShardInfo, ) - labels = proto.RepeatedField( + labels: MutableSequence[Label] = proto.RepeatedField( proto.MESSAGE, number=11, message=Label, ) - error = proto.Field( + error: status_pb2.Status = proto.Field( proto.MESSAGE, number=10, message=status_pb2.Status, diff --git a/google/cloud/documentai_v1beta2/types/document_understanding.py b/google/cloud/documentai_v1beta2/types/document_understanding.py index ddf0e80e..2c38cff7 100644 --- a/google/cloud/documentai_v1beta2/types/document_understanding.py +++ b/google/cloud/documentai_v1beta2/types/document_understanding.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore @@ -46,7 +48,7 @@ class BatchProcessDocumentsRequest(proto.Message): output is written to Cloud Storage as JSON in the [Document] format. Attributes: - requests (Sequence[google.cloud.documentai_v1beta2.types.ProcessDocumentRequest]): + requests (MutableSequence[google.cloud.documentai_v1beta2.types.ProcessDocumentRequest]): Required. Individual requests for each document. parent (str): @@ -58,12 +60,12 @@ class BatchProcessDocumentsRequest(proto.Message): automatically. """ - requests = proto.RepeatedField( + requests: MutableSequence["ProcessDocumentRequest"] = proto.RepeatedField( proto.MESSAGE, number=1, message="ProcessDocumentRequest", ) - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=2, ) @@ -114,45 +116,45 @@ class ProcessDocumentRequest(proto.Message): Params. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=9, ) - input_config = proto.Field( + input_config: "InputConfig" = proto.Field( proto.MESSAGE, number=1, message="InputConfig", ) - output_config = proto.Field( + output_config: "OutputConfig" = proto.Field( proto.MESSAGE, number=2, message="OutputConfig", ) - document_type = proto.Field( + document_type: str = proto.Field( proto.STRING, number=3, ) - table_extraction_params = proto.Field( + table_extraction_params: "TableExtractionParams" = proto.Field( proto.MESSAGE, number=4, message="TableExtractionParams", ) - form_extraction_params = proto.Field( + form_extraction_params: "FormExtractionParams" = proto.Field( proto.MESSAGE, number=5, message="FormExtractionParams", ) - entity_extraction_params = proto.Field( + entity_extraction_params: "EntityExtractionParams" = proto.Field( proto.MESSAGE, number=6, message="EntityExtractionParams", ) - ocr_params = proto.Field( + ocr_params: "OcrParams" = proto.Field( proto.MESSAGE, number=7, message="OcrParams", ) - automl_params = proto.Field( + automl_params: "AutoMlParams" = proto.Field( proto.MESSAGE, number=8, message="AutoMlParams", @@ -164,11 +166,11 @@ class BatchProcessDocumentsResponse(proto.Message): returned in the LRO Operation after the operation is complete. Attributes: - responses (Sequence[google.cloud.documentai_v1beta2.types.ProcessDocumentResponse]): + responses (MutableSequence[google.cloud.documentai_v1beta2.types.ProcessDocumentResponse]): Responses for each individual document. """ - responses = proto.RepeatedField( + responses: MutableSequence["ProcessDocumentResponse"] = proto.RepeatedField( proto.MESSAGE, number=1, message="ProcessDocumentResponse", @@ -189,12 +191,12 @@ class ProcessDocumentResponse(proto.Message): objects. """ - input_config = proto.Field( + input_config: "InputConfig" = proto.Field( proto.MESSAGE, number=1, message="InputConfig", ) - output_config = proto.Field( + output_config: "OutputConfig" = proto.Field( proto.MESSAGE, number=2, message="OutputConfig", @@ -206,7 +208,7 @@ class OcrParams(proto.Message): behavior. Attributes: - language_hints (Sequence[str]): + language_hints (MutableSequence[str]): List of languages to use for OCR. In most cases, an empty value yields the best results since it enables automatic language detection. For languages based on the Latin @@ -218,7 +220,7 @@ class OcrParams(proto.Message): specified languages is not one of the supported languages. """ - language_hints = proto.RepeatedField( + language_hints: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) @@ -230,11 +232,11 @@ class TableExtractionParams(proto.Message): Attributes: enabled (bool): Whether to enable table extraction. - table_bound_hints (Sequence[google.cloud.documentai_v1beta2.types.TableBoundHint]): + table_bound_hints (MutableSequence[google.cloud.documentai_v1beta2.types.TableBoundHint]): Optional. Table bounding box hints that can be provided to complex cases which our algorithm cannot locate the table(s) in. - header_hints (Sequence[str]): + header_hints (MutableSequence[str]): Optional. Table header hints. The extraction will bias towards producing these terms as table headers, which may improve accuracy. @@ -244,20 +246,20 @@ class TableExtractionParams(proto.Message): "builtin/latest" for the latest model. """ - enabled = proto.Field( + enabled: bool = proto.Field( proto.BOOL, number=1, ) - table_bound_hints = proto.RepeatedField( + table_bound_hints: MutableSequence["TableBoundHint"] = proto.RepeatedField( proto.MESSAGE, number=2, message="TableBoundHint", ) - header_hints = proto.RepeatedField( + header_hints: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=3, ) - model_version = proto.Field( + model_version: str = proto.Field( proto.STRING, number=4, ) @@ -279,11 +281,11 @@ class TableBoundHint(proto.Message): axis-aligned rectangle. """ - page_number = proto.Field( + page_number: int = proto.Field( proto.INT32, number=1, ) - bounding_box = proto.Field( + bounding_box: geometry.BoundingPoly = proto.Field( proto.MESSAGE, number=2, message=geometry.BoundingPoly, @@ -296,7 +298,7 @@ class FormExtractionParams(proto.Message): Attributes: enabled (bool): Whether to enable form extraction. - key_value_pair_hints (Sequence[google.cloud.documentai_v1beta2.types.KeyValuePairHint]): + key_value_pair_hints (MutableSequence[google.cloud.documentai_v1beta2.types.KeyValuePairHint]): User can provide pairs of (key text, value type) to improve the parsing result. @@ -320,16 +322,16 @@ class FormExtractionParams(proto.Message): are stored. """ - enabled = proto.Field( + enabled: bool = proto.Field( proto.BOOL, number=1, ) - key_value_pair_hints = proto.RepeatedField( + key_value_pair_hints: MutableSequence["KeyValuePairHint"] = proto.RepeatedField( proto.MESSAGE, number=2, message="KeyValuePairHint", ) - model_version = proto.Field( + model_version: str = proto.Field( proto.STRING, number=3, ) @@ -341,18 +343,18 @@ class KeyValuePairHint(proto.Message): Attributes: key (str): The key text for the hint. - value_types (Sequence[str]): + value_types (MutableSequence[str]): Type of the value. This is case-insensitive, and could be one of: ADDRESS, LOCATION, ORGANIZATION, PERSON, PHONE_NUMBER, ID, NUMBER, EMAIL, PRICE, TERMS, DATE, NAME. Types not in this list will be ignored. """ - key = proto.Field( + key: str = proto.Field( proto.STRING, number=1, ) - value_types = proto.RepeatedField( + value_types: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=2, ) @@ -370,11 +372,11 @@ class EntityExtractionParams(proto.Message): "builtin/latest" for the latest model. """ - enabled = proto.Field( + enabled: bool = proto.Field( proto.BOOL, number=1, ) - model_version = proto.Field( + model_version: str = proto.Field( proto.STRING, number=2, ) @@ -391,7 +393,7 @@ class AutoMlParams(proto.Message): ``projects/{project-id}/locations/{location-id}/models/{model-id}``. """ - model = proto.Field( + model: str = proto.Field( proto.STRING, number=1, ) @@ -432,18 +434,18 @@ class InputConfig(proto.Message): [Document][google.cloud.documentai.v1beta2.Document] format. """ - gcs_source = proto.Field( + gcs_source: "GcsSource" = proto.Field( proto.MESSAGE, number=1, oneof="source", message="GcsSource", ) - contents = proto.Field( + contents: bytes = proto.Field( proto.BYTES, number=3, oneof="source", ) - mime_type = proto.Field( + mime_type: str = proto.Field( proto.STRING, number=2, ) @@ -480,13 +482,13 @@ class OutputConfig(proto.Message): pages-101-to-150.json pages-151-to-157.json """ - gcs_destination = proto.Field( + gcs_destination: "GcsDestination" = proto.Field( proto.MESSAGE, number=1, oneof="destination", message="GcsDestination", ) - pages_per_shard = proto.Field( + pages_per_shard: int = proto.Field( proto.INT32, number=2, ) @@ -501,7 +503,7 @@ class GcsSource(proto.Message): """ - uri = proto.Field( + uri: str = proto.Field( proto.STRING, number=1, ) @@ -516,7 +518,7 @@ class GcsDestination(proto.Message): """ - uri = proto.Field( + uri: str = proto.Field( proto.STRING, number=1, ) @@ -547,21 +549,21 @@ class State(proto.Enum): CANCELLED = 5 FAILED = 6 - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=1, enum=State, ) - state_message = proto.Field( + state_message: str = proto.Field( proto.STRING, number=2, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, diff --git a/google/cloud/documentai_v1beta2/types/geometry.py b/google/cloud/documentai_v1beta2/types/geometry.py index b5e2b887..e2500be0 100644 --- a/google/cloud/documentai_v1beta2/types/geometry.py +++ b/google/cloud/documentai_v1beta2/types/geometry.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -37,11 +39,11 @@ class Vertex(proto.Message): Y coordinate. """ - x = proto.Field( + x: int = proto.Field( proto.INT32, number=1, ) - y = proto.Field( + y: int = proto.Field( proto.INT32, number=2, ) @@ -59,11 +61,11 @@ class NormalizedVertex(proto.Message): Y coordinate. """ - x = proto.Field( + x: float = proto.Field( proto.FLOAT, number=1, ) - y = proto.Field( + y: float = proto.Field( proto.FLOAT, number=2, ) @@ -73,18 +75,18 @@ class BoundingPoly(proto.Message): r"""A bounding polygon for the detected image annotation. Attributes: - vertices (Sequence[google.cloud.documentai_v1beta2.types.Vertex]): + vertices (MutableSequence[google.cloud.documentai_v1beta2.types.Vertex]): The bounding polygon vertices. - normalized_vertices (Sequence[google.cloud.documentai_v1beta2.types.NormalizedVertex]): + normalized_vertices (MutableSequence[google.cloud.documentai_v1beta2.types.NormalizedVertex]): The bounding polygon normalized vertices. """ - vertices = proto.RepeatedField( + vertices: MutableSequence["Vertex"] = proto.RepeatedField( proto.MESSAGE, number=1, message="Vertex", ) - normalized_vertices = proto.RepeatedField( + normalized_vertices: MutableSequence["NormalizedVertex"] = proto.RepeatedField( proto.MESSAGE, number=2, message="NormalizedVertex", diff --git a/google/cloud/documentai_v1beta3/services/document_processor_service/async_client.py b/google/cloud/documentai_v1beta3/services/document_processor_service/async_client.py index 176a4090..4b43ccc4 100644 --- a/google/cloud/documentai_v1beta3/services/document_processor_service/async_client.py +++ b/google/cloud/documentai_v1beta3/services/document_processor_service/async_client.py @@ -16,7 +16,17 @@ from collections import OrderedDict import functools import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, +) from google.api_core import exceptions as core_exceptions from google.api_core import gapic_v1 @@ -199,9 +209,9 @@ def transport(self) -> DocumentProcessorServiceTransport: def __init__( self, *, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, transport: Union[str, DocumentProcessorServiceTransport] = "grpc_asyncio", - client_options: ClientOptions = None, + client_options: Optional[ClientOptions] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: """Instantiates the document processor service client. @@ -245,11 +255,13 @@ def __init__( async def process_document( self, - request: Union[document_processor_service.ProcessRequest, dict] = None, + request: Optional[ + Union[document_processor_service.ProcessRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> document_processor_service.ProcessResponse: r"""Processes a single document. @@ -285,7 +297,7 @@ async def sample_process_document(): print(response) Args: - request (Union[google.cloud.documentai_v1beta3.types.ProcessRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1beta3.types.ProcessRequest, dict]]): The request object. Request message for the process document method. name (:class:`str`): @@ -371,11 +383,13 @@ async def sample_process_document(): async def batch_process_documents( self, - request: Union[document_processor_service.BatchProcessRequest, dict] = None, + request: Optional[ + Union[document_processor_service.BatchProcessRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""LRO endpoint to batch process many documents. The output is @@ -412,7 +426,7 @@ async def sample_batch_process_documents(): print(response) Args: - request (Union[google.cloud.documentai_v1beta3.types.BatchProcessRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1beta3.types.BatchProcessRequest, dict]]): The request object. Request message for batch process document method. name (:class:`str`): @@ -505,13 +519,13 @@ async def sample_batch_process_documents(): async def fetch_processor_types( self, - request: Union[ - document_processor_service.FetchProcessorTypesRequest, dict + request: Optional[ + Union[document_processor_service.FetchProcessorTypesRequest, dict] ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> document_processor_service.FetchProcessorTypesResponse: r"""Fetches processor types. Note that we do not use @@ -544,7 +558,7 @@ async def sample_fetch_processor_types(): print(response) Args: - request (Union[google.cloud.documentai_v1beta3.types.FetchProcessorTypesRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1beta3.types.FetchProcessorTypesRequest, dict]]): The request object. Request message for fetch processor types. parent (:class:`str`): @@ -612,13 +626,13 @@ async def sample_fetch_processor_types(): async def list_processor_types( self, - request: Union[ - document_processor_service.ListProcessorTypesRequest, dict + request: Optional[ + Union[document_processor_service.ListProcessorTypesRequest, dict] ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListProcessorTypesAsyncPager: r"""Lists the processor types that exist. @@ -651,7 +665,7 @@ async def sample_list_processor_types(): print(response) Args: - request (Union[google.cloud.documentai_v1beta3.types.ListProcessorTypesRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1beta3.types.ListProcessorTypesRequest, dict]]): The request object. Request message for list processor types. parent (:class:`str`): @@ -731,11 +745,13 @@ async def sample_list_processor_types(): async def list_processors( self, - request: Union[document_processor_service.ListProcessorsRequest, dict] = None, + request: Optional[ + Union[document_processor_service.ListProcessorsRequest, dict] + ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListProcessorsAsyncPager: r"""Lists all processors which belong to this project. @@ -768,7 +784,7 @@ async def sample_list_processors(): print(response) Args: - request (Union[google.cloud.documentai_v1beta3.types.ListProcessorsRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1beta3.types.ListProcessorsRequest, dict]]): The request object. Request message for list all processors belongs to a project. parent (:class:`str`): @@ -846,11 +862,13 @@ async def sample_list_processors(): async def get_processor( self, - request: Union[document_processor_service.GetProcessorRequest, dict] = None, + request: Optional[ + Union[document_processor_service.GetProcessorRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> processor.Processor: r"""Gets a processor detail. @@ -882,7 +900,7 @@ async def sample_get_processor(): print(response) Args: - request (Union[google.cloud.documentai_v1beta3.types.GetProcessorRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1beta3.types.GetProcessorRequest, dict]]): The request object. Request message for get processor. name (:class:`str`): Required. The processor resource @@ -949,13 +967,13 @@ async def sample_get_processor(): async def get_processor_version( self, - request: Union[ - document_processor_service.GetProcessorVersionRequest, dict + request: Optional[ + Union[document_processor_service.GetProcessorVersionRequest, dict] ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> processor.ProcessorVersion: r"""Gets a processor version detail. @@ -987,7 +1005,7 @@ async def sample_get_processor_version(): print(response) Args: - request (Union[google.cloud.documentai_v1beta3.types.GetProcessorVersionRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1beta3.types.GetProcessorVersionRequest, dict]]): The request object. Request message for get processor version. name (:class:`str`): @@ -1060,13 +1078,13 @@ async def sample_get_processor_version(): async def list_processor_versions( self, - request: Union[ - document_processor_service.ListProcessorVersionsRequest, dict + request: Optional[ + Union[document_processor_service.ListProcessorVersionsRequest, dict] ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListProcessorVersionsAsyncPager: r"""Lists all versions of a processor. @@ -1099,7 +1117,7 @@ async def sample_list_processor_versions(): print(response) Args: - request (Union[google.cloud.documentai_v1beta3.types.ListProcessorVersionsRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1beta3.types.ListProcessorVersionsRequest, dict]]): The request object. Request message for list all processor versions belongs to a processor. parent (:class:`str`): @@ -1177,13 +1195,13 @@ async def sample_list_processor_versions(): async def delete_processor_version( self, - request: Union[ - document_processor_service.DeleteProcessorVersionRequest, dict + request: Optional[ + Union[document_processor_service.DeleteProcessorVersionRequest, dict] ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deletes the processor version, all artifacts under @@ -1220,7 +1238,7 @@ async def sample_delete_processor_version(): print(response) Args: - request (Union[google.cloud.documentai_v1beta3.types.DeleteProcessorVersionRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1beta3.types.DeleteProcessorVersionRequest, dict]]): The request object. Request message for the delete processor version method. name (:class:`str`): @@ -1304,13 +1322,13 @@ async def sample_delete_processor_version(): async def deploy_processor_version( self, - request: Union[ - document_processor_service.DeployProcessorVersionRequest, dict + request: Optional[ + Union[document_processor_service.DeployProcessorVersionRequest, dict] ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deploys the processor version. @@ -1346,7 +1364,7 @@ async def sample_deploy_processor_version(): print(response) Args: - request (Union[google.cloud.documentai_v1beta3.types.DeployProcessorVersionRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1beta3.types.DeployProcessorVersionRequest, dict]]): The request object. Request message for the deploy processor version method. name (:class:`str`): @@ -1424,13 +1442,13 @@ async def sample_deploy_processor_version(): async def undeploy_processor_version( self, - request: Union[ - document_processor_service.UndeployProcessorVersionRequest, dict + request: Optional[ + Union[document_processor_service.UndeployProcessorVersionRequest, dict] ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Undeploys the processor version. @@ -1466,7 +1484,7 @@ async def sample_undeploy_processor_version(): print(response) Args: - request (Union[google.cloud.documentai_v1beta3.types.UndeployProcessorVersionRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1beta3.types.UndeployProcessorVersionRequest, dict]]): The request object. Request message for the undeploy processor version method. name (:class:`str`): @@ -1544,12 +1562,14 @@ async def sample_undeploy_processor_version(): async def create_processor( self, - request: Union[document_processor_service.CreateProcessorRequest, dict] = None, + request: Optional[ + Union[document_processor_service.CreateProcessorRequest, dict] + ] = None, *, - parent: str = None, - processor: gcd_processor.Processor = None, + parent: Optional[str] = None, + processor: Optional[gcd_processor.Processor] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gcd_processor.Processor: r"""Creates a processor from the type processor that the @@ -1583,7 +1603,7 @@ async def sample_create_processor(): print(response) Args: - request (Union[google.cloud.documentai_v1beta3.types.CreateProcessorRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1beta3.types.CreateProcessorRequest, dict]]): The request object. Request message for create a processor. Notice this request is sent to a regionalized backend service, and if the processor type is not @@ -1664,11 +1684,13 @@ async def sample_create_processor(): async def delete_processor( self, - request: Union[document_processor_service.DeleteProcessorRequest, dict] = None, + request: Optional[ + Union[document_processor_service.DeleteProcessorRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Deletes the processor, unloads all deployed model @@ -1706,7 +1728,7 @@ async def sample_delete_processor(): print(response) Args: - request (Union[google.cloud.documentai_v1beta3.types.DeleteProcessorRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1beta3.types.DeleteProcessorRequest, dict]]): The request object. Request message for the delete processor method. name (:class:`str`): @@ -1790,10 +1812,12 @@ async def sample_delete_processor(): async def enable_processor( self, - request: Union[document_processor_service.EnableProcessorRequest, dict] = None, + request: Optional[ + Union[document_processor_service.EnableProcessorRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Enables a processor @@ -1829,7 +1853,7 @@ async def sample_enable_processor(): print(response) Args: - request (Union[google.cloud.documentai_v1beta3.types.EnableProcessorRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1beta3.types.EnableProcessorRequest, dict]]): The request object. Request message for the enable processor method. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -1885,10 +1909,12 @@ async def sample_enable_processor(): async def disable_processor( self, - request: Union[document_processor_service.DisableProcessorRequest, dict] = None, + request: Optional[ + Union[document_processor_service.DisableProcessorRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Disables a processor @@ -1924,7 +1950,7 @@ async def sample_disable_processor(): print(response) Args: - request (Union[google.cloud.documentai_v1beta3.types.DisableProcessorRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1beta3.types.DisableProcessorRequest, dict]]): The request object. Request message for the disable processor method. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -1980,12 +2006,12 @@ async def sample_disable_processor(): async def set_default_processor_version( self, - request: Union[ - document_processor_service.SetDefaultProcessorVersionRequest, dict + request: Optional[ + Union[document_processor_service.SetDefaultProcessorVersionRequest, dict] ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Set the default (active) version of a @@ -2027,7 +2053,7 @@ async def sample_set_default_processor_version(): print(response) Args: - request (Union[google.cloud.documentai_v1beta3.types.SetDefaultProcessorVersionRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1beta3.types.SetDefaultProcessorVersionRequest, dict]]): The request object. Request message for the set default processor version method. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -2086,11 +2112,13 @@ async def sample_set_default_processor_version(): async def review_document( self, - request: Union[document_processor_service.ReviewDocumentRequest, dict] = None, + request: Optional[ + Union[document_processor_service.ReviewDocumentRequest, dict] + ] = None, *, - human_review_config: str = None, + human_review_config: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation_async.AsyncOperation: r"""Send a document for Human Review. The input document @@ -2131,7 +2159,7 @@ async def sample_review_document(): print(response) Args: - request (Union[google.cloud.documentai_v1beta3.types.ReviewDocumentRequest, dict]): + request (Optional[Union[google.cloud.documentai_v1beta3.types.ReviewDocumentRequest, dict]]): The request object. Request message for review document method. human_review_config (:class:`str`): @@ -2221,10 +2249,10 @@ async def sample_review_document(): async def list_operations( self, - request: operations_pb2.ListOperationsRequest = None, + request: Optional[operations_pb2.ListOperationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Lists operations that match the specified filter in the request. @@ -2275,10 +2303,10 @@ async def list_operations( async def get_operation( self, - request: operations_pb2.GetOperationRequest = None, + request: Optional[operations_pb2.GetOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Gets the latest state of a long-running operation. @@ -2329,10 +2357,10 @@ async def get_operation( async def cancel_operation( self, - request: operations_pb2.CancelOperationRequest = None, + request: Optional[operations_pb2.CancelOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Starts asynchronous cancellation on a long-running operation. @@ -2383,10 +2411,10 @@ async def cancel_operation( async def get_location( self, - request: locations_pb2.GetLocationRequest = None, + request: Optional[locations_pb2.GetLocationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2437,10 +2465,10 @@ async def get_location( async def list_locations( self, - request: locations_pb2.ListLocationsRequest = None, + request: Optional[locations_pb2.ListLocationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. diff --git a/google/cloud/documentai_v1beta3/services/document_processor_service/client.py b/google/cloud/documentai_v1beta3/services/document_processor_service/client.py index 3eec0a1f..5b954535 100644 --- a/google/cloud/documentai_v1beta3/services/document_processor_service/client.py +++ b/google/cloud/documentai_v1beta3/services/document_processor_service/client.py @@ -16,7 +16,18 @@ from collections import OrderedDict import os import re -from typing import Dict, Mapping, Optional, Sequence, Tuple, Type, Union, cast +from typing import ( + Dict, + Mapping, + MutableMapping, + MutableSequence, + Optional, + Sequence, + Tuple, + Type, + Union, + cast, +) from google.api_core import client_options as client_options_lib from google.api_core import exceptions as core_exceptions @@ -68,7 +79,7 @@ class DocumentProcessorServiceClientMeta(type): def get_transport_class( cls, - label: str = None, + label: Optional[str] = None, ) -> Type[DocumentProcessorServiceTransport]: """Returns an appropriate transport class. @@ -416,7 +427,7 @@ def __init__( self, *, credentials: Optional[ga_credentials.Credentials] = None, - transport: Union[str, DocumentProcessorServiceTransport, None] = None, + transport: Optional[Union[str, DocumentProcessorServiceTransport]] = None, client_options: Optional[Union[client_options_lib.ClientOptions, dict]] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, ) -> None: @@ -514,11 +525,13 @@ def __init__( def process_document( self, - request: Union[document_processor_service.ProcessRequest, dict] = None, + request: Optional[ + Union[document_processor_service.ProcessRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> document_processor_service.ProcessResponse: r"""Processes a single document. @@ -630,11 +643,13 @@ def sample_process_document(): def batch_process_documents( self, - request: Union[document_processor_service.BatchProcessRequest, dict] = None, + request: Optional[ + Union[document_processor_service.BatchProcessRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""LRO endpoint to batch process many documents. The output is @@ -754,13 +769,13 @@ def sample_batch_process_documents(): def fetch_processor_types( self, - request: Union[ - document_processor_service.FetchProcessorTypesRequest, dict + request: Optional[ + Union[document_processor_service.FetchProcessorTypesRequest, dict] ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> document_processor_service.FetchProcessorTypesResponse: r"""Fetches processor types. Note that we do not use @@ -863,13 +878,13 @@ def sample_fetch_processor_types(): def list_processor_types( self, - request: Union[ - document_processor_service.ListProcessorTypesRequest, dict + request: Optional[ + Union[document_processor_service.ListProcessorTypesRequest, dict] ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListProcessorTypesPager: r"""Lists the processor types that exist. @@ -984,11 +999,13 @@ def sample_list_processor_types(): def list_processors( self, - request: Union[document_processor_service.ListProcessorsRequest, dict] = None, + request: Optional[ + Union[document_processor_service.ListProcessorsRequest, dict] + ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListProcessorsPager: r"""Lists all processors which belong to this project. @@ -1099,11 +1116,13 @@ def sample_list_processors(): def get_processor( self, - request: Union[document_processor_service.GetProcessorRequest, dict] = None, + request: Optional[ + Union[document_processor_service.GetProcessorRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> processor.Processor: r"""Gets a processor detail. @@ -1202,13 +1221,13 @@ def sample_get_processor(): def get_processor_version( self, - request: Union[ - document_processor_service.GetProcessorVersionRequest, dict + request: Optional[ + Union[document_processor_service.GetProcessorVersionRequest, dict] ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> processor.ProcessorVersion: r"""Gets a processor version detail. @@ -1315,13 +1334,13 @@ def sample_get_processor_version(): def list_processor_versions( self, - request: Union[ - document_processor_service.ListProcessorVersionsRequest, dict + request: Optional[ + Union[document_processor_service.ListProcessorVersionsRequest, dict] ] = None, *, - parent: str = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> pagers.ListProcessorVersionsPager: r"""Lists all versions of a processor. @@ -1434,13 +1453,13 @@ def sample_list_processor_versions(): def delete_processor_version( self, - request: Union[ - document_processor_service.DeleteProcessorVersionRequest, dict + request: Optional[ + Union[document_processor_service.DeleteProcessorVersionRequest, dict] ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Deletes the processor version, all artifacts under @@ -1563,13 +1582,13 @@ def sample_delete_processor_version(): def deploy_processor_version( self, - request: Union[ - document_processor_service.DeployProcessorVersionRequest, dict + request: Optional[ + Union[document_processor_service.DeployProcessorVersionRequest, dict] ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Deploys the processor version. @@ -1685,13 +1704,13 @@ def sample_deploy_processor_version(): def undeploy_processor_version( self, - request: Union[ - document_processor_service.UndeployProcessorVersionRequest, dict + request: Optional[ + Union[document_processor_service.UndeployProcessorVersionRequest, dict] ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Undeploys the processor version. @@ -1811,12 +1830,14 @@ def sample_undeploy_processor_version(): def create_processor( self, - request: Union[document_processor_service.CreateProcessorRequest, dict] = None, + request: Optional[ + Union[document_processor_service.CreateProcessorRequest, dict] + ] = None, *, - parent: str = None, - processor: gcd_processor.Processor = None, + parent: Optional[str] = None, + processor: Optional[gcd_processor.Processor] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> gcd_processor.Processor: r"""Creates a processor from the type processor that the @@ -1931,11 +1952,13 @@ def sample_create_processor(): def delete_processor( self, - request: Union[document_processor_service.DeleteProcessorRequest, dict] = None, + request: Optional[ + Union[document_processor_service.DeleteProcessorRequest, dict] + ] = None, *, - name: str = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Deletes the processor, unloads all deployed model @@ -2057,10 +2080,12 @@ def sample_delete_processor(): def enable_processor( self, - request: Union[document_processor_service.EnableProcessorRequest, dict] = None, + request: Optional[ + Union[document_processor_service.EnableProcessorRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Enables a processor @@ -2153,10 +2178,12 @@ def sample_enable_processor(): def disable_processor( self, - request: Union[document_processor_service.DisableProcessorRequest, dict] = None, + request: Optional[ + Union[document_processor_service.DisableProcessorRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Disables a processor @@ -2249,12 +2276,12 @@ def sample_disable_processor(): def set_default_processor_version( self, - request: Union[ - document_processor_service.SetDefaultProcessorVersionRequest, dict + request: Optional[ + Union[document_processor_service.SetDefaultProcessorVersionRequest, dict] ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Set the default (active) version of a @@ -2362,11 +2389,13 @@ def sample_set_default_processor_version(): def review_document( self, - request: Union[document_processor_service.ReviewDocumentRequest, dict] = None, + request: Optional[ + Union[document_processor_service.ReviewDocumentRequest, dict] + ] = None, *, - human_review_config: str = None, + human_review_config: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operation.Operation: r"""Send a document for Human Review. The input document @@ -2500,10 +2529,10 @@ def __exit__(self, type, value, traceback): def list_operations( self, - request: operations_pb2.ListOperationsRequest = None, + request: Optional[operations_pb2.ListOperationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.ListOperationsResponse: r"""Lists operations that match the specified filter in the request. @@ -2554,10 +2583,10 @@ def list_operations( def get_operation( self, - request: operations_pb2.GetOperationRequest = None, + request: Optional[operations_pb2.GetOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> operations_pb2.Operation: r"""Gets the latest state of a long-running operation. @@ -2608,10 +2637,10 @@ def get_operation( def cancel_operation( self, - request: operations_pb2.CancelOperationRequest = None, + request: Optional[operations_pb2.CancelOperationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: r"""Starts asynchronous cancellation on a long-running operation. @@ -2662,10 +2691,10 @@ def cancel_operation( def get_location( self, - request: locations_pb2.GetLocationRequest = None, + request: Optional[locations_pb2.GetLocationRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.Location: r"""Gets information about a location. @@ -2716,10 +2745,10 @@ def get_location( def list_locations( self, - request: locations_pb2.ListLocationsRequest = None, + request: Optional[locations_pb2.ListLocationsRequest] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: float = None, + timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ) -> locations_pb2.ListLocationsResponse: r"""Lists information about the supported locations for this service. diff --git a/google/cloud/documentai_v1beta3/services/document_processor_service/transports/base.py b/google/cloud/documentai_v1beta3/services/document_processor_service/transports/base.py index ce07c45d..51d32d84 100644 --- a/google/cloud/documentai_v1beta3/services/document_processor_service/transports/base.py +++ b/google/cloud/documentai_v1beta3/services/document_processor_service/transports/base.py @@ -52,7 +52,7 @@ def __init__( self, *, host: str = DEFAULT_HOST, - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, diff --git a/google/cloud/documentai_v1beta3/services/document_processor_service/transports/grpc.py b/google/cloud/documentai_v1beta3/services/document_processor_service/transports/grpc.py index 9e3ab6ef..84ece01a 100644 --- a/google/cloud/documentai_v1beta3/services/document_processor_service/transports/grpc.py +++ b/google/cloud/documentai_v1beta3/services/document_processor_service/transports/grpc.py @@ -54,14 +54,14 @@ def __init__( self, *, host: str = "documentai.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, - scopes: Sequence[str] = None, - channel: grpc.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, + scopes: Optional[Sequence[str]] = None, + channel: Optional[grpc.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, @@ -189,8 +189,8 @@ def __init__( def create_channel( cls, host: str = "documentai.googleapis.com", - credentials: ga_credentials.Credentials = None, - credentials_file: str = None, + credentials: Optional[ga_credentials.Credentials] = None, + credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, **kwargs, diff --git a/google/cloud/documentai_v1beta3/services/document_processor_service/transports/grpc_asyncio.py b/google/cloud/documentai_v1beta3/services/document_processor_service/transports/grpc_asyncio.py index df361172..b274c633 100644 --- a/google/cloud/documentai_v1beta3/services/document_processor_service/transports/grpc_asyncio.py +++ b/google/cloud/documentai_v1beta3/services/document_processor_service/transports/grpc_asyncio.py @@ -56,7 +56,7 @@ class DocumentProcessorServiceGrpcAsyncIOTransport(DocumentProcessorServiceTrans def create_channel( cls, host: str = "documentai.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, quota_project_id: Optional[str] = None, @@ -99,15 +99,15 @@ def __init__( self, *, host: str = "documentai.googleapis.com", - credentials: ga_credentials.Credentials = None, + credentials: Optional[ga_credentials.Credentials] = None, credentials_file: Optional[str] = None, scopes: Optional[Sequence[str]] = None, - channel: aio.Channel = None, - api_mtls_endpoint: str = None, - client_cert_source: Callable[[], Tuple[bytes, bytes]] = None, - ssl_channel_credentials: grpc.ChannelCredentials = None, - client_cert_source_for_mtls: Callable[[], Tuple[bytes, bytes]] = None, - quota_project_id=None, + channel: Optional[aio.Channel] = None, + api_mtls_endpoint: Optional[str] = None, + client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None, + client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None, + quota_project_id: Optional[str] = None, client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO, always_use_jwt_access: Optional[bool] = False, api_audience: Optional[str] = None, diff --git a/google/cloud/documentai_v1beta3/types/barcode.py b/google/cloud/documentai_v1beta3/types/barcode.py index 88207b06..ca09a327 100644 --- a/google/cloud/documentai_v1beta3/types/barcode.py +++ b/google/cloud/documentai_v1beta3/types/barcode.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -49,15 +51,15 @@ class Barcode(proto.Message): 'MEBKM:TITLE:Google;URL:https://www.google.com;;'. """ - format_ = proto.Field( + format_: str = proto.Field( proto.STRING, number=1, ) - value_format = proto.Field( + value_format: str = proto.Field( proto.STRING, number=2, ) - raw_value = proto.Field( + raw_value: str = proto.Field( proto.STRING, number=3, ) diff --git a/google/cloud/documentai_v1beta3/types/document.py b/google/cloud/documentai_v1beta3/types/document.py index 5c92c221..fc825588 100644 --- a/google/cloud/documentai_v1beta3/types/document.py +++ b/google/cloud/documentai_v1beta3/types/document.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import timestamp_pb2 # type: ignore from google.rpc import status_pb2 # type: ignore from google.type import color_pb2 # type: ignore @@ -69,21 +71,21 @@ class Document(proto.Message): text (str): Optional. UTF-8 encoded text in reading order from the document. - text_styles (Sequence[google.cloud.documentai_v1beta3.types.Document.Style]): + text_styles (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Style]): Placeholder. Styles for the [Document.text][google.cloud.documentai.v1beta3.Document.text]. - pages (Sequence[google.cloud.documentai_v1beta3.types.Document.Page]): + pages (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page]): Visual page layout for the [Document][google.cloud.documentai.v1beta3.Document]. - entities (Sequence[google.cloud.documentai_v1beta3.types.Document.Entity]): + entities (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Entity]): A list of entities detected on [Document.text][google.cloud.documentai.v1beta3.Document.text]. For document shards, entities in this list may cross shard boundaries. - entity_relations (Sequence[google.cloud.documentai_v1beta3.types.Document.EntityRelation]): + entity_relations (MutableSequence[google.cloud.documentai_v1beta3.types.Document.EntityRelation]): Placeholder. Relationship among [Document.entities][google.cloud.documentai.v1beta3.Document.entities]. - text_changes (Sequence[google.cloud.documentai_v1beta3.types.Document.TextChange]): + text_changes (MutableSequence[google.cloud.documentai_v1beta3.types.Document.TextChange]): Placeholder. A list of text corrections made to [Document.text]. This is usually used for annotating corrections to OCR mistakes. Text changes for a given @@ -96,7 +98,7 @@ class Document(proto.Message): error (google.rpc.status_pb2.Status): Any error that occurred while processing this document. - revisions (Sequence[google.cloud.documentai_v1beta3.types.Document.Revision]): + revisions (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Revision]): Placeholder. Revision history of this document. """ @@ -117,15 +119,15 @@ class ShardInfo(proto.Message): in the overall document global text. """ - shard_index = proto.Field( + shard_index: int = proto.Field( proto.INT64, number=1, ) - shard_count = proto.Field( + shard_count: int = proto.Field( proto.INT64, number=2, ) - text_offset = proto.Field( + text_offset: int = proto.Field( proto.INT64, number=3, ) @@ -166,43 +168,43 @@ class FontSize(proto.Message): (in, px, pt, etc.). """ - size = proto.Field( + size: float = proto.Field( proto.FLOAT, number=1, ) - unit = proto.Field( + unit: str = proto.Field( proto.STRING, number=2, ) - text_anchor = proto.Field( + text_anchor: "Document.TextAnchor" = proto.Field( proto.MESSAGE, number=1, message="Document.TextAnchor", ) - color = proto.Field( + color: color_pb2.Color = proto.Field( proto.MESSAGE, number=2, message=color_pb2.Color, ) - background_color = proto.Field( + background_color: color_pb2.Color = proto.Field( proto.MESSAGE, number=3, message=color_pb2.Color, ) - font_weight = proto.Field( + font_weight: str = proto.Field( proto.STRING, number=4, ) - text_style = proto.Field( + text_style: str = proto.Field( proto.STRING, number=5, ) - text_decoration = proto.Field( + text_decoration: str = proto.Field( proto.STRING, number=6, ) - font_size = proto.Field( + font_size: "Document.Style.FontSize" = proto.Field( proto.MESSAGE, number=7, message="Document.Style.FontSize", @@ -224,7 +226,7 @@ class Page(proto.Message): preprocessed to remove any skew, rotation, and distortions such that the annotation bounding boxes can be upright and axis-aligned. - transforms (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.Matrix]): + transforms (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.Matrix]): Transformation matrices that were applied to the original document image to produce [Page.image][google.cloud.documentai.v1beta3.Document.Page.image]. @@ -233,38 +235,38 @@ class Page(proto.Message): layout (google.cloud.documentai_v1beta3.types.Document.Page.Layout): [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for the page. - detected_languages (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. - blocks (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.Block]): + blocks (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.Block]): A list of visually detected text blocks on the page. A block has a set of lines (collected into paragraphs) that have a common line-spacing and orientation. - paragraphs (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.Paragraph]): + paragraphs (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.Paragraph]): A list of visually detected text paragraphs on the page. A collection of lines that a human would perceive as a paragraph. - lines (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.Line]): + lines (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.Line]): A list of visually detected text lines on the page. A collection of tokens that a human would perceive as a line. - tokens (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.Token]): + tokens (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.Token]): A list of visually detected tokens on the page. - visual_elements (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.VisualElement]): + visual_elements (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.VisualElement]): A list of detected non-text visual elements e.g. checkbox, signature etc. on the page. - tables (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.Table]): + tables (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.Table]): A list of visually detected tables on the page. - form_fields (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.FormField]): + form_fields (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.FormField]): A list of visually detected form fields on the page. - symbols (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.Symbol]): + symbols (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.Symbol]): A list of visually detected symbols on the page. - detected_barcodes (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedBarcode]): + detected_barcodes (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedBarcode]): A list of detected barcodes. provenance (google.cloud.documentai_v1beta3.types.Document.Provenance): The history of this page. @@ -282,15 +284,15 @@ class Dimension(proto.Message): Dimension unit. """ - width = proto.Field( + width: float = proto.Field( proto.FLOAT, number=1, ) - height = proto.Field( + height: float = proto.Field( proto.FLOAT, number=2, ) - unit = proto.Field( + unit: str = proto.Field( proto.STRING, number=3, ) @@ -309,19 +311,19 @@ class Image(proto.Message): Height of the image in pixels. """ - content = proto.Field( + content: bytes = proto.Field( proto.BYTES, number=1, ) - mime_type = proto.Field( + mime_type: str = proto.Field( proto.STRING, number=2, ) - width = proto.Field( + width: int = proto.Field( proto.INT32, number=3, ) - height = proto.Field( + height: int = proto.Field( proto.INT32, number=4, ) @@ -345,19 +347,19 @@ class Matrix(proto.Message): The matrix data. """ - rows = proto.Field( + rows: int = proto.Field( proto.INT32, number=1, ) - cols = proto.Field( + cols: int = proto.Field( proto.INT32, number=2, ) - type_ = proto.Field( + type_: int = proto.Field( proto.INT32, number=3, ) - data = proto.Field( + data: bytes = proto.Field( proto.BYTES, number=4, ) @@ -391,21 +393,21 @@ class Orientation(proto.Enum): PAGE_DOWN = 3 PAGE_LEFT = 4 - text_anchor = proto.Field( + text_anchor: "Document.TextAnchor" = proto.Field( proto.MESSAGE, number=1, message="Document.TextAnchor", ) - confidence = proto.Field( + confidence: float = proto.Field( proto.FLOAT, number=2, ) - bounding_poly = proto.Field( + bounding_poly: geometry.BoundingPoly = proto.Field( proto.MESSAGE, number=3, message=geometry.BoundingPoly, ) - orientation = proto.Field( + orientation: "Document.Page.Layout.Orientation" = proto.Field( proto.ENUM, number=4, enum="Document.Page.Layout.Orientation", @@ -420,24 +422,26 @@ class Block(proto.Message): [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Block][google.cloud.documentai.v1beta3.Document.Page.Block]. - detected_languages (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. provenance (google.cloud.documentai_v1beta3.types.Document.Provenance): The history of this annotation. """ - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=2, message="Document.Page.DetectedLanguage", ) - provenance = proto.Field( + provenance: "Document.Provenance" = proto.Field( proto.MESSAGE, number=3, message="Document.Provenance", @@ -452,24 +456,26 @@ class Paragraph(proto.Message): [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Paragraph][google.cloud.documentai.v1beta3.Document.Page.Paragraph]. - detected_languages (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. provenance (google.cloud.documentai_v1beta3.types.Document.Provenance): The history of this annotation. """ - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=2, message="Document.Page.DetectedLanguage", ) - provenance = proto.Field( + provenance: "Document.Provenance" = proto.Field( proto.MESSAGE, number=3, message="Document.Provenance", @@ -485,24 +491,26 @@ class Line(proto.Message): [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Line][google.cloud.documentai.v1beta3.Document.Page.Line]. - detected_languages (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. provenance (google.cloud.documentai_v1beta3.types.Document.Provenance): The history of this annotation. """ - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=2, message="Document.Page.DetectedLanguage", ) - provenance = proto.Field( + provenance: "Document.Provenance" = proto.Field( proto.MESSAGE, number=3, message="Document.Provenance", @@ -519,7 +527,7 @@ class Token(proto.Message): detected_break (google.cloud.documentai_v1beta3.types.Document.Page.Token.DetectedBreak): Detected break at the end of a [Token][google.cloud.documentai.v1beta3.Document.Page.Token]. - detected_languages (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. provenance (google.cloud.documentai_v1beta3.types.Document.Provenance): @@ -542,28 +550,30 @@ class Type(proto.Enum): WIDE_SPACE = 2 HYPHEN = 3 - type_ = proto.Field( + type_: "Document.Page.Token.DetectedBreak.Type" = proto.Field( proto.ENUM, number=1, enum="Document.Page.Token.DetectedBreak.Type", ) - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - detected_break = proto.Field( + detected_break: "Document.Page.Token.DetectedBreak" = proto.Field( proto.MESSAGE, number=2, message="Document.Page.Token.DetectedBreak", ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=3, message="Document.Page.DetectedLanguage", ) - provenance = proto.Field( + provenance: "Document.Provenance" = proto.Field( proto.MESSAGE, number=4, message="Document.Provenance", @@ -577,17 +587,19 @@ class Symbol(proto.Message): [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Symbol][google.cloud.documentai.v1beta3.Document.Page.Symbol]. - detected_languages (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. """ - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=2, message="Document.Page.DetectedLanguage", @@ -605,21 +617,23 @@ class VisualElement(proto.Message): type_ (str): Type of the [VisualElement][google.cloud.documentai.v1beta3.Document.Page.VisualElement]. - detected_languages (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. """ - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - type_ = proto.Field( + type_: str = proto.Field( proto.STRING, number=2, ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=3, message="Document.Page.DetectedLanguage", @@ -633,11 +647,11 @@ class Table(proto.Message): [Layout][google.cloud.documentai.v1beta3.Document.Page.Layout] for [Table][google.cloud.documentai.v1beta3.Document.Page.Table]. - header_rows (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.Table.TableRow]): + header_rows (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.Table.TableRow]): Header rows of the table. - body_rows (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.Table.TableRow]): + body_rows (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.Table.TableRow]): Body rows of the table. - detected_languages (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. """ @@ -646,11 +660,13 @@ class TableRow(proto.Message): r"""A row of table cells. Attributes: - cells (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.Table.TableCell]): + cells (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.Table.TableCell]): Cells that make up this row. """ - cells = proto.RepeatedField( + cells: MutableSequence[ + "Document.Page.Table.TableCell" + ] = proto.RepeatedField( proto.MESSAGE, number=1, message="Document.Page.Table.TableCell", @@ -668,46 +684,54 @@ class TableCell(proto.Message): How many rows this cell spans. col_span (int): How many columns this cell spans. - detected_languages (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedLanguage]): + detected_languages (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedLanguage]): A list of detected languages together with confidence. """ - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - row_span = proto.Field( + row_span: int = proto.Field( proto.INT32, number=2, ) - col_span = proto.Field( + col_span: int = proto.Field( proto.INT32, number=3, ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=4, message="Document.Page.DetectedLanguage", ) - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - header_rows = proto.RepeatedField( + header_rows: MutableSequence[ + "Document.Page.Table.TableRow" + ] = proto.RepeatedField( proto.MESSAGE, number=2, message="Document.Page.Table.TableRow", ) - body_rows = proto.RepeatedField( + body_rows: MutableSequence[ + "Document.Page.Table.TableRow" + ] = proto.RepeatedField( proto.MESSAGE, number=3, message="Document.Page.Table.TableRow", ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=4, message="Document.Page.DetectedLanguage", @@ -728,10 +752,10 @@ class FormField(proto.Message): for the [FormField][google.cloud.documentai.v1beta3.Document.Page.FormField] value. - name_detected_languages (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedLanguage]): + name_detected_languages (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedLanguage]): A list of detected languages for name together with confidence. - value_detected_languages (Sequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedLanguage]): + value_detected_languages (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Page.DetectedLanguage]): A list of detected languages for value together with confidence. value_type (str): @@ -755,39 +779,43 @@ class FormField(proto.Message): The history of this annotation. """ - field_name = proto.Field( + field_name: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - field_value = proto.Field( + field_value: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=2, message="Document.Page.Layout", ) - name_detected_languages = proto.RepeatedField( + name_detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=3, message="Document.Page.DetectedLanguage", ) - value_detected_languages = proto.RepeatedField( + value_detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=4, message="Document.Page.DetectedLanguage", ) - value_type = proto.Field( + value_type: str = proto.Field( proto.STRING, number=5, ) - corrected_key_text = proto.Field( + corrected_key_text: str = proto.Field( proto.STRING, number=6, ) - corrected_value_text = proto.Field( + corrected_value_text: str = proto.Field( proto.STRING, number=7, ) - provenance = proto.Field( + provenance: "Document.Provenance" = proto.Field( proto.MESSAGE, number=8, message="Document.Provenance", @@ -806,12 +834,12 @@ class DetectedBarcode(proto.Message): [DetectedBarcode][google.cloud.documentai.v1beta3.Document.Page.DetectedBarcode]. """ - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=1, message="Document.Page.Layout", ) - barcode = proto.Field( + barcode: gcd_barcode.Barcode = proto.Field( proto.MESSAGE, number=2, message=gcd_barcode.Barcode, @@ -829,90 +857,96 @@ class DetectedLanguage(proto.Message): Confidence of detected language. Range [0, 1]. """ - language_code = proto.Field( + language_code: str = proto.Field( proto.STRING, number=1, ) - confidence = proto.Field( + confidence: float = proto.Field( proto.FLOAT, number=2, ) - page_number = proto.Field( + page_number: int = proto.Field( proto.INT32, number=1, ) - image = proto.Field( + image: "Document.Page.Image" = proto.Field( proto.MESSAGE, number=13, message="Document.Page.Image", ) - transforms = proto.RepeatedField( + transforms: MutableSequence["Document.Page.Matrix"] = proto.RepeatedField( proto.MESSAGE, number=14, message="Document.Page.Matrix", ) - dimension = proto.Field( + dimension: "Document.Page.Dimension" = proto.Field( proto.MESSAGE, number=2, message="Document.Page.Dimension", ) - layout = proto.Field( + layout: "Document.Page.Layout" = proto.Field( proto.MESSAGE, number=3, message="Document.Page.Layout", ) - detected_languages = proto.RepeatedField( + detected_languages: MutableSequence[ + "Document.Page.DetectedLanguage" + ] = proto.RepeatedField( proto.MESSAGE, number=4, message="Document.Page.DetectedLanguage", ) - blocks = proto.RepeatedField( + blocks: MutableSequence["Document.Page.Block"] = proto.RepeatedField( proto.MESSAGE, number=5, message="Document.Page.Block", ) - paragraphs = proto.RepeatedField( + paragraphs: MutableSequence["Document.Page.Paragraph"] = proto.RepeatedField( proto.MESSAGE, number=6, message="Document.Page.Paragraph", ) - lines = proto.RepeatedField( + lines: MutableSequence["Document.Page.Line"] = proto.RepeatedField( proto.MESSAGE, number=7, message="Document.Page.Line", ) - tokens = proto.RepeatedField( + tokens: MutableSequence["Document.Page.Token"] = proto.RepeatedField( proto.MESSAGE, number=8, message="Document.Page.Token", ) - visual_elements = proto.RepeatedField( + visual_elements: MutableSequence[ + "Document.Page.VisualElement" + ] = proto.RepeatedField( proto.MESSAGE, number=9, message="Document.Page.VisualElement", ) - tables = proto.RepeatedField( + tables: MutableSequence["Document.Page.Table"] = proto.RepeatedField( proto.MESSAGE, number=10, message="Document.Page.Table", ) - form_fields = proto.RepeatedField( + form_fields: MutableSequence["Document.Page.FormField"] = proto.RepeatedField( proto.MESSAGE, number=11, message="Document.Page.FormField", ) - symbols = proto.RepeatedField( + symbols: MutableSequence["Document.Page.Symbol"] = proto.RepeatedField( proto.MESSAGE, number=12, message="Document.Page.Symbol", ) - detected_barcodes = proto.RepeatedField( + detected_barcodes: MutableSequence[ + "Document.Page.DetectedBarcode" + ] = proto.RepeatedField( proto.MESSAGE, number=15, message="Document.Page.DetectedBarcode", ) - provenance = proto.Field( + provenance: "Document.Provenance" = proto.Field( proto.MESSAGE, number=16, message="Document.Provenance", @@ -952,7 +986,7 @@ class Entity(proto.Message): the type (e.g. address) is not supported for certain parsers. This field is also only populated for certain supported document types. - properties (Sequence[google.cloud.documentai_v1beta3.types.Document.Entity]): + properties (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Entity]): Optional. Entities can be nested to form a hierarchical data structure representing the content in the document. @@ -1027,96 +1061,96 @@ class NormalizedValue(proto.Message): text format. """ - money_value = proto.Field( + money_value: money_pb2.Money = proto.Field( proto.MESSAGE, number=2, oneof="structured_value", message=money_pb2.Money, ) - date_value = proto.Field( + date_value: date_pb2.Date = proto.Field( proto.MESSAGE, number=3, oneof="structured_value", message=date_pb2.Date, ) - datetime_value = proto.Field( + datetime_value: datetime_pb2.DateTime = proto.Field( proto.MESSAGE, number=4, oneof="structured_value", message=datetime_pb2.DateTime, ) - address_value = proto.Field( + address_value: postal_address_pb2.PostalAddress = proto.Field( proto.MESSAGE, number=5, oneof="structured_value", message=postal_address_pb2.PostalAddress, ) - boolean_value = proto.Field( + boolean_value: bool = proto.Field( proto.BOOL, number=6, oneof="structured_value", ) - integer_value = proto.Field( + integer_value: int = proto.Field( proto.INT32, number=7, oneof="structured_value", ) - float_value = proto.Field( + float_value: float = proto.Field( proto.FLOAT, number=8, oneof="structured_value", ) - text = proto.Field( + text: str = proto.Field( proto.STRING, number=1, ) - text_anchor = proto.Field( + text_anchor: "Document.TextAnchor" = proto.Field( proto.MESSAGE, number=1, message="Document.TextAnchor", ) - type_ = proto.Field( + type_: str = proto.Field( proto.STRING, number=2, ) - mention_text = proto.Field( + mention_text: str = proto.Field( proto.STRING, number=3, ) - mention_id = proto.Field( + mention_id: str = proto.Field( proto.STRING, number=4, ) - confidence = proto.Field( + confidence: float = proto.Field( proto.FLOAT, number=5, ) - page_anchor = proto.Field( + page_anchor: "Document.PageAnchor" = proto.Field( proto.MESSAGE, number=6, message="Document.PageAnchor", ) - id = proto.Field( + id: str = proto.Field( proto.STRING, number=7, ) - normalized_value = proto.Field( + normalized_value: "Document.Entity.NormalizedValue" = proto.Field( proto.MESSAGE, number=9, message="Document.Entity.NormalizedValue", ) - properties = proto.RepeatedField( + properties: MutableSequence["Document.Entity"] = proto.RepeatedField( proto.MESSAGE, number=10, message="Document.Entity", ) - provenance = proto.Field( + provenance: "Document.Provenance" = proto.Field( proto.MESSAGE, number=11, message="Document.Provenance", ) - redacted = proto.Field( + redacted: bool = proto.Field( proto.BOOL, number=12, ) @@ -1134,15 +1168,15 @@ class EntityRelation(proto.Message): Relationship description. """ - subject_id = proto.Field( + subject_id: str = proto.Field( proto.STRING, number=1, ) - object_id = proto.Field( + object_id: str = proto.Field( proto.STRING, number=2, ) - relation = proto.Field( + relation: str = proto.Field( proto.STRING, number=3, ) @@ -1152,7 +1186,7 @@ class TextAnchor(proto.Message): [Document.text][google.cloud.documentai.v1beta3.Document.text]. Attributes: - text_segments (Sequence[google.cloud.documentai_v1beta3.types.Document.TextAnchor.TextSegment]): + text_segments (MutableSequence[google.cloud.documentai_v1beta3.types.Document.TextAnchor.TextSegment]): The text segments from the [Document.text][google.cloud.documentai.v1beta3.Document.text]. content (str): @@ -1179,21 +1213,23 @@ class TextSegment(proto.Message): [Document.text][google.cloud.documentai.v1beta3.Document.text]. """ - start_index = proto.Field( + start_index: int = proto.Field( proto.INT64, number=1, ) - end_index = proto.Field( + end_index: int = proto.Field( proto.INT64, number=2, ) - text_segments = proto.RepeatedField( + text_segments: MutableSequence[ + "Document.TextAnchor.TextSegment" + ] = proto.RepeatedField( proto.MESSAGE, number=1, message="Document.TextAnchor.TextSegment", ) - content = proto.Field( + content: str = proto.Field( proto.STRING, number=2, ) @@ -1205,7 +1241,7 @@ class PageAnchor(proto.Message): polygons and optionally reference specific layout element types. Attributes: - page_refs (Sequence[google.cloud.documentai_v1beta3.types.Document.PageAnchor.PageRef]): + page_refs (MutableSequence[google.cloud.documentai_v1beta3.types.Document.PageAnchor.PageRef]): One or more references to visual page elements """ @@ -1248,30 +1284,30 @@ class LayoutType(proto.Enum): TABLE = 6 FORM_FIELD = 7 - page = proto.Field( + page: int = proto.Field( proto.INT64, number=1, ) - layout_type = proto.Field( + layout_type: "Document.PageAnchor.PageRef.LayoutType" = proto.Field( proto.ENUM, number=2, enum="Document.PageAnchor.PageRef.LayoutType", ) - layout_id = proto.Field( + layout_id: str = proto.Field( proto.STRING, number=3, ) - bounding_poly = proto.Field( + bounding_poly: geometry.BoundingPoly = proto.Field( proto.MESSAGE, number=4, message=geometry.BoundingPoly, ) - confidence = proto.Field( + confidence: float = proto.Field( proto.FLOAT, number=5, ) - page_refs = proto.RepeatedField( + page_refs: MutableSequence["Document.PageAnchor.PageRef"] = proto.RepeatedField( proto.MESSAGE, number=1, message="Document.PageAnchor.PageRef", @@ -1288,7 +1324,7 @@ class Provenance(proto.Message): id (int): The Id of this operation. Needs to be unique within the scope of the revision. - parents (Sequence[google.cloud.documentai_v1beta3.types.Document.Provenance.Parent]): + parents (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Provenance.Parent]): References to the original elements that are replaced. type_ (google.cloud.documentai_v1beta3.types.Document.Provenance.OperationType): @@ -1324,33 +1360,33 @@ class Parent(proto.Message): The id of the parent provenance. """ - revision = proto.Field( + revision: int = proto.Field( proto.INT32, number=1, ) - index = proto.Field( + index: int = proto.Field( proto.INT32, number=3, ) - id = proto.Field( + id: int = proto.Field( proto.INT32, number=2, ) - revision = proto.Field( + revision: int = proto.Field( proto.INT32, number=1, ) - id = proto.Field( + id: int = proto.Field( proto.INT32, number=2, ) - parents = proto.RepeatedField( + parents: MutableSequence["Document.Provenance.Parent"] = proto.RepeatedField( proto.MESSAGE, number=3, message="Document.Provenance.Parent", ) - type_ = proto.Field( + type_: "Document.Provenance.OperationType" = proto.Field( proto.ENUM, number=4, enum="Document.Provenance.OperationType", @@ -1380,11 +1416,11 @@ class Revision(proto.Message): id (str): Id of the revision. Unique within the context of the document. - parent (Sequence[int]): + parent (MutableSequence[int]): The revisions that this revision is based on. This can include one or more parent (when documents are merged.) This field represents the index into the ``revisions`` field. - parent_ids (Sequence[str]): + parent_ids (MutableSequence[str]): The revisions that this revision is based on. Must include all the ids that have anything to do with this revision - eg. there are ``provenance.parent.revision`` fields that @@ -1408,43 +1444,43 @@ class HumanReview(proto.Message): is ``rejected``. """ - state = proto.Field( + state: str = proto.Field( proto.STRING, number=1, ) - state_message = proto.Field( + state_message: str = proto.Field( proto.STRING, number=2, ) - agent = proto.Field( + agent: str = proto.Field( proto.STRING, number=4, oneof="source", ) - processor = proto.Field( + processor: str = proto.Field( proto.STRING, number=5, oneof="source", ) - id = proto.Field( + id: str = proto.Field( proto.STRING, number=1, ) - parent = proto.RepeatedField( + parent: MutableSequence[int] = proto.RepeatedField( proto.INT32, number=2, ) - parent_ids = proto.RepeatedField( + parent_ids: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=7, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, ) - human_review = proto.Field( + human_review: "Document.Revision.HumanReview" = proto.Field( proto.MESSAGE, number=6, message="Document.Revision.HumanReview", @@ -1463,79 +1499,79 @@ class TextChange(proto.Message): changed_text (str): The text that replaces the text identified in the ``text_anchor``. - provenance (Sequence[google.cloud.documentai_v1beta3.types.Document.Provenance]): + provenance (MutableSequence[google.cloud.documentai_v1beta3.types.Document.Provenance]): The history of this annotation. """ - text_anchor = proto.Field( + text_anchor: "Document.TextAnchor" = proto.Field( proto.MESSAGE, number=1, message="Document.TextAnchor", ) - changed_text = proto.Field( + changed_text: str = proto.Field( proto.STRING, number=2, ) - provenance = proto.RepeatedField( + provenance: MutableSequence["Document.Provenance"] = proto.RepeatedField( proto.MESSAGE, number=3, message="Document.Provenance", ) - uri = proto.Field( + uri: str = proto.Field( proto.STRING, number=1, oneof="source", ) - content = proto.Field( + content: bytes = proto.Field( proto.BYTES, number=2, oneof="source", ) - mime_type = proto.Field( + mime_type: str = proto.Field( proto.STRING, number=3, ) - text = proto.Field( + text: str = proto.Field( proto.STRING, number=4, ) - text_styles = proto.RepeatedField( + text_styles: MutableSequence[Style] = proto.RepeatedField( proto.MESSAGE, number=5, message=Style, ) - pages = proto.RepeatedField( + pages: MutableSequence[Page] = proto.RepeatedField( proto.MESSAGE, number=6, message=Page, ) - entities = proto.RepeatedField( + entities: MutableSequence[Entity] = proto.RepeatedField( proto.MESSAGE, number=7, message=Entity, ) - entity_relations = proto.RepeatedField( + entity_relations: MutableSequence[EntityRelation] = proto.RepeatedField( proto.MESSAGE, number=8, message=EntityRelation, ) - text_changes = proto.RepeatedField( + text_changes: MutableSequence[TextChange] = proto.RepeatedField( proto.MESSAGE, number=14, message=TextChange, ) - shard_info = proto.Field( + shard_info: ShardInfo = proto.Field( proto.MESSAGE, number=9, message=ShardInfo, ) - error = proto.Field( + error: status_pb2.Status = proto.Field( proto.MESSAGE, number=10, message=status_pb2.Status, ) - revisions = proto.RepeatedField( + revisions: MutableSequence[Revision] = proto.RepeatedField( proto.MESSAGE, number=13, message=Revision, diff --git a/google/cloud/documentai_v1beta3/types/document_io.py b/google/cloud/documentai_v1beta3/types/document_io.py index 2fe7f436..16a86eb9 100644 --- a/google/cloud/documentai_v1beta3/types/document_io.py +++ b/google/cloud/documentai_v1beta3/types/document_io.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -39,11 +41,11 @@ class RawDocument(proto.Message): of the [content]. """ - content = proto.Field( + content: bytes = proto.Field( proto.BYTES, number=1, ) - mime_type = proto.Field( + mime_type: str = proto.Field( proto.STRING, number=2, ) @@ -59,11 +61,11 @@ class GcsDocument(proto.Message): An IANA MIME type (RFC6838) of the content. """ - gcs_uri = proto.Field( + gcs_uri: str = proto.Field( proto.STRING, number=1, ) - mime_type = proto.Field( + mime_type: str = proto.Field( proto.STRING, number=2, ) @@ -73,11 +75,11 @@ class GcsDocuments(proto.Message): r"""Specifies a set of documents on Cloud Storage. Attributes: - documents (Sequence[google.cloud.documentai_v1beta3.types.GcsDocument]): + documents (MutableSequence[google.cloud.documentai_v1beta3.types.GcsDocument]): The list of documents. """ - documents = proto.RepeatedField( + documents: MutableSequence["GcsDocument"] = proto.RepeatedField( proto.MESSAGE, number=1, message="GcsDocument", @@ -93,7 +95,7 @@ class GcsPrefix(proto.Message): The URI prefix. """ - gcs_uri_prefix = proto.Field( + gcs_uri_prefix: str = proto.Field( proto.STRING, number=1, ) @@ -123,13 +125,13 @@ class BatchDocumentsInputConfig(proto.Message): This field is a member of `oneof`_ ``source``. """ - gcs_prefix = proto.Field( + gcs_prefix: "GcsPrefix" = proto.Field( proto.MESSAGE, number=1, oneof="source", message="GcsPrefix", ) - gcs_documents = proto.Field( + gcs_documents: "GcsDocuments" = proto.Field( proto.MESSAGE, number=2, oneof="source", @@ -161,12 +163,12 @@ class GcsOutputConfig(proto.Message): output. """ - gcs_uri = proto.Field( + gcs_uri: str = proto.Field( proto.STRING, number=1, ) - gcs_output_config = proto.Field( + gcs_output_config: GcsOutputConfig = proto.Field( proto.MESSAGE, number=1, oneof="destination", diff --git a/google/cloud/documentai_v1beta3/types/document_processor_service.py b/google/cloud/documentai_v1beta3/types/document_processor_service.py index a4eb1eef..0c2e75aa 100644 --- a/google/cloud/documentai_v1beta3/types/document_processor_service.py +++ b/google/cloud/documentai_v1beta3/types/document_processor_service.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore from google.rpc import status_pb2 # type: ignore @@ -113,32 +115,32 @@ class ProcessRequest(proto.Message): ProcessResponse's document. """ - inline_document = proto.Field( + inline_document: gcd_document.Document = proto.Field( proto.MESSAGE, number=4, oneof="source", message=gcd_document.Document, ) - raw_document = proto.Field( + raw_document: document_io.RawDocument = proto.Field( proto.MESSAGE, number=5, oneof="source", message=document_io.RawDocument, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - document = proto.Field( + document: gcd_document.Document = proto.Field( proto.MESSAGE, number=2, message=gcd_document.Document, ) - skip_human_review = proto.Field( + skip_human_review: bool = proto.Field( proto.BOOL, number=3, ) - field_mask = proto.Field( + field_mask: field_mask_pb2.FieldMask = proto.Field( proto.MESSAGE, number=6, message=field_mask_pb2.FieldMask, @@ -171,16 +173,16 @@ class State(proto.Enum): IN_PROGRESS = 3 ERROR = 4 - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=1, enum=State, ) - state_message = proto.Field( + state_message: str = proto.Field( proto.STRING, number=2, ) - human_review_operation = proto.Field( + human_review_operation: str = proto.Field( proto.STRING, number=3, ) @@ -205,16 +207,16 @@ class ProcessResponse(proto.Message): document. """ - document = proto.Field( + document: gcd_document.Document = proto.Field( proto.MESSAGE, number=1, message=gcd_document.Document, ) - human_review_operation = proto.Field( + human_review_operation: str = proto.Field( proto.STRING, number=2, ) - human_review_status = proto.Field( + human_review_status: "HumanReviewStatus" = proto.Field( proto.MESSAGE, number=3, message="HumanReviewStatus", @@ -233,7 +235,7 @@ class BatchProcessRequest(proto.Message): ``projects/{project}/locations/{location}/processors/{processor}``, or ``projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`` - input_configs (Sequence[google.cloud.documentai_v1beta3.types.BatchProcessRequest.BatchInputConfig]): + input_configs (MutableSequence[google.cloud.documentai_v1beta3.types.BatchProcessRequest.BatchInputConfig]): The input config for each single document in the batch process. output_config (google.cloud.documentai_v1beta3.types.BatchProcessRequest.BatchOutputConfig): @@ -261,11 +263,11 @@ class BatchInputConfig(proto.Message): should be application/json. """ - gcs_source = proto.Field( + gcs_source: str = proto.Field( proto.STRING, number=1, ) - mime_type = proto.Field( + mime_type: str = proto.Field( proto.STRING, number=2, ) @@ -279,36 +281,36 @@ class BatchOutputConfig(proto.Message): processed documents. """ - gcs_destination = proto.Field( + gcs_destination: str = proto.Field( proto.STRING, number=1, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - input_configs = proto.RepeatedField( + input_configs: MutableSequence[BatchInputConfig] = proto.RepeatedField( proto.MESSAGE, number=2, message=BatchInputConfig, ) - output_config = proto.Field( + output_config: BatchOutputConfig = proto.Field( proto.MESSAGE, number=3, message=BatchOutputConfig, ) - input_documents = proto.Field( + input_documents: document_io.BatchDocumentsInputConfig = proto.Field( proto.MESSAGE, number=5, message=document_io.BatchDocumentsInputConfig, ) - document_output_config = proto.Field( + document_output_config: document_io.DocumentOutputConfig = proto.Field( proto.MESSAGE, number=6, message=document_io.DocumentOutputConfig, ) - skip_human_review = proto.Field( + skip_human_review: bool = proto.Field( proto.BOOL, number=4, ) @@ -332,7 +334,7 @@ class BatchProcessMetadata(proto.Message): The creation time of the operation. update_time (google.protobuf.timestamp_pb2.Timestamp): The last update time of the operation. - individual_process_statuses (Sequence[google.cloud.documentai_v1beta3.types.BatchProcessMetadata.IndividualProcessStatus]): + individual_process_statuses (MutableSequence[google.cloud.documentai_v1beta3.types.BatchProcessMetadata.IndividualProcessStatus]): The list of response details of each document. """ @@ -376,49 +378,51 @@ class IndividualProcessStatus(proto.Message): document. """ - input_gcs_source = proto.Field( + input_gcs_source: str = proto.Field( proto.STRING, number=1, ) - status = proto.Field( + status: status_pb2.Status = proto.Field( proto.MESSAGE, number=2, message=status_pb2.Status, ) - output_gcs_destination = proto.Field( + output_gcs_destination: str = proto.Field( proto.STRING, number=3, ) - human_review_operation = proto.Field( + human_review_operation: str = proto.Field( proto.STRING, number=4, ) - human_review_status = proto.Field( + human_review_status: "HumanReviewStatus" = proto.Field( proto.MESSAGE, number=5, message="HumanReviewStatus", ) - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=1, enum=State, ) - state_message = proto.Field( + state_message: str = proto.Field( proto.STRING, number=2, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, ) - individual_process_statuses = proto.RepeatedField( + individual_process_statuses: MutableSequence[ + IndividualProcessStatus + ] = proto.RepeatedField( proto.MESSAGE, number=5, message=IndividualProcessStatus, @@ -436,7 +440,7 @@ class FetchProcessorTypesRequest(proto.Message): ``projects/{project}/locations/{location}`` """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) @@ -446,11 +450,13 @@ class FetchProcessorTypesResponse(proto.Message): r"""Response message for fetch processor types. Attributes: - processor_types (Sequence[google.cloud.documentai_v1beta3.types.ProcessorType]): + processor_types (MutableSequence[google.cloud.documentai_v1beta3.types.ProcessorType]): The list of processor types. """ - processor_types = proto.RepeatedField( + processor_types: MutableSequence[ + processor_type.ProcessorType + ] = proto.RepeatedField( proto.MESSAGE, number=1, message=processor_type.ProcessorType, @@ -476,15 +482,15 @@ class ListProcessorTypesRequest(proto.Message): empty if at the end of the list. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) @@ -494,7 +500,7 @@ class ListProcessorTypesResponse(proto.Message): r"""Response message for list processor types. Attributes: - processor_types (Sequence[google.cloud.documentai_v1beta3.types.ProcessorType]): + processor_types (MutableSequence[google.cloud.documentai_v1beta3.types.ProcessorType]): The processor types. next_page_token (str): Points to the next page, otherwise empty. @@ -504,12 +510,14 @@ class ListProcessorTypesResponse(proto.Message): def raw_page(self): return self - processor_types = proto.RepeatedField( + processor_types: MutableSequence[ + processor_type.ProcessorType + ] = proto.RepeatedField( proto.MESSAGE, number=1, message=processor_type.ProcessorType, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -534,15 +542,15 @@ class ListProcessorsRequest(proto.Message): next processor. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) @@ -552,7 +560,7 @@ class ListProcessorsResponse(proto.Message): r"""Response message for list processors. Attributes: - processors (Sequence[google.cloud.documentai_v1beta3.types.Processor]): + processors (MutableSequence[google.cloud.documentai_v1beta3.types.Processor]): The list of processors. next_page_token (str): Points to the next processor, otherwise @@ -563,12 +571,12 @@ class ListProcessorsResponse(proto.Message): def raw_page(self): return self - processors = proto.RepeatedField( + processors: MutableSequence[gcd_processor.Processor] = proto.RepeatedField( proto.MESSAGE, number=1, message=gcd_processor.Processor, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -582,7 +590,7 @@ class GetProcessorRequest(proto.Message): Required. The processor resource name. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -596,7 +604,7 @@ class GetProcessorVersionRequest(proto.Message): Required. The processor resource name. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -622,15 +630,15 @@ class ListProcessorVersionsRequest(proto.Message): the next processor version. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - page_size = proto.Field( + page_size: int = proto.Field( proto.INT32, number=2, ) - page_token = proto.Field( + page_token: str = proto.Field( proto.STRING, number=3, ) @@ -640,7 +648,7 @@ class ListProcessorVersionsResponse(proto.Message): r"""Response message for list processors. Attributes: - processor_versions (Sequence[google.cloud.documentai_v1beta3.types.ProcessorVersion]): + processor_versions (MutableSequence[google.cloud.documentai_v1beta3.types.ProcessorVersion]): The list of processors. next_page_token (str): Points to the next processor, otherwise @@ -651,12 +659,14 @@ class ListProcessorVersionsResponse(proto.Message): def raw_page(self): return self - processor_versions = proto.RepeatedField( + processor_versions: MutableSequence[ + gcd_processor.ProcessorVersion + ] = proto.RepeatedField( proto.MESSAGE, number=1, message=gcd_processor.ProcessorVersion, ) - next_page_token = proto.Field( + next_page_token: str = proto.Field( proto.STRING, number=2, ) @@ -671,7 +681,7 @@ class DeleteProcessorVersionRequest(proto.Message): to be deleted. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -687,7 +697,7 @@ class DeleteProcessorVersionMetadata(proto.Message): operation. """ - common_metadata = proto.Field( + common_metadata: operation_metadata.CommonOperationMetadata = proto.Field( proto.MESSAGE, number=1, message=operation_metadata.CommonOperationMetadata, @@ -703,7 +713,7 @@ class DeployProcessorVersionRequest(proto.Message): to be deployed. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -723,7 +733,7 @@ class DeployProcessorVersionMetadata(proto.Message): operation. """ - common_metadata = proto.Field( + common_metadata: operation_metadata.CommonOperationMetadata = proto.Field( proto.MESSAGE, number=1, message=operation_metadata.CommonOperationMetadata, @@ -739,7 +749,7 @@ class UndeployProcessorVersionRequest(proto.Message): to be undeployed. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -759,7 +769,7 @@ class UndeployProcessorVersionMetadata(proto.Message): operation. """ - common_metadata = proto.Field( + common_metadata: operation_metadata.CommonOperationMetadata = proto.Field( proto.MESSAGE, number=1, message=operation_metadata.CommonOperationMetadata, @@ -782,11 +792,11 @@ class CreateProcessorRequest(proto.Message): processor is under CMEK if CMEK fields are set. """ - parent = proto.Field( + parent: str = proto.Field( proto.STRING, number=1, ) - processor = proto.Field( + processor: gcd_processor.Processor = proto.Field( proto.MESSAGE, number=2, message=gcd_processor.Processor, @@ -802,7 +812,7 @@ class DeleteProcessorRequest(proto.Message): deleted. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -818,7 +828,7 @@ class DeleteProcessorMetadata(proto.Message): operation. """ - common_metadata = proto.Field( + common_metadata: operation_metadata.CommonOperationMetadata = proto.Field( proto.MESSAGE, number=5, message=operation_metadata.CommonOperationMetadata, @@ -834,7 +844,7 @@ class EnableProcessorRequest(proto.Message): enabled. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -857,7 +867,7 @@ class EnableProcessorMetadata(proto.Message): operation. """ - common_metadata = proto.Field( + common_metadata: operation_metadata.CommonOperationMetadata = proto.Field( proto.MESSAGE, number=5, message=operation_metadata.CommonOperationMetadata, @@ -873,7 +883,7 @@ class DisableProcessorRequest(proto.Message): disabled. """ - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) @@ -896,7 +906,7 @@ class DisableProcessorMetadata(proto.Message): operation. """ - common_metadata = proto.Field( + common_metadata: operation_metadata.CommonOperationMetadata = proto.Field( proto.MESSAGE, number=5, message=operation_metadata.CommonOperationMetadata, @@ -918,11 +928,11 @@ class SetDefaultProcessorVersionRequest(proto.Message): ``projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}`` """ - processor = proto.Field( + processor: str = proto.Field( proto.STRING, number=1, ) - default_processor_version = proto.Field( + default_processor_version: str = proto.Field( proto.STRING, number=2, ) @@ -942,7 +952,7 @@ class SetDefaultProcessorVersionMetadata(proto.Message): operation. """ - common_metadata = proto.Field( + common_metadata: operation_metadata.CommonOperationMetadata = proto.Field( proto.MESSAGE, number=1, message=operation_metadata.CommonOperationMetadata, @@ -979,31 +989,31 @@ class Priority(proto.Enum): DEFAULT = 0 URGENT = 1 - inline_document = proto.Field( + inline_document: gcd_document.Document = proto.Field( proto.MESSAGE, number=4, oneof="source", message=gcd_document.Document, ) - human_review_config = proto.Field( + human_review_config: str = proto.Field( proto.STRING, number=1, ) - document = proto.Field( + document: gcd_document.Document = proto.Field( proto.MESSAGE, number=2, message=gcd_document.Document, ) - enable_schema_validation = proto.Field( + enable_schema_validation: bool = proto.Field( proto.BOOL, number=3, ) - priority = proto.Field( + priority: Priority = proto.Field( proto.ENUM, number=5, enum=Priority, ) - document_schema = proto.Field( + document_schema: gcd_document_schema.DocumentSchema = proto.Field( proto.MESSAGE, number=6, message=gcd_document_schema.DocumentSchema, @@ -1030,16 +1040,16 @@ class State(proto.Enum): REJECTED = 1 SUCCEEDED = 2 - gcs_destination = proto.Field( + gcs_destination: str = proto.Field( proto.STRING, number=1, ) - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=2, enum=State, ) - rejection_reason = proto.Field( + rejection_reason: str = proto.Field( proto.STRING, number=3, ) @@ -1076,31 +1086,31 @@ class State(proto.Enum): FAILED = 4 CANCELLED = 5 - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=1, enum=State, ) - state_message = proto.Field( + state_message: str = proto.Field( proto.STRING, number=2, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, ) - common_metadata = proto.Field( + common_metadata: operation_metadata.CommonOperationMetadata = proto.Field( proto.MESSAGE, number=5, message=operation_metadata.CommonOperationMetadata, ) - question_id = proto.Field( + question_id: str = proto.Field( proto.STRING, number=6, ) diff --git a/google/cloud/documentai_v1beta3/types/document_schema.py b/google/cloud/documentai_v1beta3/types/document_schema.py index e67d8d05..d784a4c6 100644 --- a/google/cloud/documentai_v1beta3/types/document_schema.py +++ b/google/cloud/documentai_v1beta3/types/document_schema.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -32,7 +34,7 @@ class DocumentSchema(proto.Message): Display name to show to users. description (str): Description of the schema. - entity_types (Sequence[google.cloud.documentai_v1beta3.types.DocumentSchema.EntityType]): + entity_types (MutableSequence[google.cloud.documentai_v1beta3.types.DocumentSchema.EntityType]): Entity types of the schema. metadata (google.cloud.documentai_v1beta3.types.DocumentSchema.Metadata): Metadata of the schema. @@ -74,10 +76,10 @@ class EntityType(proto.Message): For example line_item/amount. This convention is deprecated, but will still be honored for backward compatibility. - base_types (Sequence[str]): + base_types (MutableSequence[str]): The entity type that this type is derived from. For now, one and only one should be set. - properties (Sequence[google.cloud.documentai_v1beta3.types.DocumentSchema.EntityType.Property]): + properties (MutableSequence[google.cloud.documentai_v1beta3.types.DocumentSchema.EntityType.Property]): Describing the nested structure, or composition of an entity. """ @@ -86,12 +88,12 @@ class EnumValues(proto.Message): r"""Defines the a list of enum values. Attributes: - values (Sequence[str]): + values (MutableSequence[str]): The individual values that this enum values type can include. """ - values = proto.RepeatedField( + values: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=1, ) @@ -124,39 +126,43 @@ class OccurrenceType(proto.Enum): REQUIRED_ONCE = 3 REQUIRED_MULTIPLE = 4 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - value_type = proto.Field( + value_type: str = proto.Field( proto.STRING, number=2, ) - occurrence_type = proto.Field( - proto.ENUM, - number=3, - enum="DocumentSchema.EntityType.Property.OccurrenceType", + occurrence_type: "DocumentSchema.EntityType.Property.OccurrenceType" = ( + proto.Field( + proto.ENUM, + number=3, + enum="DocumentSchema.EntityType.Property.OccurrenceType", + ) ) - enum_values = proto.Field( + enum_values: "DocumentSchema.EntityType.EnumValues" = proto.Field( proto.MESSAGE, number=14, oneof="value_source", message="DocumentSchema.EntityType.EnumValues", ) - display_name = proto.Field( + display_name: str = proto.Field( proto.STRING, number=13, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - base_types = proto.RepeatedField( + base_types: MutableSequence[str] = proto.RepeatedField( proto.STRING, number=2, ) - properties = proto.RepeatedField( + properties: MutableSequence[ + "DocumentSchema.EntityType.Property" + ] = proto.RepeatedField( proto.MESSAGE, number=6, message="DocumentSchema.EntityType.Property", @@ -184,37 +190,37 @@ class Metadata(proto.Message): checked. """ - document_splitter = proto.Field( + document_splitter: bool = proto.Field( proto.BOOL, number=1, ) - document_allow_multiple_labels = proto.Field( + document_allow_multiple_labels: bool = proto.Field( proto.BOOL, number=2, ) - prefixed_naming_on_properties = proto.Field( + prefixed_naming_on_properties: bool = proto.Field( proto.BOOL, number=6, ) - skip_naming_validation = proto.Field( + skip_naming_validation: bool = proto.Field( proto.BOOL, number=7, ) - display_name = proto.Field( + display_name: str = proto.Field( proto.STRING, number=1, ) - description = proto.Field( + description: str = proto.Field( proto.STRING, number=2, ) - entity_types = proto.RepeatedField( + entity_types: MutableSequence[EntityType] = proto.RepeatedField( proto.MESSAGE, number=3, message=EntityType, ) - metadata = proto.Field( + metadata: Metadata = proto.Field( proto.MESSAGE, number=4, message=Metadata, diff --git a/google/cloud/documentai_v1beta3/types/geometry.py b/google/cloud/documentai_v1beta3/types/geometry.py index 2add8a91..d5c9d422 100644 --- a/google/cloud/documentai_v1beta3/types/geometry.py +++ b/google/cloud/documentai_v1beta3/types/geometry.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + import proto # type: ignore __protobuf__ = proto.module( @@ -38,11 +40,11 @@ class Vertex(proto.Message): image). """ - x = proto.Field( + x: int = proto.Field( proto.INT32, number=1, ) - y = proto.Field( + y: int = proto.Field( proto.INT32, number=2, ) @@ -61,11 +63,11 @@ class NormalizedVertex(proto.Message): image). """ - x = proto.Field( + x: float = proto.Field( proto.FLOAT, number=1, ) - y = proto.Field( + y: float = proto.Field( proto.FLOAT, number=2, ) @@ -75,18 +77,18 @@ class BoundingPoly(proto.Message): r"""A bounding polygon for the detected image annotation. Attributes: - vertices (Sequence[google.cloud.documentai_v1beta3.types.Vertex]): + vertices (MutableSequence[google.cloud.documentai_v1beta3.types.Vertex]): The bounding polygon vertices. - normalized_vertices (Sequence[google.cloud.documentai_v1beta3.types.NormalizedVertex]): + normalized_vertices (MutableSequence[google.cloud.documentai_v1beta3.types.NormalizedVertex]): The bounding polygon normalized vertices. """ - vertices = proto.RepeatedField( + vertices: MutableSequence["Vertex"] = proto.RepeatedField( proto.MESSAGE, number=1, message="Vertex", ) - normalized_vertices = proto.RepeatedField( + normalized_vertices: MutableSequence["NormalizedVertex"] = proto.RepeatedField( proto.MESSAGE, number=2, message="NormalizedVertex", diff --git a/google/cloud/documentai_v1beta3/types/operation_metadata.py b/google/cloud/documentai_v1beta3/types/operation_metadata.py index 046a8cec..e1a6b403 100644 --- a/google/cloud/documentai_v1beta3/types/operation_metadata.py +++ b/google/cloud/documentai_v1beta3/types/operation_metadata.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore @@ -50,25 +52,25 @@ class State(proto.Enum): FAILED = 4 CANCELLED = 5 - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=1, enum=State, ) - state_message = proto.Field( + state_message: str = proto.Field( proto.STRING, number=2, ) - resource = proto.Field( + resource: str = proto.Field( proto.STRING, number=5, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, ) - update_time = proto.Field( + update_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, diff --git a/google/cloud/documentai_v1beta3/types/processor.py b/google/cloud/documentai_v1beta3/types/processor.py index bad14fbc..7a46f221 100644 --- a/google/cloud/documentai_v1beta3/types/processor.py +++ b/google/cloud/documentai_v1beta3/types/processor.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.protobuf import timestamp_pb2 # type: ignore import proto # type: ignore @@ -80,47 +82,47 @@ class DeprecationInfo(proto.Message): used as a replacement. """ - deprecation_time = proto.Field( + deprecation_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=1, message=timestamp_pb2.Timestamp, ) - replacement_processor_version = proto.Field( + replacement_processor_version: str = proto.Field( proto.STRING, number=2, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - display_name = proto.Field( + display_name: str = proto.Field( proto.STRING, number=2, ) - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=6, enum=State, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp, ) - kms_key_name = proto.Field( + kms_key_name: str = proto.Field( proto.STRING, number=9, ) - kms_key_version_name = proto.Field( + kms_key_version_name: str = proto.Field( proto.STRING, number=10, ) - google_managed = proto.Field( + google_managed: bool = proto.Field( proto.BOOL, number=11, ) - deprecation_info = proto.Field( + deprecation_info: DeprecationInfo = proto.Field( proto.MESSAGE, number=13, message=DeprecationInfo, @@ -168,37 +170,37 @@ class State(proto.Enum): FAILED = 6 DELETING = 7 - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - type_ = proto.Field( + type_: str = proto.Field( proto.STRING, number=2, ) - display_name = proto.Field( + display_name: str = proto.Field( proto.STRING, number=3, ) - state = proto.Field( + state: State = proto.Field( proto.ENUM, number=4, enum=State, ) - default_processor_version = proto.Field( + default_processor_version: str = proto.Field( proto.STRING, number=9, ) - process_endpoint = proto.Field( + process_endpoint: str = proto.Field( proto.STRING, number=6, ) - create_time = proto.Field( + create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp, ) - kms_key_name = proto.Field( + kms_key_name: str = proto.Field( proto.STRING, number=8, ) diff --git a/google/cloud/documentai_v1beta3/types/processor_type.py b/google/cloud/documentai_v1beta3/types/processor_type.py index c61bea0f..ad034b5e 100644 --- a/google/cloud/documentai_v1beta3/types/processor_type.py +++ b/google/cloud/documentai_v1beta3/types/processor_type.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. # +from typing import MutableMapping, MutableSequence + from google.api import launch_stage_pb2 # type: ignore import proto # type: ignore @@ -37,7 +39,7 @@ class ProcessorType(proto.Message): category (str): The processor category, used by UI to group processor types. - available_locations (Sequence[google.cloud.documentai_v1beta3.types.ProcessorType.LocationInfo]): + available_locations (MutableSequence[google.cloud.documentai_v1beta3.types.ProcessorType.LocationInfo]): The locations in which this processor is available. allow_creation (bool): @@ -58,33 +60,33 @@ class LocationInfo(proto.Message): The location id, currently must be one of [us, eu]. """ - location_id = proto.Field( + location_id: str = proto.Field( proto.STRING, number=1, ) - name = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - type_ = proto.Field( + type_: str = proto.Field( proto.STRING, number=2, ) - category = proto.Field( + category: str = proto.Field( proto.STRING, number=3, ) - available_locations = proto.RepeatedField( + available_locations: MutableSequence[LocationInfo] = proto.RepeatedField( proto.MESSAGE, number=4, message=LocationInfo, ) - allow_creation = proto.Field( + allow_creation: bool = proto.Field( proto.BOOL, number=6, ) - launch_stage = proto.Field( + launch_stage: launch_stage_pb2.LaunchStage = proto.Field( proto.ENUM, number=8, enum=launch_stage_pb2.LaunchStage, diff --git a/samples/generated_samples/snippet_metadata_documentai_v1.json b/samples/generated_samples/snippet_metadata_google.cloud.documentai.v1.json similarity index 99% rename from samples/generated_samples/snippet_metadata_documentai_v1.json rename to samples/generated_samples/snippet_metadata_google.cloud.documentai.v1.json index f534f7d7..5064960d 100644 --- a/samples/generated_samples/snippet_metadata_documentai_v1.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.documentai.v1.json @@ -7,7 +7,8 @@ } ], "language": "PYTHON", - "name": "google-cloud-documentai" + "name": "google-cloud-documentai", + "version": "0.1.0" }, "snippets": [ { diff --git a/samples/generated_samples/snippet_metadata_documentai_v1beta2.json b/samples/generated_samples/snippet_metadata_google.cloud.documentai.v1beta2.json similarity index 97% rename from samples/generated_samples/snippet_metadata_documentai_v1beta2.json rename to samples/generated_samples/snippet_metadata_google.cloud.documentai.v1beta2.json index ba1d80ed..ef56bd7e 100644 --- a/samples/generated_samples/snippet_metadata_documentai_v1beta2.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.documentai.v1beta2.json @@ -7,7 +7,8 @@ } ], "language": "PYTHON", - "name": "google-cloud-documentai" + "name": "google-cloud-documentai", + "version": "0.1.0" }, "snippets": [ { @@ -34,7 +35,7 @@ }, { "name": "requests", - "type": "Sequence[google.cloud.documentai_v1beta2.types.ProcessDocumentRequest]" + "type": "MutableSequence[google.cloud.documentai_v1beta2.types.ProcessDocumentRequest]" }, { "name": "retry", @@ -114,7 +115,7 @@ }, { "name": "requests", - "type": "Sequence[google.cloud.documentai_v1beta2.types.ProcessDocumentRequest]" + "type": "MutableSequence[google.cloud.documentai_v1beta2.types.ProcessDocumentRequest]" }, { "name": "retry", diff --git a/samples/generated_samples/snippet_metadata_documentai_v1beta3.json b/samples/generated_samples/snippet_metadata_google.cloud.documentai.v1beta3.json similarity index 99% rename from samples/generated_samples/snippet_metadata_documentai_v1beta3.json rename to samples/generated_samples/snippet_metadata_google.cloud.documentai.v1beta3.json index 860bdc9f..74c31699 100644 --- a/samples/generated_samples/snippet_metadata_documentai_v1beta3.json +++ b/samples/generated_samples/snippet_metadata_google.cloud.documentai.v1beta3.json @@ -7,7 +7,8 @@ } ], "language": "PYTHON", - "name": "google-cloud-documentai" + "name": "google-cloud-documentai", + "version": "0.1.0" }, "snippets": [ { diff --git a/testing/constraints-3.7.txt b/testing/constraints-3.7.txt index db7ea7e6..21227194 100644 --- a/testing/constraints-3.7.txt +++ b/testing/constraints-3.7.txt @@ -4,8 +4,6 @@ # Pin the version to the lower bound. # e.g., if setup.py has "google-cloud-foo >= 1.14.0, < 2.0.0dev", # Then this file should have google-cloud-foo==1.14.0 -# This file is intentionally left empty to test the -# latest versions of dependencies. google-api-core==1.33.2 proto-plus==1.22.0 protobuf==3.19.5