azure-ai-textanalytics 5.3.0b1__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 -197
- 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.0b1.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info}/METADATA +755 -319
- azure_ai_textanalytics-6.0.0b1.dist-info/RECORD +29 -0
- {azure_ai_textanalytics-5.3.0b1.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info}/WHEEL +1 -1
- azure/ai/textanalytics/_base_client.py +0 -111
- azure/ai/textanalytics/_check.py +0 -22
- azure/ai/textanalytics/_dict_mixin.py +0 -54
- 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 -407
- azure/ai/textanalytics/_generated/v2022_10_01_preview/models/_models_py3.py +0 -8462
- azure/ai/textanalytics/_generated/v2022_10_01_preview/models/_patch.py +0 -72
- azure/ai/textanalytics/_generated/v2022_10_01_preview/models/_text_analytics_client_enums.py +0 -730
- 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 -552
- azure/ai/textanalytics/_models.py +0 -3142
- azure/ai/textanalytics/_policies.py +0 -66
- azure/ai/textanalytics/_request_handlers.py +0 -104
- azure/ai/textanalytics/_response_handlers.py +0 -580
- azure/ai/textanalytics/_text_analytics_client.py +0 -1802
- azure/ai/textanalytics/_user_agent.py +0 -8
- azure/ai/textanalytics/_validate.py +0 -113
- azure/ai/textanalytics/aio/_base_client_async.py +0 -95
- azure/ai/textanalytics/aio/_lro_async.py +0 -501
- azure/ai/textanalytics/aio/_response_handlers_async.py +0 -94
- azure/ai/textanalytics/aio/_text_analytics_client_async.py +0 -1800
- azure_ai_textanalytics-5.3.0b1.dist-info/RECORD +0 -115
- {azure_ai_textanalytics-5.3.0b1.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info/licenses}/LICENSE +0 -0
- {azure_ai_textanalytics-5.3.0b1.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info}/top_level.txt +0 -0
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
# ------------------------------------
|
|
2
|
-
# Copyright (c) Microsoft Corporation.
|
|
3
|
-
# Licensed under the MIT License.
|
|
4
|
-
# ------------------------------------
|
|
5
|
-
|
|
6
|
-
import functools
|
|
7
|
-
import typing
|
|
8
|
-
from typing_extensions import ParamSpec
|
|
9
|
-
from ._version import VERSIONS_SUPPORTED
|
|
10
|
-
|
|
11
|
-
P = ParamSpec("P")
|
|
12
|
-
T = typing.TypeVar("T")
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def check_for_unsupported_actions_types(*args, **kwargs):
|
|
16
|
-
|
|
17
|
-
client = args[0]
|
|
18
|
-
# this assumes the client has an _api_version attribute
|
|
19
|
-
selected_api_version = client._api_version # pylint: disable=protected-access
|
|
20
|
-
|
|
21
|
-
if "actions" not in kwargs:
|
|
22
|
-
actions = args[2]
|
|
23
|
-
else:
|
|
24
|
-
actions = kwargs.get("actions")
|
|
25
|
-
|
|
26
|
-
if actions is None:
|
|
27
|
-
return
|
|
28
|
-
|
|
29
|
-
actions_version_mapping = {
|
|
30
|
-
"2022-10-01-preview":
|
|
31
|
-
[
|
|
32
|
-
"ExtractSummaryAction",
|
|
33
|
-
"AbstractSummaryAction",
|
|
34
|
-
],
|
|
35
|
-
"2022-05-01":
|
|
36
|
-
[
|
|
37
|
-
"RecognizeCustomEntitiesAction",
|
|
38
|
-
"SingleLabelClassifyAction",
|
|
39
|
-
"MultiLabelClassifyAction",
|
|
40
|
-
"AnalyzeHealthcareEntitiesAction"
|
|
41
|
-
]
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
unsupported = {
|
|
45
|
-
arg: version
|
|
46
|
-
for version, args in actions_version_mapping.items()
|
|
47
|
-
for arg in args
|
|
48
|
-
if arg in [action.__class__.__name__ for action in actions]
|
|
49
|
-
and selected_api_version != version
|
|
50
|
-
and VERSIONS_SUPPORTED.index(selected_api_version) < VERSIONS_SUPPORTED.index(version)
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
if unsupported:
|
|
54
|
-
error_strings = [
|
|
55
|
-
f"'{action_type}' is not available in API version {selected_api_version}. "
|
|
56
|
-
f"Use service API version {version} or newer.\n"
|
|
57
|
-
for action_type, version in unsupported.items()
|
|
58
|
-
]
|
|
59
|
-
raise ValueError("".join(error_strings))
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
def validate_multiapi_args(**kwargs: typing.Any) -> typing.Callable[[typing.Callable[P, T]], typing.Callable[P, T]]:
|
|
63
|
-
args_mapping = kwargs.pop("args_mapping", None)
|
|
64
|
-
version_method_added = kwargs.pop("version_method_added", None)
|
|
65
|
-
custom_wrapper = kwargs.pop("custom_wrapper", None)
|
|
66
|
-
|
|
67
|
-
def decorator(func: typing.Callable[P, T]) -> typing.Callable[P, T]:
|
|
68
|
-
@functools.wraps(func)
|
|
69
|
-
def wrapper(*args: typing.Any, **kwargs: typing.Any) -> T:
|
|
70
|
-
try:
|
|
71
|
-
# this assumes the client has an _api_version attribute
|
|
72
|
-
client = args[0]
|
|
73
|
-
selected_api_version = client._api_version # pylint: disable=protected-access
|
|
74
|
-
except AttributeError:
|
|
75
|
-
return func(*args, **kwargs)
|
|
76
|
-
|
|
77
|
-
# the latest version is selected, we assume all features supported
|
|
78
|
-
if selected_api_version == VERSIONS_SUPPORTED[-1]:
|
|
79
|
-
return func(*args, **kwargs)
|
|
80
|
-
|
|
81
|
-
if version_method_added and version_method_added != selected_api_version and \
|
|
82
|
-
VERSIONS_SUPPORTED.index(selected_api_version) < VERSIONS_SUPPORTED.index(version_method_added):
|
|
83
|
-
raise ValueError(
|
|
84
|
-
f"'{client.__class__.__name__}.{func.__name__}' is not available in API version "
|
|
85
|
-
f"{selected_api_version}. Use service API version {version_method_added} or newer."
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
if args_mapping:
|
|
89
|
-
unsupported = {
|
|
90
|
-
arg: version
|
|
91
|
-
for version, args in args_mapping.items()
|
|
92
|
-
for arg in args
|
|
93
|
-
if arg in kwargs.keys()
|
|
94
|
-
and selected_api_version != version
|
|
95
|
-
and VERSIONS_SUPPORTED.index(selected_api_version) < VERSIONS_SUPPORTED.index(version)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
if unsupported:
|
|
99
|
-
error_strings = [
|
|
100
|
-
f"'{param}' is not available in API version {selected_api_version}. "
|
|
101
|
-
f"Use service API version {version} or newer.\n"
|
|
102
|
-
for param, version in unsupported.items()
|
|
103
|
-
]
|
|
104
|
-
raise ValueError("".join(error_strings))
|
|
105
|
-
|
|
106
|
-
if custom_wrapper:
|
|
107
|
-
custom_wrapper(*args, **kwargs)
|
|
108
|
-
|
|
109
|
-
return func(*args, **kwargs)
|
|
110
|
-
|
|
111
|
-
return wrapper
|
|
112
|
-
|
|
113
|
-
return decorator
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# ------------------------------------
|
|
2
|
-
# Copyright (c) Microsoft Corporation.
|
|
3
|
-
# Licensed under the MIT License.
|
|
4
|
-
# ------------------------------------
|
|
5
|
-
from typing import Any, Union
|
|
6
|
-
from azure.core.credentials import AzureKeyCredential
|
|
7
|
-
from azure.core.credentials_async import AsyncTokenCredential
|
|
8
|
-
from azure.core.pipeline.policies import AzureKeyCredentialPolicy, HttpLoggingPolicy
|
|
9
|
-
from .._generated.aio import TextAnalyticsClient as _TextAnalyticsClient
|
|
10
|
-
from .._policies import TextAnalyticsResponseHookPolicy, QuotaExceededPolicy
|
|
11
|
-
from .._user_agent import USER_AGENT
|
|
12
|
-
from .._version import DEFAULT_API_VERSION
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def _authentication_policy(credential):
|
|
16
|
-
authentication_policy = None
|
|
17
|
-
if credential is None:
|
|
18
|
-
raise ValueError("Parameter 'credential' must not be None.")
|
|
19
|
-
if isinstance(credential, AzureKeyCredential):
|
|
20
|
-
authentication_policy = AzureKeyCredentialPolicy(
|
|
21
|
-
name="Ocp-Apim-Subscription-Key", credential=credential
|
|
22
|
-
)
|
|
23
|
-
elif credential is not None and not hasattr(credential, "get_token"):
|
|
24
|
-
raise TypeError(
|
|
25
|
-
"Unsupported credential: {}. Use an instance of AzureKeyCredential "
|
|
26
|
-
"or a token credential from azure.identity".format(type(credential))
|
|
27
|
-
)
|
|
28
|
-
return authentication_policy
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
class AsyncTextAnalyticsClientBase:
|
|
32
|
-
def __init__(
|
|
33
|
-
self,
|
|
34
|
-
endpoint: str,
|
|
35
|
-
credential: Union[AzureKeyCredential, AsyncTokenCredential],
|
|
36
|
-
**kwargs: Any
|
|
37
|
-
) -> None:
|
|
38
|
-
http_logging_policy = HttpLoggingPolicy(**kwargs)
|
|
39
|
-
http_logging_policy.allowed_header_names.update(
|
|
40
|
-
{
|
|
41
|
-
"Operation-Location",
|
|
42
|
-
"apim-request-id",
|
|
43
|
-
"x-envoy-upstream-service-time",
|
|
44
|
-
"Strict-Transport-Security",
|
|
45
|
-
"x-content-type-options",
|
|
46
|
-
"warn-code",
|
|
47
|
-
"warn-agent",
|
|
48
|
-
"warn-text",
|
|
49
|
-
}
|
|
50
|
-
)
|
|
51
|
-
http_logging_policy.allowed_query_params.update(
|
|
52
|
-
{
|
|
53
|
-
"model-version",
|
|
54
|
-
"showStats",
|
|
55
|
-
"loggingOptOut",
|
|
56
|
-
"domain",
|
|
57
|
-
"stringIndexType",
|
|
58
|
-
"piiCategories",
|
|
59
|
-
"$top",
|
|
60
|
-
"$skip",
|
|
61
|
-
"opinionMining",
|
|
62
|
-
"api-version"
|
|
63
|
-
}
|
|
64
|
-
)
|
|
65
|
-
try:
|
|
66
|
-
endpoint = endpoint.rstrip("/")
|
|
67
|
-
except AttributeError:
|
|
68
|
-
raise ValueError("Parameter 'endpoint' must be a string.")
|
|
69
|
-
self._api_version = kwargs.pop("api_version", DEFAULT_API_VERSION)
|
|
70
|
-
if hasattr(self._api_version, "value"):
|
|
71
|
-
self._api_version = self._api_version.value
|
|
72
|
-
self._client = _TextAnalyticsClient(
|
|
73
|
-
endpoint=endpoint,
|
|
74
|
-
credential=credential, # type: ignore
|
|
75
|
-
api_version=self._api_version,
|
|
76
|
-
sdk_moniker=USER_AGENT,
|
|
77
|
-
authentication_policy=kwargs.pop("authentication_policy", _authentication_policy(credential)),
|
|
78
|
-
custom_hook_policy=kwargs.pop("custom_hook_policy", TextAnalyticsResponseHookPolicy(**kwargs)),
|
|
79
|
-
http_logging_policy=kwargs.pop("http_logging_policy", http_logging_policy),
|
|
80
|
-
per_retry_policies=kwargs.get("per_retry_policies", QuotaExceededPolicy()),
|
|
81
|
-
**kwargs
|
|
82
|
-
)
|
|
83
|
-
|
|
84
|
-
async def __aenter__(self) -> "AsyncTextAnalyticsClientBase":
|
|
85
|
-
await self._client.__aenter__()
|
|
86
|
-
return self
|
|
87
|
-
|
|
88
|
-
async def __aexit__(self, *args: "Any") -> None:
|
|
89
|
-
await self._client.__aexit__(*args)
|
|
90
|
-
|
|
91
|
-
async def close(self) -> None:
|
|
92
|
-
"""Close sockets opened by the client.
|
|
93
|
-
Calling this method is unnecessary when using the client as a context manager.
|
|
94
|
-
"""
|
|
95
|
-
await self._client.__aexit__()
|