azure-ai-textanalytics 5.3.0b2__py3-none-any.whl → 6.0.0b1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of azure-ai-textanalytics might be problematic. Click here for more details.
- azure/ai/textanalytics/__init__.py +26 -193
- azure/ai/textanalytics/_client.py +111 -0
- azure/ai/textanalytics/_configuration.py +73 -0
- azure/ai/textanalytics/{_generated/v2022_05_01/operations → _operations}/__init__.py +13 -8
- azure/ai/textanalytics/_operations/_operations.py +716 -0
- azure/ai/textanalytics/{_generated/v2022_05_01/models → _operations}/_patch.py +8 -6
- azure/ai/textanalytics/_patch.py +350 -0
- azure/ai/textanalytics/{_generated/aio → _utils}/__init__.py +1 -5
- azure/ai/textanalytics/_utils/model_base.py +1237 -0
- azure/ai/textanalytics/{_generated/_serialization.py → _utils/serialization.py} +640 -616
- azure/ai/textanalytics/{_generated/v2022_05_01/aio/_vendor.py → _utils/utils.py} +10 -12
- azure/ai/textanalytics/_version.py +8 -7
- azure/ai/textanalytics/aio/__init__.py +25 -14
- azure/ai/textanalytics/aio/_client.py +115 -0
- azure/ai/textanalytics/aio/_configuration.py +75 -0
- azure/ai/textanalytics/{_generated/v2022_10_01_preview/aio/operations → aio/_operations}/__init__.py +13 -8
- azure/ai/textanalytics/aio/_operations/_operations.py +623 -0
- azure/ai/textanalytics/{_generated/v2022_05_01 → aio/_operations}/_patch.py +8 -6
- azure/ai/textanalytics/aio/_patch.py +344 -0
- azure/ai/textanalytics/models/__init__.py +402 -0
- azure/ai/textanalytics/models/_enums.py +1979 -0
- azure/ai/textanalytics/models/_models.py +6641 -0
- azure/ai/textanalytics/{_generated/v2022_05_01/aio → models}/_patch.py +8 -6
- azure/ai/textanalytics/py.typed +1 -0
- {azure_ai_textanalytics-5.3.0b2.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info}/METADATA +668 -403
- azure_ai_textanalytics-6.0.0b1.dist-info/RECORD +29 -0
- {azure_ai_textanalytics-5.3.0b2.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info}/WHEEL +1 -1
- azure/ai/textanalytics/_base_client.py +0 -113
- azure/ai/textanalytics/_check.py +0 -22
- azure/ai/textanalytics/_dict_mixin.py +0 -57
- azure/ai/textanalytics/_generated/__init__.py +0 -16
- azure/ai/textanalytics/_generated/_configuration.py +0 -70
- azure/ai/textanalytics/_generated/_operations_mixin.py +0 -795
- azure/ai/textanalytics/_generated/_text_analytics_client.py +0 -126
- azure/ai/textanalytics/_generated/_version.py +0 -8
- azure/ai/textanalytics/_generated/aio/_configuration.py +0 -66
- azure/ai/textanalytics/_generated/aio/_operations_mixin.py +0 -776
- azure/ai/textanalytics/_generated/aio/_text_analytics_client.py +0 -124
- azure/ai/textanalytics/_generated/models.py +0 -8
- azure/ai/textanalytics/_generated/v2022_05_01/__init__.py +0 -20
- azure/ai/textanalytics/_generated/v2022_05_01/_configuration.py +0 -72
- azure/ai/textanalytics/_generated/v2022_05_01/_text_analytics_client.py +0 -100
- azure/ai/textanalytics/_generated/v2022_05_01/_vendor.py +0 -45
- azure/ai/textanalytics/_generated/v2022_05_01/aio/__init__.py +0 -20
- azure/ai/textanalytics/_generated/v2022_05_01/aio/_configuration.py +0 -71
- azure/ai/textanalytics/_generated/v2022_05_01/aio/_text_analytics_client.py +0 -97
- azure/ai/textanalytics/_generated/v2022_05_01/aio/operations/__init__.py +0 -18
- azure/ai/textanalytics/_generated/v2022_05_01/aio/operations/_patch.py +0 -121
- azure/ai/textanalytics/_generated/v2022_05_01/aio/operations/_text_analytics_client_operations.py +0 -603
- azure/ai/textanalytics/_generated/v2022_05_01/models/__init__.py +0 -281
- azure/ai/textanalytics/_generated/v2022_05_01/models/_models_py3.py +0 -5722
- azure/ai/textanalytics/_generated/v2022_05_01/models/_text_analytics_client_enums.py +0 -439
- azure/ai/textanalytics/_generated/v2022_05_01/operations/_patch.py +0 -120
- azure/ai/textanalytics/_generated/v2022_05_01/operations/_text_analytics_client_operations.py +0 -744
- azure/ai/textanalytics/_generated/v2022_10_01_preview/__init__.py +0 -20
- azure/ai/textanalytics/_generated/v2022_10_01_preview/_configuration.py +0 -72
- azure/ai/textanalytics/_generated/v2022_10_01_preview/_patch.py +0 -19
- azure/ai/textanalytics/_generated/v2022_10_01_preview/_text_analytics_client.py +0 -100
- azure/ai/textanalytics/_generated/v2022_10_01_preview/_vendor.py +0 -45
- azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/__init__.py +0 -20
- azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/_configuration.py +0 -71
- azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/_patch.py +0 -19
- azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/_text_analytics_client.py +0 -97
- azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/_vendor.py +0 -27
- azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/operations/_patch.py +0 -121
- azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/operations/_text_analytics_client_operations.py +0 -603
- azure/ai/textanalytics/_generated/v2022_10_01_preview/models/__init__.py +0 -405
- azure/ai/textanalytics/_generated/v2022_10_01_preview/models/_models_py3.py +0 -8420
- azure/ai/textanalytics/_generated/v2022_10_01_preview/models/_patch.py +0 -486
- azure/ai/textanalytics/_generated/v2022_10_01_preview/models/_text_analytics_client_enums.py +0 -729
- azure/ai/textanalytics/_generated/v2022_10_01_preview/operations/__init__.py +0 -18
- azure/ai/textanalytics/_generated/v2022_10_01_preview/operations/_patch.py +0 -120
- azure/ai/textanalytics/_generated/v2022_10_01_preview/operations/_text_analytics_client_operations.py +0 -744
- azure/ai/textanalytics/_generated/v3_0/__init__.py +0 -20
- azure/ai/textanalytics/_generated/v3_0/_configuration.py +0 -66
- azure/ai/textanalytics/_generated/v3_0/_patch.py +0 -31
- azure/ai/textanalytics/_generated/v3_0/_text_analytics_client.py +0 -96
- azure/ai/textanalytics/_generated/v3_0/_vendor.py +0 -33
- azure/ai/textanalytics/_generated/v3_0/aio/__init__.py +0 -20
- azure/ai/textanalytics/_generated/v3_0/aio/_configuration.py +0 -65
- azure/ai/textanalytics/_generated/v3_0/aio/_patch.py +0 -31
- azure/ai/textanalytics/_generated/v3_0/aio/_text_analytics_client.py +0 -93
- azure/ai/textanalytics/_generated/v3_0/aio/_vendor.py +0 -27
- azure/ai/textanalytics/_generated/v3_0/aio/operations/__init__.py +0 -18
- azure/ai/textanalytics/_generated/v3_0/aio/operations/_patch.py +0 -19
- azure/ai/textanalytics/_generated/v3_0/aio/operations/_text_analytics_client_operations.py +0 -428
- azure/ai/textanalytics/_generated/v3_0/models/__init__.py +0 -81
- azure/ai/textanalytics/_generated/v3_0/models/_models_py3.py +0 -1467
- azure/ai/textanalytics/_generated/v3_0/models/_patch.py +0 -19
- azure/ai/textanalytics/_generated/v3_0/models/_text_analytics_client_enums.py +0 -58
- azure/ai/textanalytics/_generated/v3_0/operations/__init__.py +0 -18
- azure/ai/textanalytics/_generated/v3_0/operations/_patch.py +0 -19
- azure/ai/textanalytics/_generated/v3_0/operations/_text_analytics_client_operations.py +0 -604
- azure/ai/textanalytics/_generated/v3_1/__init__.py +0 -20
- azure/ai/textanalytics/_generated/v3_1/_configuration.py +0 -66
- azure/ai/textanalytics/_generated/v3_1/_patch.py +0 -31
- azure/ai/textanalytics/_generated/v3_1/_text_analytics_client.py +0 -98
- azure/ai/textanalytics/_generated/v3_1/_vendor.py +0 -45
- azure/ai/textanalytics/_generated/v3_1/aio/__init__.py +0 -20
- azure/ai/textanalytics/_generated/v3_1/aio/_configuration.py +0 -65
- azure/ai/textanalytics/_generated/v3_1/aio/_patch.py +0 -31
- azure/ai/textanalytics/_generated/v3_1/aio/_text_analytics_client.py +0 -95
- azure/ai/textanalytics/_generated/v3_1/aio/_vendor.py +0 -27
- azure/ai/textanalytics/_generated/v3_1/aio/operations/__init__.py +0 -18
- azure/ai/textanalytics/_generated/v3_1/aio/operations/_patch.py +0 -19
- azure/ai/textanalytics/_generated/v3_1/aio/operations/_text_analytics_client_operations.py +0 -1291
- azure/ai/textanalytics/_generated/v3_1/models/__init__.py +0 -205
- azure/ai/textanalytics/_generated/v3_1/models/_models_py3.py +0 -3976
- azure/ai/textanalytics/_generated/v3_1/models/_patch.py +0 -19
- azure/ai/textanalytics/_generated/v3_1/models/_text_analytics_client_enums.py +0 -367
- azure/ai/textanalytics/_generated/v3_1/operations/__init__.py +0 -18
- azure/ai/textanalytics/_generated/v3_1/operations/_patch.py +0 -19
- azure/ai/textanalytics/_generated/v3_1/operations/_text_analytics_client_operations.py +0 -1709
- azure/ai/textanalytics/_lro.py +0 -553
- azure/ai/textanalytics/_models.py +0 -3158
- azure/ai/textanalytics/_policies.py +0 -66
- azure/ai/textanalytics/_request_handlers.py +0 -104
- azure/ai/textanalytics/_response_handlers.py +0 -583
- azure/ai/textanalytics/_text_analytics_client.py +0 -2081
- azure/ai/textanalytics/_user_agent.py +0 -8
- azure/ai/textanalytics/_validate.py +0 -113
- azure/ai/textanalytics/aio/_base_client_async.py +0 -98
- azure/ai/textanalytics/aio/_lro_async.py +0 -503
- azure/ai/textanalytics/aio/_response_handlers_async.py +0 -94
- azure/ai/textanalytics/aio/_text_analytics_client_async.py +0 -2077
- azure_ai_textanalytics-5.3.0b2.dist-info/RECORD +0 -115
- {azure_ai_textanalytics-5.3.0b2.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info/licenses}/LICENSE +0 -0
- {azure_ai_textanalytics-5.3.0b2.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info}/top_level.txt +0 -0
azure/ai/textanalytics/_generated/v2022_05_01/operations/_text_analytics_client_operations.py
DELETED
|
@@ -1,744 +0,0 @@
|
|
|
1
|
-
# pylint: disable=too-many-lines
|
|
2
|
-
# coding=utf-8
|
|
3
|
-
# --------------------------------------------------------------------------
|
|
4
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
-
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
6
|
-
# Code generated by Microsoft (R) AutoRest Code Generator.
|
|
7
|
-
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
8
|
-
# --------------------------------------------------------------------------
|
|
9
|
-
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
|
|
10
|
-
|
|
11
|
-
from ...._lro import AnalyzeActionsLROPoller, AnalyzeActionsLROPollingMethod
|
|
12
|
-
from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
|
|
13
|
-
from azure.core.pipeline import PipelineResponse
|
|
14
|
-
from azure.core.pipeline.transport import HttpResponse
|
|
15
|
-
from azure.core.polling import LROPoller, NoPolling, PollingMethod
|
|
16
|
-
from azure.core.polling.base_polling import LROBasePolling
|
|
17
|
-
from azure.core.rest import HttpRequest
|
|
18
|
-
from azure.core.tracing.decorator import distributed_trace
|
|
19
|
-
from azure.core.utils import case_insensitive_dict
|
|
20
|
-
|
|
21
|
-
from .. import models as _models
|
|
22
|
-
from ..._serialization import Serializer
|
|
23
|
-
from .._vendor import MixinABC, _convert_request, _format_url_section
|
|
24
|
-
T = TypeVar('T')
|
|
25
|
-
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]
|
|
26
|
-
|
|
27
|
-
_SERIALIZER = Serializer()
|
|
28
|
-
_SERIALIZER.client_side_validation = False
|
|
29
|
-
|
|
30
|
-
def build_analyze_text_request(
|
|
31
|
-
*,
|
|
32
|
-
show_stats: Optional[bool] = None,
|
|
33
|
-
**kwargs: Any
|
|
34
|
-
) -> HttpRequest:
|
|
35
|
-
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
36
|
-
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
37
|
-
|
|
38
|
-
api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str
|
|
39
|
-
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str]
|
|
40
|
-
accept = _headers.pop('Accept', "application/json")
|
|
41
|
-
|
|
42
|
-
# Construct URL
|
|
43
|
-
_url = kwargs.pop("template_url", "/:analyze-text")
|
|
44
|
-
|
|
45
|
-
# Construct parameters
|
|
46
|
-
_params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
|
47
|
-
if show_stats is not None:
|
|
48
|
-
_params['showStats'] = _SERIALIZER.query("show_stats", show_stats, 'bool')
|
|
49
|
-
|
|
50
|
-
# Construct headers
|
|
51
|
-
if content_type is not None:
|
|
52
|
-
_headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str')
|
|
53
|
-
_headers['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
|
54
|
-
|
|
55
|
-
return HttpRequest(
|
|
56
|
-
method="POST",
|
|
57
|
-
url=_url,
|
|
58
|
-
params=_params,
|
|
59
|
-
headers=_headers,
|
|
60
|
-
**kwargs
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
def build_analyze_text_submit_job_request(
|
|
65
|
-
**kwargs: Any
|
|
66
|
-
) -> HttpRequest:
|
|
67
|
-
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
68
|
-
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
69
|
-
|
|
70
|
-
api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str
|
|
71
|
-
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str]
|
|
72
|
-
accept = _headers.pop('Accept', "application/json")
|
|
73
|
-
|
|
74
|
-
# Construct URL
|
|
75
|
-
_url = kwargs.pop("template_url", "/analyze-text/jobs")
|
|
76
|
-
|
|
77
|
-
# Construct parameters
|
|
78
|
-
_params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
|
79
|
-
|
|
80
|
-
# Construct headers
|
|
81
|
-
if content_type is not None:
|
|
82
|
-
_headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str')
|
|
83
|
-
_headers['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
|
84
|
-
|
|
85
|
-
return HttpRequest(
|
|
86
|
-
method="POST",
|
|
87
|
-
url=_url,
|
|
88
|
-
params=_params,
|
|
89
|
-
headers=_headers,
|
|
90
|
-
**kwargs
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
def build_analyze_text_job_status_request(
|
|
95
|
-
job_id: str,
|
|
96
|
-
*,
|
|
97
|
-
show_stats: Optional[bool] = None,
|
|
98
|
-
top: Optional[int] = None,
|
|
99
|
-
skip: Optional[int] = None,
|
|
100
|
-
**kwargs: Any
|
|
101
|
-
) -> HttpRequest:
|
|
102
|
-
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
103
|
-
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
104
|
-
|
|
105
|
-
api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str
|
|
106
|
-
accept = _headers.pop('Accept', "application/json")
|
|
107
|
-
|
|
108
|
-
# Construct URL
|
|
109
|
-
_url = kwargs.pop("template_url", "/analyze-text/jobs/{jobId}")
|
|
110
|
-
path_format_arguments = {
|
|
111
|
-
"jobId": _SERIALIZER.url("job_id", job_id, 'str'),
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
_url = _format_url_section(_url, **path_format_arguments)
|
|
115
|
-
|
|
116
|
-
# Construct parameters
|
|
117
|
-
_params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
|
118
|
-
if show_stats is not None:
|
|
119
|
-
_params['showStats'] = _SERIALIZER.query("show_stats", show_stats, 'bool')
|
|
120
|
-
if top is not None:
|
|
121
|
-
_params['top'] = _SERIALIZER.query("top", top, 'int')
|
|
122
|
-
if skip is not None:
|
|
123
|
-
_params['skip'] = _SERIALIZER.query("skip", skip, 'int')
|
|
124
|
-
|
|
125
|
-
# Construct headers
|
|
126
|
-
_headers['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
|
127
|
-
|
|
128
|
-
return HttpRequest(
|
|
129
|
-
method="GET",
|
|
130
|
-
url=_url,
|
|
131
|
-
params=_params,
|
|
132
|
-
headers=_headers,
|
|
133
|
-
**kwargs
|
|
134
|
-
)
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
def build_analyze_text_cancel_job_request(
|
|
138
|
-
job_id: str,
|
|
139
|
-
**kwargs: Any
|
|
140
|
-
) -> HttpRequest:
|
|
141
|
-
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
142
|
-
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
143
|
-
|
|
144
|
-
api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str
|
|
145
|
-
accept = _headers.pop('Accept', "application/json")
|
|
146
|
-
|
|
147
|
-
# Construct URL
|
|
148
|
-
_url = kwargs.pop("template_url", "/analyze-text/jobs/{jobId}:cancel")
|
|
149
|
-
path_format_arguments = {
|
|
150
|
-
"jobId": _SERIALIZER.url("job_id", job_id, 'str'),
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
_url = _format_url_section(_url, **path_format_arguments)
|
|
154
|
-
|
|
155
|
-
# Construct parameters
|
|
156
|
-
_params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str')
|
|
157
|
-
|
|
158
|
-
# Construct headers
|
|
159
|
-
_headers['Accept'] = _SERIALIZER.header("accept", accept, 'str')
|
|
160
|
-
|
|
161
|
-
return HttpRequest(
|
|
162
|
-
method="POST",
|
|
163
|
-
url=_url,
|
|
164
|
-
params=_params,
|
|
165
|
-
headers=_headers,
|
|
166
|
-
**kwargs
|
|
167
|
-
)
|
|
168
|
-
|
|
169
|
-
class TextAnalyticsClientOperationsMixin(MixinABC):
|
|
170
|
-
|
|
171
|
-
@overload
|
|
172
|
-
def analyze_text(
|
|
173
|
-
self,
|
|
174
|
-
body: _models.AnalyzeTextTask,
|
|
175
|
-
show_stats: Optional[bool] = None,
|
|
176
|
-
*,
|
|
177
|
-
content_type: str = "application/json",
|
|
178
|
-
**kwargs: Any
|
|
179
|
-
) -> _models.AnalyzeTextTaskResult:
|
|
180
|
-
"""Request text analysis over a collection of documents.
|
|
181
|
-
|
|
182
|
-
Submit a collection of text documents for analysis. Specify a single unique task to be
|
|
183
|
-
executed immediately.
|
|
184
|
-
|
|
185
|
-
:param body: Collection of documents to analyze and a single task to execute. Required.
|
|
186
|
-
:type body: ~azure.ai.textanalytics.v2022_05_01.models.AnalyzeTextTask
|
|
187
|
-
:param show_stats: (Optional) if set to true, response will contain request and document level
|
|
188
|
-
statistics. Default value is None.
|
|
189
|
-
:type show_stats: bool
|
|
190
|
-
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
191
|
-
Default value is "application/json".
|
|
192
|
-
:paramtype content_type: str
|
|
193
|
-
:keyword callable cls: A custom type or function that will be passed the direct response
|
|
194
|
-
:return: AnalyzeTextTaskResult or the result of cls(response)
|
|
195
|
-
:rtype: ~azure.ai.textanalytics.v2022_05_01.models.AnalyzeTextTaskResult
|
|
196
|
-
:raises ~azure.core.exceptions.HttpResponseError:
|
|
197
|
-
"""
|
|
198
|
-
|
|
199
|
-
@overload
|
|
200
|
-
def analyze_text(
|
|
201
|
-
self,
|
|
202
|
-
body: IO,
|
|
203
|
-
show_stats: Optional[bool] = None,
|
|
204
|
-
*,
|
|
205
|
-
content_type: str = "application/json",
|
|
206
|
-
**kwargs: Any
|
|
207
|
-
) -> _models.AnalyzeTextTaskResult:
|
|
208
|
-
"""Request text analysis over a collection of documents.
|
|
209
|
-
|
|
210
|
-
Submit a collection of text documents for analysis. Specify a single unique task to be
|
|
211
|
-
executed immediately.
|
|
212
|
-
|
|
213
|
-
:param body: Collection of documents to analyze and a single task to execute. Required.
|
|
214
|
-
:type body: IO
|
|
215
|
-
:param show_stats: (Optional) if set to true, response will contain request and document level
|
|
216
|
-
statistics. Default value is None.
|
|
217
|
-
:type show_stats: bool
|
|
218
|
-
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
219
|
-
Default value is "application/json".
|
|
220
|
-
:paramtype content_type: str
|
|
221
|
-
:keyword callable cls: A custom type or function that will be passed the direct response
|
|
222
|
-
:return: AnalyzeTextTaskResult or the result of cls(response)
|
|
223
|
-
:rtype: ~azure.ai.textanalytics.v2022_05_01.models.AnalyzeTextTaskResult
|
|
224
|
-
:raises ~azure.core.exceptions.HttpResponseError:
|
|
225
|
-
"""
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
@distributed_trace
|
|
229
|
-
def analyze_text(
|
|
230
|
-
self,
|
|
231
|
-
body: Union[_models.AnalyzeTextTask, IO],
|
|
232
|
-
show_stats: Optional[bool] = None,
|
|
233
|
-
**kwargs: Any
|
|
234
|
-
) -> _models.AnalyzeTextTaskResult:
|
|
235
|
-
"""Request text analysis over a collection of documents.
|
|
236
|
-
|
|
237
|
-
Submit a collection of text documents for analysis. Specify a single unique task to be
|
|
238
|
-
executed immediately.
|
|
239
|
-
|
|
240
|
-
:param body: Collection of documents to analyze and a single task to execute. Is either a model
|
|
241
|
-
type or a IO type. Required.
|
|
242
|
-
:type body: ~azure.ai.textanalytics.v2022_05_01.models.AnalyzeTextTask or IO
|
|
243
|
-
:param show_stats: (Optional) if set to true, response will contain request and document level
|
|
244
|
-
statistics. Default value is None.
|
|
245
|
-
:type show_stats: bool
|
|
246
|
-
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
|
247
|
-
Default value is None.
|
|
248
|
-
:paramtype content_type: str
|
|
249
|
-
:keyword callable cls: A custom type or function that will be passed the direct response
|
|
250
|
-
:return: AnalyzeTextTaskResult or the result of cls(response)
|
|
251
|
-
:rtype: ~azure.ai.textanalytics.v2022_05_01.models.AnalyzeTextTaskResult
|
|
252
|
-
:raises ~azure.core.exceptions.HttpResponseError:
|
|
253
|
-
"""
|
|
254
|
-
error_map = {
|
|
255
|
-
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
|
256
|
-
}
|
|
257
|
-
error_map.update(kwargs.pop('error_map', {}) or {})
|
|
258
|
-
|
|
259
|
-
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
260
|
-
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
261
|
-
|
|
262
|
-
api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str
|
|
263
|
-
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str]
|
|
264
|
-
cls = kwargs.pop('cls', None) # type: ClsType[_models.AnalyzeTextTaskResult]
|
|
265
|
-
|
|
266
|
-
content_type = content_type or "application/json"
|
|
267
|
-
_json = None
|
|
268
|
-
_content = None
|
|
269
|
-
if isinstance(body, (IO, bytes)):
|
|
270
|
-
_content = body
|
|
271
|
-
else:
|
|
272
|
-
_json = self._serialize.body(body, 'AnalyzeTextTask')
|
|
273
|
-
|
|
274
|
-
request = build_analyze_text_request(
|
|
275
|
-
show_stats=show_stats,
|
|
276
|
-
api_version=api_version,
|
|
277
|
-
content_type=content_type,
|
|
278
|
-
json=_json,
|
|
279
|
-
content=_content,
|
|
280
|
-
template_url=self.analyze_text.metadata['url'],
|
|
281
|
-
headers=_headers,
|
|
282
|
-
params=_params,
|
|
283
|
-
)
|
|
284
|
-
request = _convert_request(request)
|
|
285
|
-
path_format_arguments = {
|
|
286
|
-
"Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
|
|
287
|
-
}
|
|
288
|
-
request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore
|
|
289
|
-
|
|
290
|
-
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
|
|
291
|
-
request,
|
|
292
|
-
stream=False,
|
|
293
|
-
**kwargs
|
|
294
|
-
)
|
|
295
|
-
|
|
296
|
-
response = pipeline_response.http_response
|
|
297
|
-
|
|
298
|
-
if response.status_code not in [200]:
|
|
299
|
-
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
300
|
-
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
|
301
|
-
raise HttpResponseError(response=response, model=error)
|
|
302
|
-
|
|
303
|
-
deserialized = self._deserialize('AnalyzeTextTaskResult', pipeline_response)
|
|
304
|
-
|
|
305
|
-
if cls:
|
|
306
|
-
return cls(pipeline_response, deserialized, {})
|
|
307
|
-
|
|
308
|
-
return deserialized
|
|
309
|
-
|
|
310
|
-
analyze_text.metadata = {'url': "/:analyze-text"} # type: ignore
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
def _analyze_text_submit_job_initial(
|
|
314
|
-
self,
|
|
315
|
-
body: Union[_models.AnalyzeTextJobsInput, IO],
|
|
316
|
-
**kwargs: Any
|
|
317
|
-
) -> Optional[_models.AnalyzeTextJobState]:
|
|
318
|
-
error_map = {
|
|
319
|
-
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
|
320
|
-
}
|
|
321
|
-
error_map.update(kwargs.pop('error_map', {}) or {})
|
|
322
|
-
|
|
323
|
-
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
324
|
-
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
325
|
-
|
|
326
|
-
api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str
|
|
327
|
-
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str]
|
|
328
|
-
cls = kwargs.pop('cls', None) # type: ClsType[Optional[_models.AnalyzeTextJobState]]
|
|
329
|
-
|
|
330
|
-
content_type = content_type or "application/json"
|
|
331
|
-
_json = None
|
|
332
|
-
_content = None
|
|
333
|
-
if isinstance(body, (IO, bytes)):
|
|
334
|
-
_content = body
|
|
335
|
-
else:
|
|
336
|
-
_json = self._serialize.body(body, 'AnalyzeTextJobsInput')
|
|
337
|
-
|
|
338
|
-
request = build_analyze_text_submit_job_request(
|
|
339
|
-
api_version=api_version,
|
|
340
|
-
content_type=content_type,
|
|
341
|
-
json=_json,
|
|
342
|
-
content=_content,
|
|
343
|
-
template_url=self._analyze_text_submit_job_initial.metadata['url'],
|
|
344
|
-
headers=_headers,
|
|
345
|
-
params=_params,
|
|
346
|
-
)
|
|
347
|
-
request = _convert_request(request)
|
|
348
|
-
path_format_arguments = {
|
|
349
|
-
"Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
|
|
350
|
-
}
|
|
351
|
-
request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore
|
|
352
|
-
|
|
353
|
-
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
|
|
354
|
-
request,
|
|
355
|
-
stream=False,
|
|
356
|
-
**kwargs
|
|
357
|
-
)
|
|
358
|
-
|
|
359
|
-
response = pipeline_response.http_response
|
|
360
|
-
|
|
361
|
-
if response.status_code not in [200, 202]:
|
|
362
|
-
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
363
|
-
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
|
364
|
-
raise HttpResponseError(response=response, model=error)
|
|
365
|
-
|
|
366
|
-
deserialized = None
|
|
367
|
-
response_headers = {}
|
|
368
|
-
if response.status_code == 200:
|
|
369
|
-
deserialized = self._deserialize('AnalyzeTextJobState', pipeline_response)
|
|
370
|
-
|
|
371
|
-
if response.status_code == 202:
|
|
372
|
-
response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location'))
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
if cls:
|
|
376
|
-
return cls(pipeline_response, deserialized, response_headers)
|
|
377
|
-
|
|
378
|
-
return deserialized
|
|
379
|
-
|
|
380
|
-
_analyze_text_submit_job_initial.metadata = {'url': "/analyze-text/jobs"} # type: ignore
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
@overload
|
|
384
|
-
def begin_analyze_text_submit_job(
|
|
385
|
-
self,
|
|
386
|
-
body: _models.AnalyzeTextJobsInput,
|
|
387
|
-
*,
|
|
388
|
-
content_type: str = "application/json",
|
|
389
|
-
**kwargs: Any
|
|
390
|
-
) -> AnalyzeActionsLROPoller[_models.AnalyzeTextJobState]:
|
|
391
|
-
"""Submit text analysis job.
|
|
392
|
-
|
|
393
|
-
Submit a collection of text documents for analysis. Specify one or more unique tasks to be
|
|
394
|
-
executed as a long-running operation.
|
|
395
|
-
|
|
396
|
-
:param body: Collection of documents to analyze and one or more tasks to execute. Required.
|
|
397
|
-
:type body: ~azure.ai.textanalytics.v2022_05_01.models.AnalyzeTextJobsInput
|
|
398
|
-
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
|
|
399
|
-
Default value is "application/json".
|
|
400
|
-
:paramtype content_type: str
|
|
401
|
-
:keyword callable cls: A custom type or function that will be passed the direct response
|
|
402
|
-
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
|
403
|
-
:keyword polling: By default, your polling method will be AnalyzeActionsLROPollingMethod. Pass
|
|
404
|
-
in False for this operation to not poll, or pass in your own initialized polling object for a
|
|
405
|
-
personal polling strategy.
|
|
406
|
-
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
|
407
|
-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
|
408
|
-
Retry-After header is present.
|
|
409
|
-
:return: An instance of AnalyzeActionsLROPoller that returns either AnalyzeTextJobState or the
|
|
410
|
-
result of cls(response)
|
|
411
|
-
:rtype:
|
|
412
|
-
~...._lro.AnalyzeActionsLROPoller[~azure.ai.textanalytics.v2022_05_01.models.AnalyzeTextJobState]
|
|
413
|
-
:raises ~azure.core.exceptions.HttpResponseError:
|
|
414
|
-
"""
|
|
415
|
-
|
|
416
|
-
@overload
|
|
417
|
-
def begin_analyze_text_submit_job(
|
|
418
|
-
self,
|
|
419
|
-
body: IO,
|
|
420
|
-
*,
|
|
421
|
-
content_type: str = "application/json",
|
|
422
|
-
**kwargs: Any
|
|
423
|
-
) -> AnalyzeActionsLROPoller[_models.AnalyzeTextJobState]:
|
|
424
|
-
"""Submit text analysis job.
|
|
425
|
-
|
|
426
|
-
Submit a collection of text documents for analysis. Specify one or more unique tasks to be
|
|
427
|
-
executed as a long-running operation.
|
|
428
|
-
|
|
429
|
-
:param body: Collection of documents to analyze and one or more tasks to execute. Required.
|
|
430
|
-
:type body: IO
|
|
431
|
-
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
|
|
432
|
-
Default value is "application/json".
|
|
433
|
-
:paramtype content_type: str
|
|
434
|
-
:keyword callable cls: A custom type or function that will be passed the direct response
|
|
435
|
-
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
|
436
|
-
:keyword polling: By default, your polling method will be AnalyzeActionsLROPollingMethod. Pass
|
|
437
|
-
in False for this operation to not poll, or pass in your own initialized polling object for a
|
|
438
|
-
personal polling strategy.
|
|
439
|
-
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
|
440
|
-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
|
441
|
-
Retry-After header is present.
|
|
442
|
-
:return: An instance of AnalyzeActionsLROPoller that returns either AnalyzeTextJobState or the
|
|
443
|
-
result of cls(response)
|
|
444
|
-
:rtype:
|
|
445
|
-
~...._lro.AnalyzeActionsLROPoller[~azure.ai.textanalytics.v2022_05_01.models.AnalyzeTextJobState]
|
|
446
|
-
:raises ~azure.core.exceptions.HttpResponseError:
|
|
447
|
-
"""
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
@distributed_trace
|
|
451
|
-
def begin_analyze_text_submit_job(
|
|
452
|
-
self,
|
|
453
|
-
body: Union[_models.AnalyzeTextJobsInput, IO],
|
|
454
|
-
**kwargs: Any
|
|
455
|
-
) -> AnalyzeActionsLROPoller[_models.AnalyzeTextJobState]:
|
|
456
|
-
"""Submit text analysis job.
|
|
457
|
-
|
|
458
|
-
Submit a collection of text documents for analysis. Specify one or more unique tasks to be
|
|
459
|
-
executed as a long-running operation.
|
|
460
|
-
|
|
461
|
-
:param body: Collection of documents to analyze and one or more tasks to execute. Is either a
|
|
462
|
-
model type or a IO type. Required.
|
|
463
|
-
:type body: ~azure.ai.textanalytics.v2022_05_01.models.AnalyzeTextJobsInput or IO
|
|
464
|
-
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
|
|
465
|
-
Default value is None.
|
|
466
|
-
:paramtype content_type: str
|
|
467
|
-
:keyword callable cls: A custom type or function that will be passed the direct response
|
|
468
|
-
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
|
469
|
-
:keyword polling: By default, your polling method will be AnalyzeActionsLROPollingMethod. Pass
|
|
470
|
-
in False for this operation to not poll, or pass in your own initialized polling object for a
|
|
471
|
-
personal polling strategy.
|
|
472
|
-
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
|
473
|
-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
|
474
|
-
Retry-After header is present.
|
|
475
|
-
:return: An instance of AnalyzeActionsLROPoller that returns either AnalyzeTextJobState or the
|
|
476
|
-
result of cls(response)
|
|
477
|
-
:rtype:
|
|
478
|
-
~...._lro.AnalyzeActionsLROPoller[~azure.ai.textanalytics.v2022_05_01.models.AnalyzeTextJobState]
|
|
479
|
-
:raises ~azure.core.exceptions.HttpResponseError:
|
|
480
|
-
"""
|
|
481
|
-
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
|
|
482
|
-
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
483
|
-
|
|
484
|
-
api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str
|
|
485
|
-
content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str]
|
|
486
|
-
cls = kwargs.pop('cls', None) # type: ClsType[_models.AnalyzeTextJobState]
|
|
487
|
-
polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod]
|
|
488
|
-
lro_delay = kwargs.pop(
|
|
489
|
-
'polling_interval',
|
|
490
|
-
self._config.polling_interval
|
|
491
|
-
)
|
|
492
|
-
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
|
|
493
|
-
if cont_token is None:
|
|
494
|
-
raw_result = self._analyze_text_submit_job_initial( # type: ignore
|
|
495
|
-
body=body,
|
|
496
|
-
api_version=api_version,
|
|
497
|
-
content_type=content_type,
|
|
498
|
-
cls=lambda x,y,z: x,
|
|
499
|
-
headers=_headers,
|
|
500
|
-
params=_params,
|
|
501
|
-
**kwargs
|
|
502
|
-
)
|
|
503
|
-
kwargs.pop('error_map', None)
|
|
504
|
-
|
|
505
|
-
def get_long_running_output(pipeline_response):
|
|
506
|
-
deserialized = self._deserialize('AnalyzeTextJobState', pipeline_response)
|
|
507
|
-
if cls:
|
|
508
|
-
return cls(pipeline_response, deserialized, {})
|
|
509
|
-
return deserialized
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
path_format_arguments = {
|
|
513
|
-
"Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
if polling is True:
|
|
517
|
-
polling_method = cast(PollingMethod, AnalyzeActionsLROPollingMethod(
|
|
518
|
-
lro_delay,
|
|
519
|
-
|
|
520
|
-
path_format_arguments=path_format_arguments,
|
|
521
|
-
**kwargs
|
|
522
|
-
)) # type: PollingMethod
|
|
523
|
-
elif polling is False: polling_method = cast(PollingMethod, NoPolling())
|
|
524
|
-
else: polling_method = polling
|
|
525
|
-
if cont_token:
|
|
526
|
-
return AnalyzeActionsLROPoller.from_continuation_token(
|
|
527
|
-
polling_method=polling_method,
|
|
528
|
-
continuation_token=cont_token,
|
|
529
|
-
client=self._client,
|
|
530
|
-
deserialization_callback=get_long_running_output
|
|
531
|
-
)
|
|
532
|
-
return AnalyzeActionsLROPoller(self._client, raw_result, get_long_running_output, polling_method)
|
|
533
|
-
|
|
534
|
-
begin_analyze_text_submit_job.metadata = {'url': "/analyze-text/jobs"} # type: ignore
|
|
535
|
-
|
|
536
|
-
@distributed_trace
|
|
537
|
-
def analyze_text_job_status(
|
|
538
|
-
self,
|
|
539
|
-
job_id: str,
|
|
540
|
-
show_stats: Optional[bool] = None,
|
|
541
|
-
top: Optional[int] = None,
|
|
542
|
-
skip: Optional[int] = None,
|
|
543
|
-
**kwargs: Any
|
|
544
|
-
) -> _models.AnalyzeTextJobState:
|
|
545
|
-
"""Get analysis status and results.
|
|
546
|
-
|
|
547
|
-
Get the status of an analysis job. A job may consist of one or more tasks. Once all tasks are
|
|
548
|
-
succeeded, the job will transition to the succeeded state and results will be available for
|
|
549
|
-
each task.
|
|
550
|
-
|
|
551
|
-
:param job_id: Job ID. Required.
|
|
552
|
-
:type job_id: str
|
|
553
|
-
:param show_stats: (Optional) if set to true, response will contain request and document level
|
|
554
|
-
statistics. Default value is None.
|
|
555
|
-
:type show_stats: bool
|
|
556
|
-
:param top: The maximum number of resources to return from the collection. Default value is
|
|
557
|
-
None.
|
|
558
|
-
:type top: int
|
|
559
|
-
:param skip: An offset into the collection of the first resource to be returned. Default value
|
|
560
|
-
is None.
|
|
561
|
-
:type skip: int
|
|
562
|
-
:keyword callable cls: A custom type or function that will be passed the direct response
|
|
563
|
-
:return: AnalyzeTextJobState or the result of cls(response)
|
|
564
|
-
:rtype: ~azure.ai.textanalytics.v2022_05_01.models.AnalyzeTextJobState
|
|
565
|
-
:raises ~azure.core.exceptions.HttpResponseError:
|
|
566
|
-
"""
|
|
567
|
-
error_map = {
|
|
568
|
-
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
|
569
|
-
}
|
|
570
|
-
error_map.update(kwargs.pop('error_map', {}) or {})
|
|
571
|
-
|
|
572
|
-
_headers = kwargs.pop("headers", {}) or {}
|
|
573
|
-
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
574
|
-
|
|
575
|
-
api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str
|
|
576
|
-
cls = kwargs.pop('cls', None) # type: ClsType[_models.AnalyzeTextJobState]
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
request = build_analyze_text_job_status_request(
|
|
580
|
-
job_id=job_id,
|
|
581
|
-
show_stats=show_stats,
|
|
582
|
-
top=top,
|
|
583
|
-
skip=skip,
|
|
584
|
-
api_version=api_version,
|
|
585
|
-
template_url=self.analyze_text_job_status.metadata['url'],
|
|
586
|
-
headers=_headers,
|
|
587
|
-
params=_params,
|
|
588
|
-
)
|
|
589
|
-
request = _convert_request(request)
|
|
590
|
-
path_format_arguments = {
|
|
591
|
-
"Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
|
|
592
|
-
}
|
|
593
|
-
request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore
|
|
594
|
-
|
|
595
|
-
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
|
|
596
|
-
request,
|
|
597
|
-
stream=False,
|
|
598
|
-
**kwargs
|
|
599
|
-
)
|
|
600
|
-
|
|
601
|
-
response = pipeline_response.http_response
|
|
602
|
-
|
|
603
|
-
if response.status_code not in [200]:
|
|
604
|
-
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
605
|
-
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
|
606
|
-
raise HttpResponseError(response=response, model=error)
|
|
607
|
-
|
|
608
|
-
deserialized = self._deserialize('AnalyzeTextJobState', pipeline_response)
|
|
609
|
-
|
|
610
|
-
if cls:
|
|
611
|
-
return cls(pipeline_response, deserialized, {})
|
|
612
|
-
|
|
613
|
-
return deserialized
|
|
614
|
-
|
|
615
|
-
analyze_text_job_status.metadata = {'url': "/analyze-text/jobs/{jobId}"} # type: ignore
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
def _analyze_text_cancel_job_initial( # pylint: disable=inconsistent-return-statements
|
|
619
|
-
self,
|
|
620
|
-
job_id: str,
|
|
621
|
-
**kwargs: Any
|
|
622
|
-
) -> None:
|
|
623
|
-
error_map = {
|
|
624
|
-
401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError
|
|
625
|
-
}
|
|
626
|
-
error_map.update(kwargs.pop('error_map', {}) or {})
|
|
627
|
-
|
|
628
|
-
_headers = kwargs.pop("headers", {}) or {}
|
|
629
|
-
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
630
|
-
|
|
631
|
-
api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str
|
|
632
|
-
cls = kwargs.pop('cls', None) # type: ClsType[None]
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
request = build_analyze_text_cancel_job_request(
|
|
636
|
-
job_id=job_id,
|
|
637
|
-
api_version=api_version,
|
|
638
|
-
template_url=self._analyze_text_cancel_job_initial.metadata['url'],
|
|
639
|
-
headers=_headers,
|
|
640
|
-
params=_params,
|
|
641
|
-
)
|
|
642
|
-
request = _convert_request(request)
|
|
643
|
-
path_format_arguments = {
|
|
644
|
-
"Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
|
|
645
|
-
}
|
|
646
|
-
request.url = self._client.format_url(request.url, **path_format_arguments) # type: ignore
|
|
647
|
-
|
|
648
|
-
pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access
|
|
649
|
-
request,
|
|
650
|
-
stream=False,
|
|
651
|
-
**kwargs
|
|
652
|
-
)
|
|
653
|
-
|
|
654
|
-
response = pipeline_response.http_response
|
|
655
|
-
|
|
656
|
-
if response.status_code not in [202]:
|
|
657
|
-
map_error(status_code=response.status_code, response=response, error_map=error_map)
|
|
658
|
-
error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response)
|
|
659
|
-
raise HttpResponseError(response=response, model=error)
|
|
660
|
-
|
|
661
|
-
response_headers = {}
|
|
662
|
-
response_headers['Operation-Location']=self._deserialize('str', response.headers.get('Operation-Location'))
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
if cls:
|
|
666
|
-
return cls(pipeline_response, None, response_headers)
|
|
667
|
-
|
|
668
|
-
_analyze_text_cancel_job_initial.metadata = {'url': "/analyze-text/jobs/{jobId}:cancel"} # type: ignore
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
@distributed_trace
|
|
672
|
-
def begin_analyze_text_cancel_job(
|
|
673
|
-
self,
|
|
674
|
-
job_id: str,
|
|
675
|
-
**kwargs: Any
|
|
676
|
-
) -> LROPoller[None]:
|
|
677
|
-
"""Cancel a long-running Text Analysis job.
|
|
678
|
-
|
|
679
|
-
Cancel a long-running Text Analysis job.
|
|
680
|
-
|
|
681
|
-
:param job_id: Job ID. Required.
|
|
682
|
-
:type job_id: str
|
|
683
|
-
:keyword callable cls: A custom type or function that will be passed the direct response
|
|
684
|
-
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
|
|
685
|
-
:keyword polling: By default, your polling method will be LROBasePolling. Pass in False for
|
|
686
|
-
this operation to not poll, or pass in your own initialized polling object for a personal
|
|
687
|
-
polling strategy.
|
|
688
|
-
:paramtype polling: bool or ~azure.core.polling.PollingMethod
|
|
689
|
-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
|
690
|
-
Retry-After header is present.
|
|
691
|
-
:return: An instance of LROPoller that returns either None or the result of cls(response)
|
|
692
|
-
:rtype: ~azure.core.polling.LROPoller[None]
|
|
693
|
-
:raises ~azure.core.exceptions.HttpResponseError:
|
|
694
|
-
"""
|
|
695
|
-
_headers = kwargs.pop("headers", {}) or {}
|
|
696
|
-
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
|
|
697
|
-
|
|
698
|
-
api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-05-01")) # type: str
|
|
699
|
-
cls = kwargs.pop('cls', None) # type: ClsType[None]
|
|
700
|
-
polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod]
|
|
701
|
-
lro_delay = kwargs.pop(
|
|
702
|
-
'polling_interval',
|
|
703
|
-
self._config.polling_interval
|
|
704
|
-
)
|
|
705
|
-
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
|
|
706
|
-
if cont_token is None:
|
|
707
|
-
raw_result = self._analyze_text_cancel_job_initial( # type: ignore
|
|
708
|
-
job_id=job_id,
|
|
709
|
-
api_version=api_version,
|
|
710
|
-
cls=lambda x,y,z: x,
|
|
711
|
-
headers=_headers,
|
|
712
|
-
params=_params,
|
|
713
|
-
**kwargs
|
|
714
|
-
)
|
|
715
|
-
kwargs.pop('error_map', None)
|
|
716
|
-
|
|
717
|
-
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
|
|
718
|
-
if cls:
|
|
719
|
-
return cls(pipeline_response, None, {})
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
path_format_arguments = {
|
|
723
|
-
"Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
if polling is True:
|
|
727
|
-
polling_method = cast(PollingMethod, LROBasePolling(
|
|
728
|
-
lro_delay,
|
|
729
|
-
|
|
730
|
-
path_format_arguments=path_format_arguments,
|
|
731
|
-
**kwargs
|
|
732
|
-
)) # type: PollingMethod
|
|
733
|
-
elif polling is False: polling_method = cast(PollingMethod, NoPolling())
|
|
734
|
-
else: polling_method = polling
|
|
735
|
-
if cont_token:
|
|
736
|
-
return LROPoller.from_continuation_token(
|
|
737
|
-
polling_method=polling_method,
|
|
738
|
-
continuation_token=cont_token,
|
|
739
|
-
client=self._client,
|
|
740
|
-
deserialization_callback=get_long_running_output
|
|
741
|
-
)
|
|
742
|
-
return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
|
|
743
|
-
|
|
744
|
-
begin_analyze_text_cancel_job.metadata = {'url': "/analyze-text/jobs/{jobId}:cancel"} # type: ignore
|