Skip to content

Commit de5c042

Browse files
author
SDKAuto
committed
CodeGen from PR 34270 in Azure/azure-rest-api-specs
Merge c5c31b0506df39bc9e78f53a9678914719c1964d into a19648565889eaae019e531c15f3045d1244c7ce
1 parent 6c30600 commit de5c042

File tree

94 files changed

+2487
-2324
lines changed

Some content is hidden

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

94 files changed

+2487
-2324
lines changed

sdk/documentintelligence/azure-ai-documentintelligence/MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ include azure/ai/documentintelligence/py.typed
44
recursive-include tests *.py
55
recursive-include samples *.py *.md
66
include azure/__init__.py
7-
include azure/ai/__init__.py
7+
include azure/ai/__init__.py
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"commit": "079f70d6f2b754db6b736e117196104efd2dd496",
3+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4+
"typespec_src": "specification/ai/DocumentIntelligence",
5+
"@azure-tools/typespec-python": "0.44.2"
6+
}

sdk/documentintelligence/azure-ai-documentintelligence/apiview-properties.json

Lines changed: 130 additions & 0 deletions
Large diffs are not rendered by default.

sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_client.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
DocumentIntelligenceAdministrationClientOperationsMixin,
2424
DocumentIntelligenceClientOperationsMixin,
2525
)
26-
from ._serialization import Deserializer, Serializer
26+
from ._utils.serialization import Deserializer, Serializer
2727

2828
if TYPE_CHECKING:
2929
from azure.core.credentials import TokenCredential
@@ -34,8 +34,8 @@ class DocumentIntelligenceClient(DocumentIntelligenceClientOperationsMixin):
3434
3535
:param endpoint: The Document Intelligence service endpoint. Required.
3636
:type endpoint: str
37-
:param credential: Credential used to authenticate requests to the service. Is either a
38-
AzureKeyCredential type or a TokenCredential type. Required.
37+
:param credential: Credential used to authenticate requests to the service. Is either a key
38+
credential type or a token credential type. Required.
3939
:type credential: ~azure.core.credentials.AzureKeyCredential or
4040
~azure.core.credentials.TokenCredential
4141
:keyword api_version: The API version to use for this operation. Default value is "2024-11-30".
@@ -48,6 +48,7 @@ class DocumentIntelligenceClient(DocumentIntelligenceClientOperationsMixin):
4848
def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
4949
_endpoint = "{endpoint}/documentintelligence"
5050
self._config = DocumentIntelligenceClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)
51+
5152
_policies = kwargs.pop("policies", None)
5253
if _policies is None:
5354
_policies = [
@@ -113,8 +114,8 @@ class DocumentIntelligenceAdministrationClient(DocumentIntelligenceAdministratio
113114
114115
:param endpoint: The Document Intelligence service endpoint. Required.
115116
:type endpoint: str
116-
:param credential: Credential used to authenticate requests to the service. Is either a
117-
AzureKeyCredential type or a TokenCredential type. Required.
117+
:param credential: Credential used to authenticate requests to the service. Is either a key
118+
credential type or a token credential type. Required.
118119
:type credential: ~azure.core.credentials.AzureKeyCredential or
119120
~azure.core.credentials.TokenCredential
120121
:keyword api_version: The API version to use for this operation. Default value is "2024-11-30".
@@ -129,6 +130,7 @@ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCr
129130
self._config = DocumentIntelligenceAdministrationClientConfiguration(
130131
endpoint=endpoint, credential=credential, **kwargs
131132
)
133+
132134
_policies = kwargs.pop("policies", None)
133135
if _policies is None:
134136
_policies = [

sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_configuration.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# pylint: disable=line-too-long,useless-suppression
12
# coding=utf-8
23
# --------------------------------------------------------------------------
34
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -25,8 +26,8 @@ class DocumentIntelligenceClientConfiguration: # pylint: disable=too-many-insta
2526
2627
:param endpoint: The Document Intelligence service endpoint. Required.
2728
:type endpoint: str
28-
:param credential: Credential used to authenticate requests to the service. Is either a
29-
AzureKeyCredential type or a TokenCredential type. Required.
29+
:param credential: Credential used to authenticate requests to the service. Is either a key
30+
credential type or a token credential type. Required.
3031
:type credential: ~azure.core.credentials.AzureKeyCredential or
3132
~azure.core.credentials.TokenCredential
3233
:keyword api_version: The API version to use for this operation. Default value is "2024-11-30".
@@ -79,8 +80,8 @@ class DocumentIntelligenceAdministrationClientConfiguration: # pylint: disable=
7980
8081
:param endpoint: The Document Intelligence service endpoint. Required.
8182
:type endpoint: str
82-
:param credential: Credential used to authenticate requests to the service. Is either a
83-
AzureKeyCredential type or a TokenCredential type. Required.
83+
:param credential: Credential used to authenticate requests to the service. Is either a key
84+
credential type or a token credential type. Required.
8485
:type credential: ~azure.core.credentials.AzureKeyCredential or
8586
~azure.core.credentials.TokenCredential
8687
:keyword api_version: The API version to use for this operation. Default value is "2024-11-30".

sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_operations/_operations.py

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
# Code generated by Microsoft (R) Python Code Generator.
77
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
88
# --------------------------------------------------------------------------
9+
from collections.abc import MutableMapping
910
from io import IOBase
1011
import json
11-
import sys
1212
from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, TypeVar, Union, cast, overload
1313
import urllib.parse
1414

15+
from azure.core import PipelineClient
1516
from azure.core.exceptions import (
1617
ClientAuthenticationError,
1718
HttpResponseError,
@@ -31,15 +32,15 @@
3132
from azure.core.utils import case_insensitive_dict
3233

3334
from .. import models as _models
34-
from .._model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize
35-
from .._serialization import Serializer
36-
from .._vendor import DocumentIntelligenceAdministrationClientMixinABC, DocumentIntelligenceClientMixinABC
37-
38-
if sys.version_info >= (3, 9):
39-
from collections.abc import MutableMapping
40-
else:
41-
from typing import MutableMapping # type: ignore
42-
JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
35+
from .._configuration import (
36+
DocumentIntelligenceAdministrationClientConfiguration,
37+
DocumentIntelligenceClientConfiguration,
38+
)
39+
from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize
40+
from .._utils.serialization import Serializer
41+
from .._utils.utils import ClientMixinABC
42+
43+
JSON = MutableMapping[str, Any]
4344
T = TypeVar("T")
4445
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
4546

@@ -745,7 +746,9 @@ def build_document_intelligence_administration_delete_classifier_request( # pyl
745746
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)
746747

747748

748-
class DocumentIntelligenceClientOperationsMixin(DocumentIntelligenceClientMixinABC): # pylint: disable=name-too-long
749+
class DocumentIntelligenceClientOperationsMixin( # pylint: disable=name-too-long
750+
ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], DocumentIntelligenceClientConfiguration]
751+
):
749752

750753
def _analyze_document_initial(
751754
self,
@@ -1069,7 +1072,7 @@ def get_long_running_output(pipeline_response):
10691072
"str", response.headers.get("Operation-Location")
10701073
)
10711074

1072-
deserialized = _deserialize(_models.AnalyzeResult, response.json().get("analyzeResult"))
1075+
deserialized = _deserialize(_models.AnalyzeResult, response.json().get("analyzeResult", {}))
10731076
if cls:
10741077
return cls(pipeline_response, deserialized, response_headers) # type: ignore
10751078
return deserialized
@@ -1607,7 +1610,7 @@ def get_long_running_output(pipeline_response):
16071610
"str", response.headers.get("Operation-Location")
16081611
)
16091612

1610-
deserialized = _deserialize(_models.AnalyzeBatchResult, response.json().get("result"))
1613+
deserialized = _deserialize(_models.AnalyzeBatchResult, response.json().get("result", {}))
16111614
if cls:
16121615
return cls(pipeline_response, deserialized, response_headers) # type: ignore
16131616
return deserialized
@@ -1699,7 +1702,7 @@ def prepare_request(next_link=None):
16991702

17001703
def extract_data(pipeline_response):
17011704
deserialized = pipeline_response.http_response.json()
1702-
list_of_elem = _deserialize(List[_models.AnalyzeBatchOperation], deserialized["value"])
1705+
list_of_elem = _deserialize(List[_models.AnalyzeBatchOperation], deserialized.get("value", []))
17031706
if cls:
17041707
list_of_elem = cls(list_of_elem) # type: ignore
17051708
return deserialized.get("nextLink") or None, iter(list_of_elem)
@@ -2082,7 +2085,7 @@ def get_long_running_output(pipeline_response):
20822085
"str", response.headers.get("Operation-Location")
20832086
)
20842087

2085-
deserialized = _deserialize(_models.AnalyzeResult, response.json().get("analyzeResult"))
2088+
deserialized = _deserialize(_models.AnalyzeResult, response.json().get("analyzeResult", {}))
20862089
if cls:
20872090
return cls(pipeline_response, deserialized, response_headers) # type: ignore
20882091
return deserialized
@@ -2112,7 +2115,7 @@ def get_long_running_output(pipeline_response):
21122115

21132116

21142117
class DocumentIntelligenceAdministrationClientOperationsMixin( # pylint: disable=too-many-public-methods,name-too-long
2115-
DocumentIntelligenceAdministrationClientMixinABC
2118+
ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], DocumentIntelligenceAdministrationClientConfiguration]
21162119
):
21172120

21182121
def _build_document_model_initial(
@@ -2271,7 +2274,7 @@ def get_long_running_output(pipeline_response):
22712274
"str", response.headers.get("Operation-Location")
22722275
)
22732276

2274-
deserialized = _deserialize(_models.DocumentModelDetails, response.json().get("result"))
2277+
deserialized = _deserialize(_models.DocumentModelDetails, response.json().get("result", {}))
22752278
if cls:
22762279
return cls(pipeline_response, deserialized, response_headers) # type: ignore
22772280
return deserialized
@@ -2455,7 +2458,7 @@ def get_long_running_output(pipeline_response):
24552458
"str", response.headers.get("Operation-Location")
24562459
)
24572460

2458-
deserialized = _deserialize(_models.DocumentModelDetails, response.json().get("result"))
2461+
deserialized = _deserialize(_models.DocumentModelDetails, response.json().get("result", {}))
24592462
if cls:
24602463
return cls(pipeline_response, deserialized, response_headers) # type: ignore
24612464
return deserialized
@@ -2783,7 +2786,7 @@ def get_long_running_output(pipeline_response):
27832786
"str", response.headers.get("Operation-Location")
27842787
)
27852788

2786-
deserialized = _deserialize(_models.DocumentModelDetails, response.json().get("result"))
2789+
deserialized = _deserialize(_models.DocumentModelDetails, response.json().get("result", {}))
27872790
if cls:
27882791
return cls(pipeline_response, deserialized, response_headers) # type: ignore
27892792
return deserialized
@@ -2938,7 +2941,7 @@ def prepare_request(next_link=None):
29382941

29392942
def extract_data(pipeline_response):
29402943
deserialized = pipeline_response.http_response.json()
2941-
list_of_elem = _deserialize(List[_models.DocumentModelDetails], deserialized["value"])
2944+
list_of_elem = _deserialize(List[_models.DocumentModelDetails], deserialized.get("value", []))
29422945
if cls:
29432946
list_of_elem = cls(list_of_elem) # type: ignore
29442947
return deserialized.get("nextLink") or None, iter(list_of_elem)
@@ -3202,7 +3205,9 @@ def prepare_request(next_link=None):
32023205

32033206
def extract_data(pipeline_response):
32043207
deserialized = pipeline_response.http_response.json()
3205-
list_of_elem = _deserialize(List[_models.DocumentIntelligenceOperationDetails], deserialized["value"])
3208+
list_of_elem = _deserialize(
3209+
List[_models.DocumentIntelligenceOperationDetails], deserialized.get("value", [])
3210+
)
32063211
if cls:
32073212
list_of_elem = cls(list_of_elem) # type: ignore
32083213
return deserialized.get("nextLink") or None, iter(list_of_elem)
@@ -3381,7 +3386,7 @@ def get_long_running_output(pipeline_response):
33813386
"str", response.headers.get("Operation-Location")
33823387
)
33833388

3384-
deserialized = _deserialize(_models.DocumentClassifierDetails, response.json().get("result"))
3389+
deserialized = _deserialize(_models.DocumentClassifierDetails, response.json().get("result", {}))
33853390
if cls:
33863391
return cls(pipeline_response, deserialized, response_headers) # type: ignore
33873392
return deserialized
@@ -3715,7 +3720,7 @@ def get_long_running_output(pipeline_response):
37153720
"str", response.headers.get("Operation-Location")
37163721
)
37173722

3718-
deserialized = _deserialize(_models.DocumentClassifierDetails, response.json().get("result"))
3723+
deserialized = _deserialize(_models.DocumentClassifierDetails, response.json().get("result", {}))
37193724
if cls:
37203725
return cls(pipeline_response, deserialized, response_headers) # type: ignore
37213726
return deserialized
@@ -3871,7 +3876,7 @@ def prepare_request(next_link=None):
38713876

38723877
def extract_data(pipeline_response):
38733878
deserialized = pipeline_response.http_response.json()
3874-
list_of_elem = _deserialize(List[_models.DocumentClassifierDetails], deserialized["value"])
3879+
list_of_elem = _deserialize(List[_models.DocumentClassifierDetails], deserialized.get("value", []))
38753880
if cls:
38763881
list_of_elem = cls(list_of_elem) # type: ignore
38773882
return deserialized.get("nextLink") or None, iter(list_of_elem)

0 commit comments

Comments
 (0)