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
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
# coding=utf-8
|
|
2
|
-
# --------------------------------------------------------------------------
|
|
3
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
# Licensed under the MIT License. See License.txt in the project root for
|
|
5
|
-
# license information.
|
|
6
|
-
#
|
|
7
|
-
# Code generated by Microsoft (R) AutoRest Code Generator.
|
|
8
|
-
# Changes may cause incorrect behavior and will be lost if the code is
|
|
9
|
-
# regenerated.
|
|
10
|
-
# --------------------------------------------------------------------------
|
|
11
|
-
|
|
12
|
-
from typing import Any, Optional, TYPE_CHECKING
|
|
13
|
-
|
|
14
|
-
from azure.core import AsyncPipelineClient
|
|
15
|
-
from azure.profiles import KnownProfiles, ProfileDefinition
|
|
16
|
-
from azure.profiles.multiapiclient import MultiApiClientMixin
|
|
17
|
-
|
|
18
|
-
from .._serialization import Deserializer, Serializer
|
|
19
|
-
from ._configuration import TextAnalyticsClientConfiguration
|
|
20
|
-
from ._operations_mixin import TextAnalyticsClientOperationsMixin
|
|
21
|
-
|
|
22
|
-
if TYPE_CHECKING:
|
|
23
|
-
# pylint: disable=unused-import,ungrouped-imports
|
|
24
|
-
from azure.core.credentials_async import AsyncTokenCredential
|
|
25
|
-
|
|
26
|
-
class _SDKClient(object):
|
|
27
|
-
def __init__(self, *args, **kwargs):
|
|
28
|
-
"""This is a fake class to support current implemetation of MultiApiClientMixin."
|
|
29
|
-
Will be removed in final version of multiapi azure-core based client
|
|
30
|
-
"""
|
|
31
|
-
pass
|
|
32
|
-
|
|
33
|
-
class TextAnalyticsClient(TextAnalyticsClientOperationsMixin, MultiApiClientMixin, _SDKClient):
|
|
34
|
-
"""The Text Analytics API is a suite of natural language processing (NLP) services built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction and language detection. Functionality for analysis of text specific to the healthcare domain and personal information are also available in the API. Further documentation can be found in :code:`<a href="https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview">https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview</a>`.
|
|
35
|
-
|
|
36
|
-
This ready contains multiple API versions, to help you deal with all of the Azure clouds
|
|
37
|
-
(Azure Stack, Azure Government, Azure China, etc.).
|
|
38
|
-
By default, it uses the latest API version available on public Azure.
|
|
39
|
-
For production, you should stick to a particular api-version and/or profile.
|
|
40
|
-
The profile sets a mapping between an operation group and its API version.
|
|
41
|
-
The api-version parameter sets the default API version if the operation
|
|
42
|
-
group is not described in the profile.
|
|
43
|
-
|
|
44
|
-
:param credential: Credential needed for the client to connect to Azure. Required.
|
|
45
|
-
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
|
|
46
|
-
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example: https://westus.api.cognitive.microsoft.com). Required.
|
|
47
|
-
:type endpoint: str
|
|
48
|
-
:param api_version: API version to use if no profile is provided, or if missing in profile.
|
|
49
|
-
:type api_version: str
|
|
50
|
-
:param profile: A profile definition, from KnownProfiles to dict.
|
|
51
|
-
:type profile: azure.profiles.KnownProfiles
|
|
52
|
-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
|
|
53
|
-
"""
|
|
54
|
-
|
|
55
|
-
DEFAULT_API_VERSION = 'v3.1'
|
|
56
|
-
_PROFILE_TAG = "azure.ai.textanalytics.TextAnalyticsClient"
|
|
57
|
-
LATEST_PROFILE = ProfileDefinition({
|
|
58
|
-
_PROFILE_TAG: {
|
|
59
|
-
None: DEFAULT_API_VERSION,
|
|
60
|
-
'analyze_text': '2022-05-01',
|
|
61
|
-
'analyze_text_job_status': '2022-05-01',
|
|
62
|
-
'begin_analyze_text_cancel_job': '2022-05-01',
|
|
63
|
-
'begin_analyze_text_submit_job': '2022-05-01',
|
|
64
|
-
}},
|
|
65
|
-
_PROFILE_TAG + " latest"
|
|
66
|
-
)
|
|
67
|
-
|
|
68
|
-
def __init__(
|
|
69
|
-
self,
|
|
70
|
-
credential: "AsyncTokenCredential",
|
|
71
|
-
endpoint: str,
|
|
72
|
-
api_version: Optional[str] = None,
|
|
73
|
-
profile: KnownProfiles = KnownProfiles.default,
|
|
74
|
-
**kwargs # type: Any
|
|
75
|
-
) -> None:
|
|
76
|
-
if api_version == '2022-05-01' or api_version == '2022-10-01-preview':
|
|
77
|
-
base_url = '{Endpoint}/language'
|
|
78
|
-
elif api_version == 'v3.0':
|
|
79
|
-
base_url = '{Endpoint}/text/analytics/v3.0'
|
|
80
|
-
elif api_version == 'v3.1':
|
|
81
|
-
base_url = '{Endpoint}/text/analytics/v3.1'
|
|
82
|
-
else:
|
|
83
|
-
raise ValueError("API version {} is not available".format(api_version))
|
|
84
|
-
self._config = TextAnalyticsClientConfiguration(credential, endpoint, **kwargs)
|
|
85
|
-
self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs)
|
|
86
|
-
super(TextAnalyticsClient, self).__init__(
|
|
87
|
-
api_version=api_version,
|
|
88
|
-
profile=profile
|
|
89
|
-
)
|
|
90
|
-
|
|
91
|
-
@classmethod
|
|
92
|
-
def _models_dict(cls, api_version):
|
|
93
|
-
return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)}
|
|
94
|
-
|
|
95
|
-
@classmethod
|
|
96
|
-
def models(cls, api_version=DEFAULT_API_VERSION):
|
|
97
|
-
"""Module depends on the API version:
|
|
98
|
-
|
|
99
|
-
* 2022-05-01: :mod:`v2022_05_01.models<azure.ai.textanalytics.v2022_05_01.models>`
|
|
100
|
-
* 2022-10-01-preview: :mod:`v2022_10_01_preview.models<azure.ai.textanalytics.v2022_10_01_preview.models>`
|
|
101
|
-
* v3.0: :mod:`v3_0.models<azure.ai.textanalytics.v3_0.models>`
|
|
102
|
-
* v3.1: :mod:`v3_1.models<azure.ai.textanalytics.v3_1.models>`
|
|
103
|
-
"""
|
|
104
|
-
if api_version == '2022-05-01':
|
|
105
|
-
from ..v2022_05_01 import models
|
|
106
|
-
return models
|
|
107
|
-
elif api_version == '2022-10-01-preview':
|
|
108
|
-
from ..v2022_10_01_preview import models
|
|
109
|
-
return models
|
|
110
|
-
elif api_version == 'v3.0':
|
|
111
|
-
from ..v3_0 import models
|
|
112
|
-
return models
|
|
113
|
-
elif api_version == 'v3.1':
|
|
114
|
-
from ..v3_1 import models
|
|
115
|
-
return models
|
|
116
|
-
raise ValueError("API version {} is not available".format(api_version))
|
|
117
|
-
|
|
118
|
-
async def close(self):
|
|
119
|
-
await self._client.close()
|
|
120
|
-
async def __aenter__(self):
|
|
121
|
-
await self._client.__aenter__()
|
|
122
|
-
return self
|
|
123
|
-
async def __aexit__(self, *exc_details):
|
|
124
|
-
await self._client.__aexit__(*exc_details)
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# coding=utf-8
|
|
2
|
-
# --------------------------------------------------------------------------
|
|
3
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
# Licensed under the MIT License. See License.txt in the project root for
|
|
5
|
-
# license information.
|
|
6
|
-
# --------------------------------------------------------------------------
|
|
7
|
-
from .v2022_10_01_preview.models import *
|
|
8
|
-
from .v3_1.models import *
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# coding=utf-8
|
|
2
|
-
# --------------------------------------------------------------------------
|
|
3
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
-
# Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
-
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
-
# --------------------------------------------------------------------------
|
|
8
|
-
|
|
9
|
-
from ._text_analytics_client import TextAnalyticsClient
|
|
10
|
-
|
|
11
|
-
try:
|
|
12
|
-
from ._patch import __all__ as _patch_all
|
|
13
|
-
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
|
|
14
|
-
except ImportError:
|
|
15
|
-
_patch_all = []
|
|
16
|
-
from ._patch import patch_sdk as _patch_sdk
|
|
17
|
-
__all__ = ['TextAnalyticsClient']
|
|
18
|
-
__all__.extend([p for p in _patch_all if p not in __all__])
|
|
19
|
-
|
|
20
|
-
_patch_sdk()
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
# coding=utf-8
|
|
2
|
-
# --------------------------------------------------------------------------
|
|
3
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
-
# Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
-
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
-
# --------------------------------------------------------------------------
|
|
8
|
-
|
|
9
|
-
from typing import Any, TYPE_CHECKING
|
|
10
|
-
|
|
11
|
-
from azure.core.configuration import Configuration
|
|
12
|
-
from azure.core.pipeline import policies
|
|
13
|
-
|
|
14
|
-
if TYPE_CHECKING:
|
|
15
|
-
# pylint: disable=unused-import,ungrouped-imports
|
|
16
|
-
from azure.core.credentials import TokenCredential
|
|
17
|
-
|
|
18
|
-
VERSION = "unknown"
|
|
19
|
-
|
|
20
|
-
class TextAnalyticsClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
|
|
21
|
-
"""Configuration for TextAnalyticsClient.
|
|
22
|
-
|
|
23
|
-
Note that all parameters used to create this instance are saved as instance
|
|
24
|
-
attributes.
|
|
25
|
-
|
|
26
|
-
:param credential: Credential needed for the client to connect to Azure. Required.
|
|
27
|
-
:type credential: ~azure.core.credentials.TokenCredential
|
|
28
|
-
:param endpoint: Supported Cognitive Services endpoint (e.g.,
|
|
29
|
-
https://:code:`<resource-name>`.api.cognitiveservices.azure.com). Required.
|
|
30
|
-
:type endpoint: str
|
|
31
|
-
:keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this
|
|
32
|
-
default value may result in unsupported behavior.
|
|
33
|
-
:paramtype api_version: str
|
|
34
|
-
"""
|
|
35
|
-
|
|
36
|
-
def __init__(
|
|
37
|
-
self,
|
|
38
|
-
credential: "TokenCredential",
|
|
39
|
-
endpoint: str,
|
|
40
|
-
**kwargs: Any
|
|
41
|
-
) -> None:
|
|
42
|
-
super(TextAnalyticsClientConfiguration, self).__init__(**kwargs)
|
|
43
|
-
api_version = kwargs.pop('api_version', "2022-05-01") # type: str
|
|
44
|
-
|
|
45
|
-
if credential is None:
|
|
46
|
-
raise ValueError("Parameter 'credential' must not be None.")
|
|
47
|
-
if endpoint is None:
|
|
48
|
-
raise ValueError("Parameter 'endpoint' must not be None.")
|
|
49
|
-
|
|
50
|
-
self.credential = credential
|
|
51
|
-
self.endpoint = endpoint
|
|
52
|
-
self.api_version = api_version
|
|
53
|
-
self.credential_scopes = kwargs.pop('credential_scopes', ['https://cognitiveservices.azure.com/.default'])
|
|
54
|
-
kwargs.setdefault('sdk_moniker', 'ai-textanalytics/{}'.format(VERSION))
|
|
55
|
-
self._configure(**kwargs)
|
|
56
|
-
|
|
57
|
-
def _configure(
|
|
58
|
-
self,
|
|
59
|
-
**kwargs # type: Any
|
|
60
|
-
):
|
|
61
|
-
# type: (...) -> None
|
|
62
|
-
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
|
|
63
|
-
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
|
|
64
|
-
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
|
|
65
|
-
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
|
|
66
|
-
self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
|
|
67
|
-
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
|
|
68
|
-
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
|
|
69
|
-
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
|
|
70
|
-
self.authentication_policy = kwargs.get('authentication_policy')
|
|
71
|
-
if self.credential and not self.authentication_policy:
|
|
72
|
-
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
# coding=utf-8
|
|
2
|
-
# --------------------------------------------------------------------------
|
|
3
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
-
# Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
-
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
-
# --------------------------------------------------------------------------
|
|
8
|
-
|
|
9
|
-
from copy import deepcopy
|
|
10
|
-
from typing import Any, TYPE_CHECKING
|
|
11
|
-
|
|
12
|
-
from azure.core import PipelineClient
|
|
13
|
-
from azure.core.rest import HttpRequest, HttpResponse
|
|
14
|
-
|
|
15
|
-
from . import models
|
|
16
|
-
from .._serialization import Deserializer, Serializer
|
|
17
|
-
from ._configuration import TextAnalyticsClientConfiguration
|
|
18
|
-
from .operations import TextAnalyticsClientOperationsMixin
|
|
19
|
-
|
|
20
|
-
if TYPE_CHECKING:
|
|
21
|
-
# pylint: disable=unused-import,ungrouped-imports
|
|
22
|
-
from azure.core.credentials import TokenCredential
|
|
23
|
-
|
|
24
|
-
class TextAnalyticsClient(TextAnalyticsClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword
|
|
25
|
-
"""The language service API is a suite of natural language processing (NLP) skills built with
|
|
26
|
-
best-in-class Microsoft machine learning algorithms. The API can be used to analyze
|
|
27
|
-
unstructured text for tasks such as sentiment analysis, key phrase extraction, language
|
|
28
|
-
detection and question answering. Further documentation can be found in :code:`<a
|
|
29
|
-
href="https://docs.microsoft.com/en-us/azure/cognitive-services/language-service/overview">https://docs.microsoft.com/en-us/azure/cognitive-services/language-service/overview</a>`.0.
|
|
30
|
-
|
|
31
|
-
:param credential: Credential needed for the client to connect to Azure. Required.
|
|
32
|
-
:type credential: ~azure.core.credentials.TokenCredential
|
|
33
|
-
:param endpoint: Supported Cognitive Services endpoint (e.g.,
|
|
34
|
-
https://:code:`<resource-name>`.api.cognitiveservices.azure.com). Required.
|
|
35
|
-
:type endpoint: str
|
|
36
|
-
:keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this
|
|
37
|
-
default value may result in unsupported behavior.
|
|
38
|
-
:paramtype api_version: str
|
|
39
|
-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
|
40
|
-
Retry-After header is present.
|
|
41
|
-
"""
|
|
42
|
-
|
|
43
|
-
def __init__(
|
|
44
|
-
self,
|
|
45
|
-
credential: "TokenCredential",
|
|
46
|
-
endpoint: str,
|
|
47
|
-
**kwargs: Any
|
|
48
|
-
) -> None:
|
|
49
|
-
_endpoint = '{Endpoint}/language'
|
|
50
|
-
self._config = TextAnalyticsClientConfiguration(credential=credential, endpoint=endpoint, **kwargs)
|
|
51
|
-
self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs)
|
|
52
|
-
|
|
53
|
-
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
|
|
54
|
-
self._serialize = Serializer(client_models)
|
|
55
|
-
self._deserialize = Deserializer(client_models)
|
|
56
|
-
self._serialize.client_side_validation = False
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
def _send_request(
|
|
60
|
-
self,
|
|
61
|
-
request: HttpRequest,
|
|
62
|
-
**kwargs: Any
|
|
63
|
-
) -> HttpResponse:
|
|
64
|
-
"""Runs the network request through the client's chained policies.
|
|
65
|
-
|
|
66
|
-
>>> from azure.core.rest import HttpRequest
|
|
67
|
-
>>> request = HttpRequest("GET", "https://www.example.org/")
|
|
68
|
-
<HttpRequest [GET], url: 'https://www.example.org/'>
|
|
69
|
-
>>> response = client._send_request(request)
|
|
70
|
-
<HttpResponse: 200 OK>
|
|
71
|
-
|
|
72
|
-
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
|
|
73
|
-
|
|
74
|
-
:param request: The network request you want to make. Required.
|
|
75
|
-
:type request: ~azure.core.rest.HttpRequest
|
|
76
|
-
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
|
|
77
|
-
:return: The response of your network call. Does not do error handling on your response.
|
|
78
|
-
:rtype: ~azure.core.rest.HttpResponse
|
|
79
|
-
"""
|
|
80
|
-
|
|
81
|
-
request_copy = deepcopy(request)
|
|
82
|
-
path_format_arguments = {
|
|
83
|
-
"Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
|
|
87
|
-
return self._client.send_request(request_copy, **kwargs)
|
|
88
|
-
|
|
89
|
-
def close(self):
|
|
90
|
-
# type: () -> None
|
|
91
|
-
self._client.close()
|
|
92
|
-
|
|
93
|
-
def __enter__(self):
|
|
94
|
-
# type: () -> TextAnalyticsClient
|
|
95
|
-
self._client.__enter__()
|
|
96
|
-
return self
|
|
97
|
-
|
|
98
|
-
def __exit__(self, *exc_details):
|
|
99
|
-
# type: (Any) -> None
|
|
100
|
-
self._client.__exit__(*exc_details)
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# --------------------------------------------------------------------------
|
|
2
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
-
# Code generated by Microsoft (R) AutoRest Code Generator.
|
|
5
|
-
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
6
|
-
# --------------------------------------------------------------------------
|
|
7
|
-
|
|
8
|
-
from abc import ABC
|
|
9
|
-
from typing import TYPE_CHECKING
|
|
10
|
-
|
|
11
|
-
from azure.core.pipeline.transport import HttpRequest
|
|
12
|
-
|
|
13
|
-
from ._configuration import TextAnalyticsClientConfiguration
|
|
14
|
-
|
|
15
|
-
if TYPE_CHECKING:
|
|
16
|
-
# pylint: disable=unused-import,ungrouped-imports
|
|
17
|
-
from azure.core import PipelineClient
|
|
18
|
-
|
|
19
|
-
from .._serialization import Deserializer, Serializer
|
|
20
|
-
|
|
21
|
-
def _convert_request(request, files=None):
|
|
22
|
-
data = request.content if not files else None
|
|
23
|
-
request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data)
|
|
24
|
-
if files:
|
|
25
|
-
request.set_formdata_body(files)
|
|
26
|
-
return request
|
|
27
|
-
|
|
28
|
-
def _format_url_section(template, **kwargs):
|
|
29
|
-
components = template.split("/")
|
|
30
|
-
while components:
|
|
31
|
-
try:
|
|
32
|
-
return template.format(**kwargs)
|
|
33
|
-
except KeyError as key:
|
|
34
|
-
formatted_components = template.split("/")
|
|
35
|
-
components = [
|
|
36
|
-
c for c in formatted_components if "{}".format(key.args[0]) not in c
|
|
37
|
-
]
|
|
38
|
-
template = "/".join(components)
|
|
39
|
-
|
|
40
|
-
class MixinABC(ABC):
|
|
41
|
-
"""DO NOT use this class. It is for internal typing use only."""
|
|
42
|
-
_client: "PipelineClient"
|
|
43
|
-
_config: TextAnalyticsClientConfiguration
|
|
44
|
-
_serialize: "Serializer"
|
|
45
|
-
_deserialize: "Deserializer"
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# coding=utf-8
|
|
2
|
-
# --------------------------------------------------------------------------
|
|
3
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
-
# Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
-
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
-
# --------------------------------------------------------------------------
|
|
8
|
-
|
|
9
|
-
from ._text_analytics_client import TextAnalyticsClient
|
|
10
|
-
|
|
11
|
-
try:
|
|
12
|
-
from ._patch import __all__ as _patch_all
|
|
13
|
-
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
|
|
14
|
-
except ImportError:
|
|
15
|
-
_patch_all = []
|
|
16
|
-
from ._patch import patch_sdk as _patch_sdk
|
|
17
|
-
__all__ = ['TextAnalyticsClient']
|
|
18
|
-
__all__.extend([p for p in _patch_all if p not in __all__])
|
|
19
|
-
|
|
20
|
-
_patch_sdk()
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
# coding=utf-8
|
|
2
|
-
# --------------------------------------------------------------------------
|
|
3
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
-
# Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
-
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
-
# --------------------------------------------------------------------------
|
|
8
|
-
|
|
9
|
-
from typing import Any, TYPE_CHECKING
|
|
10
|
-
|
|
11
|
-
from azure.core.configuration import Configuration
|
|
12
|
-
from azure.core.pipeline import policies
|
|
13
|
-
|
|
14
|
-
if TYPE_CHECKING:
|
|
15
|
-
# pylint: disable=unused-import,ungrouped-imports
|
|
16
|
-
from azure.core.credentials_async import AsyncTokenCredential
|
|
17
|
-
|
|
18
|
-
VERSION = "unknown"
|
|
19
|
-
|
|
20
|
-
class TextAnalyticsClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes
|
|
21
|
-
"""Configuration for TextAnalyticsClient.
|
|
22
|
-
|
|
23
|
-
Note that all parameters used to create this instance are saved as instance
|
|
24
|
-
attributes.
|
|
25
|
-
|
|
26
|
-
:param credential: Credential needed for the client to connect to Azure. Required.
|
|
27
|
-
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
|
|
28
|
-
:param endpoint: Supported Cognitive Services endpoint (e.g.,
|
|
29
|
-
https://:code:`<resource-name>`.api.cognitiveservices.azure.com). Required.
|
|
30
|
-
:type endpoint: str
|
|
31
|
-
:keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this
|
|
32
|
-
default value may result in unsupported behavior.
|
|
33
|
-
:paramtype api_version: str
|
|
34
|
-
"""
|
|
35
|
-
|
|
36
|
-
def __init__(
|
|
37
|
-
self,
|
|
38
|
-
credential: "AsyncTokenCredential",
|
|
39
|
-
endpoint: str,
|
|
40
|
-
**kwargs: Any
|
|
41
|
-
) -> None:
|
|
42
|
-
super(TextAnalyticsClientConfiguration, self).__init__(**kwargs)
|
|
43
|
-
api_version = kwargs.pop('api_version', "2022-05-01") # type: str
|
|
44
|
-
|
|
45
|
-
if credential is None:
|
|
46
|
-
raise ValueError("Parameter 'credential' must not be None.")
|
|
47
|
-
if endpoint is None:
|
|
48
|
-
raise ValueError("Parameter 'endpoint' must not be None.")
|
|
49
|
-
|
|
50
|
-
self.credential = credential
|
|
51
|
-
self.endpoint = endpoint
|
|
52
|
-
self.api_version = api_version
|
|
53
|
-
self.credential_scopes = kwargs.pop('credential_scopes', ['https://cognitiveservices.azure.com/.default'])
|
|
54
|
-
kwargs.setdefault('sdk_moniker', 'ai-textanalytics/{}'.format(VERSION))
|
|
55
|
-
self._configure(**kwargs)
|
|
56
|
-
|
|
57
|
-
def _configure(
|
|
58
|
-
self,
|
|
59
|
-
**kwargs: Any
|
|
60
|
-
) -> None:
|
|
61
|
-
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
|
|
62
|
-
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
|
|
63
|
-
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
|
|
64
|
-
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
|
|
65
|
-
self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
|
|
66
|
-
self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs)
|
|
67
|
-
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
|
|
68
|
-
self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
|
|
69
|
-
self.authentication_policy = kwargs.get('authentication_policy')
|
|
70
|
-
if self.credential and not self.authentication_policy:
|
|
71
|
-
self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
# coding=utf-8
|
|
2
|
-
# --------------------------------------------------------------------------
|
|
3
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
-
# Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
-
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
-
# --------------------------------------------------------------------------
|
|
8
|
-
|
|
9
|
-
from copy import deepcopy
|
|
10
|
-
from typing import Any, Awaitable, TYPE_CHECKING
|
|
11
|
-
|
|
12
|
-
from azure.core import AsyncPipelineClient
|
|
13
|
-
from azure.core.rest import AsyncHttpResponse, HttpRequest
|
|
14
|
-
|
|
15
|
-
from .. import models
|
|
16
|
-
from ..._serialization import Deserializer, Serializer
|
|
17
|
-
from ._configuration import TextAnalyticsClientConfiguration
|
|
18
|
-
from .operations import TextAnalyticsClientOperationsMixin
|
|
19
|
-
|
|
20
|
-
if TYPE_CHECKING:
|
|
21
|
-
# pylint: disable=unused-import,ungrouped-imports
|
|
22
|
-
from azure.core.credentials_async import AsyncTokenCredential
|
|
23
|
-
|
|
24
|
-
class TextAnalyticsClient(TextAnalyticsClientOperationsMixin): # pylint: disable=client-accepts-api-version-keyword
|
|
25
|
-
"""The language service API is a suite of natural language processing (NLP) skills built with
|
|
26
|
-
best-in-class Microsoft machine learning algorithms. The API can be used to analyze
|
|
27
|
-
unstructured text for tasks such as sentiment analysis, key phrase extraction, language
|
|
28
|
-
detection and question answering. Further documentation can be found in :code:`<a
|
|
29
|
-
href="https://docs.microsoft.com/en-us/azure/cognitive-services/language-service/overview">https://docs.microsoft.com/en-us/azure/cognitive-services/language-service/overview</a>`.0.
|
|
30
|
-
|
|
31
|
-
:param credential: Credential needed for the client to connect to Azure. Required.
|
|
32
|
-
:type credential: ~azure.core.credentials_async.AsyncTokenCredential
|
|
33
|
-
:param endpoint: Supported Cognitive Services endpoint (e.g.,
|
|
34
|
-
https://:code:`<resource-name>`.api.cognitiveservices.azure.com). Required.
|
|
35
|
-
:type endpoint: str
|
|
36
|
-
:keyword api_version: Api Version. Default value is "2022-05-01". Note that overriding this
|
|
37
|
-
default value may result in unsupported behavior.
|
|
38
|
-
:paramtype api_version: str
|
|
39
|
-
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
|
|
40
|
-
Retry-After header is present.
|
|
41
|
-
"""
|
|
42
|
-
|
|
43
|
-
def __init__(
|
|
44
|
-
self,
|
|
45
|
-
credential: "AsyncTokenCredential",
|
|
46
|
-
endpoint: str,
|
|
47
|
-
**kwargs: Any
|
|
48
|
-
) -> None:
|
|
49
|
-
_endpoint = '{Endpoint}/language'
|
|
50
|
-
self._config = TextAnalyticsClientConfiguration(credential=credential, endpoint=endpoint, **kwargs)
|
|
51
|
-
self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs)
|
|
52
|
-
|
|
53
|
-
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
|
|
54
|
-
self._serialize = Serializer(client_models)
|
|
55
|
-
self._deserialize = Deserializer(client_models)
|
|
56
|
-
self._serialize.client_side_validation = False
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
def _send_request(
|
|
60
|
-
self,
|
|
61
|
-
request: HttpRequest,
|
|
62
|
-
**kwargs: Any
|
|
63
|
-
) -> Awaitable[AsyncHttpResponse]:
|
|
64
|
-
"""Runs the network request through the client's chained policies.
|
|
65
|
-
|
|
66
|
-
>>> from azure.core.rest import HttpRequest
|
|
67
|
-
>>> request = HttpRequest("GET", "https://www.example.org/")
|
|
68
|
-
<HttpRequest [GET], url: 'https://www.example.org/'>
|
|
69
|
-
>>> response = await client._send_request(request)
|
|
70
|
-
<AsyncHttpResponse: 200 OK>
|
|
71
|
-
|
|
72
|
-
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
|
|
73
|
-
|
|
74
|
-
:param request: The network request you want to make. Required.
|
|
75
|
-
:type request: ~azure.core.rest.HttpRequest
|
|
76
|
-
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
|
|
77
|
-
:return: The response of your network call. Does not do error handling on your response.
|
|
78
|
-
:rtype: ~azure.core.rest.AsyncHttpResponse
|
|
79
|
-
"""
|
|
80
|
-
|
|
81
|
-
request_copy = deepcopy(request)
|
|
82
|
-
path_format_arguments = {
|
|
83
|
-
"Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
|
|
87
|
-
return self._client.send_request(request_copy, **kwargs)
|
|
88
|
-
|
|
89
|
-
async def close(self) -> None:
|
|
90
|
-
await self._client.close()
|
|
91
|
-
|
|
92
|
-
async def __aenter__(self) -> "TextAnalyticsClient":
|
|
93
|
-
await self._client.__aenter__()
|
|
94
|
-
return self
|
|
95
|
-
|
|
96
|
-
async def __aexit__(self, *exc_details) -> None:
|
|
97
|
-
await self._client.__aexit__(*exc_details)
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# coding=utf-8
|
|
2
|
-
# --------------------------------------------------------------------------
|
|
3
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
-
# Licensed under the MIT License. See License.txt in the project root for license information.
|
|
5
|
-
# Code generated by Microsoft (R) AutoRest Code Generator.
|
|
6
|
-
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
|
|
7
|
-
# --------------------------------------------------------------------------
|
|
8
|
-
|
|
9
|
-
from ._text_analytics_client_operations import TextAnalyticsClientOperationsMixin
|
|
10
|
-
|
|
11
|
-
from ._patch import __all__ as _patch_all
|
|
12
|
-
from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
|
|
13
|
-
from ._patch import patch_sdk as _patch_sdk
|
|
14
|
-
__all__ = [
|
|
15
|
-
'TextAnalyticsClientOperationsMixin',
|
|
16
|
-
]
|
|
17
|
-
__all__.extend([p for p in _patch_all if p not in __all__])
|
|
18
|
-
_patch_sdk()
|