Skip to content

Commit

Permalink
[formrecognizer] regenerate on latest (Azure#20867)
Browse files Browse the repository at this point in the history
* regenerate with latest

* update convenience layer
  • Loading branch information
kristapratico authored Sep 28, 2021
1 parent 131546b commit 831d3c6
Show file tree
Hide file tree
Showing 67 changed files with 769 additions and 778 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ def begin_analyze_document(self, model, document, **kwargs):
"prebuilt-document", "prebuilt-layout".
:param document: JPEG, PNG, PDF, TIFF, or BMP type file stream or bytes.
:type document: bytes or IO[bytes]
:keyword list[str] pages: Custom page numbers for multi-page documents(PDF/TIFF). Input the page numbers
:keyword str pages: Custom page numbers for multi-page documents(PDF/TIFF). Input the page numbers
and/or ranges of pages you want to get in the result. For a range of pages, use a hyphen, like
`pages=["1-3", "5-6"]`. Separate each page number or range with a comma.
`pages="1-3, 5-6"`. Separate each page number or range with a comma.
:keyword str locale: Locale of the document. Supported locales include: en-US, en-AU, en-CA, en-GB,
and en-IN.
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
Expand Down Expand Up @@ -139,9 +139,9 @@ def begin_analyze_document_from_url(self, model, document_url, **kwargs):
"prebuilt-document", "prebuilt-layout".
:param str document_url: The URL of the document to analyze. The input must be a valid, encoded URL
of one of the supported formats: JPEG, PNG, PDF, TIFF, or BMP.
:keyword list[str] pages: Custom page numbers for multi-page documents(PDF/TIFF). Input the page numbers
:keyword str pages: Custom page numbers for multi-page documents(PDF/TIFF). Input the page numbers
and/or ranges of pages you want to get in the result. For a range of pages, use a hyphen, like
`pages=["1-3", "5-6"]`. Separate each page number or range with a comma.
`pages="1-3, 5-6"`. Separate each page number or range with a comma.
:keyword str locale: Locale of the document. Supported locales include: en-US, en-AU, en-CA, en-GB,
and en-IN.
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
from azure.core.polling import LROPoller
from azure.core.polling.base_polling import LROBasePolling
from azure.core.pipeline import Pipeline
from ._generated.models import (
CopyRequest,
CopyAuthorizationResult,
)
from ._helpers import TransportWrapper
from ._api_versions import FormRecognizerApiVersion
from ._models import (
Expand Down Expand Up @@ -423,10 +419,10 @@ def _copy_callback(raw_response, _, headers): # pylint: disable=unused-argument

return self._client.begin_copy_custom_model( # type: ignore
model_id=model_id,
copy_request=CopyRequest(
copy_request=self._generated_models.CopyRequest(
target_resource_id=target["resourceId"],
target_resource_region=target["resourceRegion"],
copy_authorization=CopyAuthorizationResult(
copy_authorization=self._generated_models.CopyAuthorizationResult(
access_token=target["accessToken"],
model_id=target["modelId"],
expiration_date_time_ticks=target["expirationDateTimeTicks"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class FormRecognizerClientConfiguration(Configuration):
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com).
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for
example: https://westus2.api.cognitive.microsoft.com).
:type endpoint: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class FormRecognizerClient(FormRecognizerClientOperationsMixin, MultiApiClientMi
:param credential: Credential needed for the client to connect to Azure.
:type credential: ~azure.core.credentials.TokenCredential
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus2.api.cognitive.microsoft.com).
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for
example: https://westus2.api.cognitive.microsoft.com).
:type endpoint: str
:param api_version: API version to use if no profile is provided, or if missing in profile.
:type api_version: str
Expand All @@ -60,28 +61,6 @@ class FormRecognizerClient(FormRecognizerClientOperationsMixin, MultiApiClientMi
LATEST_PROFILE = ProfileDefinition({
_PROFILE_TAG: {
None: DEFAULT_API_VERSION,
'begin_analyze_business_card_async': '2.1',
'begin_analyze_id_document_async': '2.1',
'begin_analyze_invoice_async': '2.1',
'begin_analyze_layout_async': '2.1',
'begin_analyze_receipt_async': '2.1',
'begin_analyze_with_custom_model': '2.1',
'begin_compose_custom_models_async': '2.1',
'begin_copy_custom_model': '2.1',
'begin_train_custom_model_async': '2.1',
'delete_custom_model': '2.1',
'generate_model_copy_authorization': '2.1',
'get_analyze_business_card_result': '2.1',
'get_analyze_form_result': '2.1',
'get_analyze_id_document_result': '2.1',
'get_analyze_invoice_result': '2.1',
'get_analyze_layout_result': '2.1',
'get_analyze_receipt_result': '2.1',
'get_custom_model': '2.1',
'get_custom_model_copy_result': '2.1',
'get_custom_models': '2.1',
'list_custom_models': '2.1',
'train_custom_model_async': '2.0',
}},
_PROFILE_TAG + " latest"
)
Expand Down Expand Up @@ -117,19 +96,19 @@ def _models_dict(cls, api_version):
def models(cls, api_version=DEFAULT_API_VERSION):
"""Module depends on the API version:
* 2021-09-30-preview: :mod:`v2021_09_30_preview.models<azure.ai.formrecognizer.v2021_09_30_preview.models>`
* 2.0: :mod:`v2_0.models<azure.ai.formrecognizer.v2_0.models>`
* 2.1: :mod:`v2_1.models<azure.ai.formrecognizer.v2_1.models>`
* 2021-09-30-preview: :mod:`v3_0_preview_1.models<azure.ai.formrecognizer.v3_0_preview_1.models>`
"""
if api_version == '2.0':
if api_version == '2021-09-30-preview':
from .v2021_09_30_preview import models
return models
elif api_version == '2.0':
from .v2_0 import models
return models
elif api_version == '2.1':
from .v2_1 import models
return models
elif api_version == '2021-09-30-preview':
from .v3_0_preview_1 import models
return models
raise ValueError("API version {} is not available".format(api_version))

def close(self):
Expand Down
Loading

0 comments on commit 831d3c6

Please sign in to comment.