|
6 | 6 | # Code generated by Microsoft (R) Python Code Generator. |
7 | 7 | # Changes may cause incorrect behavior and will be lost if the code is regenerated. |
8 | 8 | # -------------------------------------------------------------------------- |
| 9 | +from collections.abc import MutableMapping |
9 | 10 | from io import IOBase |
10 | 11 | import json |
11 | | -import sys |
12 | 12 | from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, TypeVar, Union, cast, overload |
13 | 13 | import urllib.parse |
14 | 14 |
|
| 15 | +from azure.core import PipelineClient |
15 | 16 | from azure.core.exceptions import ( |
16 | 17 | ClientAuthenticationError, |
17 | 18 | HttpResponseError, |
|
31 | 32 | from azure.core.utils import case_insensitive_dict |
32 | 33 |
|
33 | 34 | 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] |
43 | 44 | T = TypeVar("T") |
44 | 45 | ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] |
45 | 46 |
|
@@ -745,7 +746,9 @@ def build_document_intelligence_administration_delete_classifier_request( # pyl |
745 | 746 | return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) |
746 | 747 |
|
747 | 748 |
|
748 | | -class DocumentIntelligenceClientOperationsMixin(DocumentIntelligenceClientMixinABC): # pylint: disable=name-too-long |
| 749 | +class DocumentIntelligenceClientOperationsMixin( # pylint: disable=name-too-long |
| 750 | + ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], DocumentIntelligenceClientConfiguration] |
| 751 | +): |
749 | 752 |
|
750 | 753 | def _analyze_document_initial( |
751 | 754 | self, |
@@ -1069,7 +1072,7 @@ def get_long_running_output(pipeline_response): |
1069 | 1072 | "str", response.headers.get("Operation-Location") |
1070 | 1073 | ) |
1071 | 1074 |
|
1072 | | - deserialized = _deserialize(_models.AnalyzeResult, response.json().get("analyzeResult")) |
| 1075 | + deserialized = _deserialize(_models.AnalyzeResult, response.json().get("analyzeResult", {})) |
1073 | 1076 | if cls: |
1074 | 1077 | return cls(pipeline_response, deserialized, response_headers) # type: ignore |
1075 | 1078 | return deserialized |
@@ -1607,7 +1610,7 @@ def get_long_running_output(pipeline_response): |
1607 | 1610 | "str", response.headers.get("Operation-Location") |
1608 | 1611 | ) |
1609 | 1612 |
|
1610 | | - deserialized = _deserialize(_models.AnalyzeBatchResult, response.json().get("result")) |
| 1613 | + deserialized = _deserialize(_models.AnalyzeBatchResult, response.json().get("result", {})) |
1611 | 1614 | if cls: |
1612 | 1615 | return cls(pipeline_response, deserialized, response_headers) # type: ignore |
1613 | 1616 | return deserialized |
@@ -1699,7 +1702,7 @@ def prepare_request(next_link=None): |
1699 | 1702 |
|
1700 | 1703 | def extract_data(pipeline_response): |
1701 | 1704 | 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", [])) |
1703 | 1706 | if cls: |
1704 | 1707 | list_of_elem = cls(list_of_elem) # type: ignore |
1705 | 1708 | return deserialized.get("nextLink") or None, iter(list_of_elem) |
@@ -2082,7 +2085,7 @@ def get_long_running_output(pipeline_response): |
2082 | 2085 | "str", response.headers.get("Operation-Location") |
2083 | 2086 | ) |
2084 | 2087 |
|
2085 | | - deserialized = _deserialize(_models.AnalyzeResult, response.json().get("analyzeResult")) |
| 2088 | + deserialized = _deserialize(_models.AnalyzeResult, response.json().get("analyzeResult", {})) |
2086 | 2089 | if cls: |
2087 | 2090 | return cls(pipeline_response, deserialized, response_headers) # type: ignore |
2088 | 2091 | return deserialized |
@@ -2112,7 +2115,7 @@ def get_long_running_output(pipeline_response): |
2112 | 2115 |
|
2113 | 2116 |
|
2114 | 2117 | class DocumentIntelligenceAdministrationClientOperationsMixin( # pylint: disable=too-many-public-methods,name-too-long |
2115 | | - DocumentIntelligenceAdministrationClientMixinABC |
| 2118 | + ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], DocumentIntelligenceAdministrationClientConfiguration] |
2116 | 2119 | ): |
2117 | 2120 |
|
2118 | 2121 | def _build_document_model_initial( |
@@ -2271,7 +2274,7 @@ def get_long_running_output(pipeline_response): |
2271 | 2274 | "str", response.headers.get("Operation-Location") |
2272 | 2275 | ) |
2273 | 2276 |
|
2274 | | - deserialized = _deserialize(_models.DocumentModelDetails, response.json().get("result")) |
| 2277 | + deserialized = _deserialize(_models.DocumentModelDetails, response.json().get("result", {})) |
2275 | 2278 | if cls: |
2276 | 2279 | return cls(pipeline_response, deserialized, response_headers) # type: ignore |
2277 | 2280 | return deserialized |
@@ -2455,7 +2458,7 @@ def get_long_running_output(pipeline_response): |
2455 | 2458 | "str", response.headers.get("Operation-Location") |
2456 | 2459 | ) |
2457 | 2460 |
|
2458 | | - deserialized = _deserialize(_models.DocumentModelDetails, response.json().get("result")) |
| 2461 | + deserialized = _deserialize(_models.DocumentModelDetails, response.json().get("result", {})) |
2459 | 2462 | if cls: |
2460 | 2463 | return cls(pipeline_response, deserialized, response_headers) # type: ignore |
2461 | 2464 | return deserialized |
@@ -2783,7 +2786,7 @@ def get_long_running_output(pipeline_response): |
2783 | 2786 | "str", response.headers.get("Operation-Location") |
2784 | 2787 | ) |
2785 | 2788 |
|
2786 | | - deserialized = _deserialize(_models.DocumentModelDetails, response.json().get("result")) |
| 2789 | + deserialized = _deserialize(_models.DocumentModelDetails, response.json().get("result", {})) |
2787 | 2790 | if cls: |
2788 | 2791 | return cls(pipeline_response, deserialized, response_headers) # type: ignore |
2789 | 2792 | return deserialized |
@@ -2938,7 +2941,7 @@ def prepare_request(next_link=None): |
2938 | 2941 |
|
2939 | 2942 | def extract_data(pipeline_response): |
2940 | 2943 | 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", [])) |
2942 | 2945 | if cls: |
2943 | 2946 | list_of_elem = cls(list_of_elem) # type: ignore |
2944 | 2947 | return deserialized.get("nextLink") or None, iter(list_of_elem) |
@@ -3202,7 +3205,9 @@ def prepare_request(next_link=None): |
3202 | 3205 |
|
3203 | 3206 | def extract_data(pipeline_response): |
3204 | 3207 | 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 | + ) |
3206 | 3211 | if cls: |
3207 | 3212 | list_of_elem = cls(list_of_elem) # type: ignore |
3208 | 3213 | return deserialized.get("nextLink") or None, iter(list_of_elem) |
@@ -3381,7 +3386,7 @@ def get_long_running_output(pipeline_response): |
3381 | 3386 | "str", response.headers.get("Operation-Location") |
3382 | 3387 | ) |
3383 | 3388 |
|
3384 | | - deserialized = _deserialize(_models.DocumentClassifierDetails, response.json().get("result")) |
| 3389 | + deserialized = _deserialize(_models.DocumentClassifierDetails, response.json().get("result", {})) |
3385 | 3390 | if cls: |
3386 | 3391 | return cls(pipeline_response, deserialized, response_headers) # type: ignore |
3387 | 3392 | return deserialized |
@@ -3715,7 +3720,7 @@ def get_long_running_output(pipeline_response): |
3715 | 3720 | "str", response.headers.get("Operation-Location") |
3716 | 3721 | ) |
3717 | 3722 |
|
3718 | | - deserialized = _deserialize(_models.DocumentClassifierDetails, response.json().get("result")) |
| 3723 | + deserialized = _deserialize(_models.DocumentClassifierDetails, response.json().get("result", {})) |
3719 | 3724 | if cls: |
3720 | 3725 | return cls(pipeline_response, deserialized, response_headers) # type: ignore |
3721 | 3726 | return deserialized |
@@ -3871,7 +3876,7 @@ def prepare_request(next_link=None): |
3871 | 3876 |
|
3872 | 3877 | def extract_data(pipeline_response): |
3873 | 3878 | 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", [])) |
3875 | 3880 | if cls: |
3876 | 3881 | list_of_elem = cls(list_of_elem) # type: ignore |
3877 | 3882 | return deserialized.get("nextLink") or None, iter(list_of_elem) |
|
0 commit comments