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.

Files changed (128) hide show
  1. azure/ai/textanalytics/__init__.py +26 -197
  2. azure/ai/textanalytics/_client.py +111 -0
  3. azure/ai/textanalytics/_configuration.py +73 -0
  4. azure/ai/textanalytics/{_generated/v2022_05_01/operations → _operations}/__init__.py +13 -8
  5. azure/ai/textanalytics/_operations/_operations.py +716 -0
  6. azure/ai/textanalytics/{_generated/v2022_05_01/models → _operations}/_patch.py +8 -6
  7. azure/ai/textanalytics/_patch.py +350 -0
  8. azure/ai/textanalytics/{_generated/aio → _utils}/__init__.py +1 -5
  9. azure/ai/textanalytics/_utils/model_base.py +1237 -0
  10. azure/ai/textanalytics/{_generated/_serialization.py → _utils/serialization.py} +640 -616
  11. azure/ai/textanalytics/{_generated/v2022_05_01/aio/_vendor.py → _utils/utils.py} +10 -12
  12. azure/ai/textanalytics/_version.py +8 -7
  13. azure/ai/textanalytics/aio/__init__.py +25 -14
  14. azure/ai/textanalytics/aio/_client.py +115 -0
  15. azure/ai/textanalytics/aio/_configuration.py +75 -0
  16. azure/ai/textanalytics/{_generated/v2022_10_01_preview/aio/operations → aio/_operations}/__init__.py +13 -8
  17. azure/ai/textanalytics/aio/_operations/_operations.py +623 -0
  18. azure/ai/textanalytics/{_generated/v2022_05_01 → aio/_operations}/_patch.py +8 -6
  19. azure/ai/textanalytics/aio/_patch.py +344 -0
  20. azure/ai/textanalytics/models/__init__.py +402 -0
  21. azure/ai/textanalytics/models/_enums.py +1979 -0
  22. azure/ai/textanalytics/models/_models.py +6641 -0
  23. azure/ai/textanalytics/{_generated/v2022_05_01/aio → models}/_patch.py +8 -6
  24. azure/ai/textanalytics/py.typed +1 -0
  25. {azure_ai_textanalytics-5.3.0b1.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info}/METADATA +755 -319
  26. azure_ai_textanalytics-6.0.0b1.dist-info/RECORD +29 -0
  27. {azure_ai_textanalytics-5.3.0b1.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info}/WHEEL +1 -1
  28. azure/ai/textanalytics/_base_client.py +0 -111
  29. azure/ai/textanalytics/_check.py +0 -22
  30. azure/ai/textanalytics/_dict_mixin.py +0 -54
  31. azure/ai/textanalytics/_generated/__init__.py +0 -16
  32. azure/ai/textanalytics/_generated/_configuration.py +0 -70
  33. azure/ai/textanalytics/_generated/_operations_mixin.py +0 -795
  34. azure/ai/textanalytics/_generated/_text_analytics_client.py +0 -126
  35. azure/ai/textanalytics/_generated/_version.py +0 -8
  36. azure/ai/textanalytics/_generated/aio/_configuration.py +0 -66
  37. azure/ai/textanalytics/_generated/aio/_operations_mixin.py +0 -776
  38. azure/ai/textanalytics/_generated/aio/_text_analytics_client.py +0 -124
  39. azure/ai/textanalytics/_generated/models.py +0 -8
  40. azure/ai/textanalytics/_generated/v2022_05_01/__init__.py +0 -20
  41. azure/ai/textanalytics/_generated/v2022_05_01/_configuration.py +0 -72
  42. azure/ai/textanalytics/_generated/v2022_05_01/_text_analytics_client.py +0 -100
  43. azure/ai/textanalytics/_generated/v2022_05_01/_vendor.py +0 -45
  44. azure/ai/textanalytics/_generated/v2022_05_01/aio/__init__.py +0 -20
  45. azure/ai/textanalytics/_generated/v2022_05_01/aio/_configuration.py +0 -71
  46. azure/ai/textanalytics/_generated/v2022_05_01/aio/_text_analytics_client.py +0 -97
  47. azure/ai/textanalytics/_generated/v2022_05_01/aio/operations/__init__.py +0 -18
  48. azure/ai/textanalytics/_generated/v2022_05_01/aio/operations/_patch.py +0 -121
  49. azure/ai/textanalytics/_generated/v2022_05_01/aio/operations/_text_analytics_client_operations.py +0 -603
  50. azure/ai/textanalytics/_generated/v2022_05_01/models/__init__.py +0 -281
  51. azure/ai/textanalytics/_generated/v2022_05_01/models/_models_py3.py +0 -5722
  52. azure/ai/textanalytics/_generated/v2022_05_01/models/_text_analytics_client_enums.py +0 -439
  53. azure/ai/textanalytics/_generated/v2022_05_01/operations/_patch.py +0 -120
  54. azure/ai/textanalytics/_generated/v2022_05_01/operations/_text_analytics_client_operations.py +0 -744
  55. azure/ai/textanalytics/_generated/v2022_10_01_preview/__init__.py +0 -20
  56. azure/ai/textanalytics/_generated/v2022_10_01_preview/_configuration.py +0 -72
  57. azure/ai/textanalytics/_generated/v2022_10_01_preview/_patch.py +0 -19
  58. azure/ai/textanalytics/_generated/v2022_10_01_preview/_text_analytics_client.py +0 -100
  59. azure/ai/textanalytics/_generated/v2022_10_01_preview/_vendor.py +0 -45
  60. azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/__init__.py +0 -20
  61. azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/_configuration.py +0 -71
  62. azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/_patch.py +0 -19
  63. azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/_text_analytics_client.py +0 -97
  64. azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/_vendor.py +0 -27
  65. azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/operations/_patch.py +0 -121
  66. azure/ai/textanalytics/_generated/v2022_10_01_preview/aio/operations/_text_analytics_client_operations.py +0 -603
  67. azure/ai/textanalytics/_generated/v2022_10_01_preview/models/__init__.py +0 -407
  68. azure/ai/textanalytics/_generated/v2022_10_01_preview/models/_models_py3.py +0 -8462
  69. azure/ai/textanalytics/_generated/v2022_10_01_preview/models/_patch.py +0 -72
  70. azure/ai/textanalytics/_generated/v2022_10_01_preview/models/_text_analytics_client_enums.py +0 -730
  71. azure/ai/textanalytics/_generated/v2022_10_01_preview/operations/__init__.py +0 -18
  72. azure/ai/textanalytics/_generated/v2022_10_01_preview/operations/_patch.py +0 -120
  73. azure/ai/textanalytics/_generated/v2022_10_01_preview/operations/_text_analytics_client_operations.py +0 -744
  74. azure/ai/textanalytics/_generated/v3_0/__init__.py +0 -20
  75. azure/ai/textanalytics/_generated/v3_0/_configuration.py +0 -66
  76. azure/ai/textanalytics/_generated/v3_0/_patch.py +0 -31
  77. azure/ai/textanalytics/_generated/v3_0/_text_analytics_client.py +0 -96
  78. azure/ai/textanalytics/_generated/v3_0/_vendor.py +0 -33
  79. azure/ai/textanalytics/_generated/v3_0/aio/__init__.py +0 -20
  80. azure/ai/textanalytics/_generated/v3_0/aio/_configuration.py +0 -65
  81. azure/ai/textanalytics/_generated/v3_0/aio/_patch.py +0 -31
  82. azure/ai/textanalytics/_generated/v3_0/aio/_text_analytics_client.py +0 -93
  83. azure/ai/textanalytics/_generated/v3_0/aio/_vendor.py +0 -27
  84. azure/ai/textanalytics/_generated/v3_0/aio/operations/__init__.py +0 -18
  85. azure/ai/textanalytics/_generated/v3_0/aio/operations/_patch.py +0 -19
  86. azure/ai/textanalytics/_generated/v3_0/aio/operations/_text_analytics_client_operations.py +0 -428
  87. azure/ai/textanalytics/_generated/v3_0/models/__init__.py +0 -81
  88. azure/ai/textanalytics/_generated/v3_0/models/_models_py3.py +0 -1467
  89. azure/ai/textanalytics/_generated/v3_0/models/_patch.py +0 -19
  90. azure/ai/textanalytics/_generated/v3_0/models/_text_analytics_client_enums.py +0 -58
  91. azure/ai/textanalytics/_generated/v3_0/operations/__init__.py +0 -18
  92. azure/ai/textanalytics/_generated/v3_0/operations/_patch.py +0 -19
  93. azure/ai/textanalytics/_generated/v3_0/operations/_text_analytics_client_operations.py +0 -604
  94. azure/ai/textanalytics/_generated/v3_1/__init__.py +0 -20
  95. azure/ai/textanalytics/_generated/v3_1/_configuration.py +0 -66
  96. azure/ai/textanalytics/_generated/v3_1/_patch.py +0 -31
  97. azure/ai/textanalytics/_generated/v3_1/_text_analytics_client.py +0 -98
  98. azure/ai/textanalytics/_generated/v3_1/_vendor.py +0 -45
  99. azure/ai/textanalytics/_generated/v3_1/aio/__init__.py +0 -20
  100. azure/ai/textanalytics/_generated/v3_1/aio/_configuration.py +0 -65
  101. azure/ai/textanalytics/_generated/v3_1/aio/_patch.py +0 -31
  102. azure/ai/textanalytics/_generated/v3_1/aio/_text_analytics_client.py +0 -95
  103. azure/ai/textanalytics/_generated/v3_1/aio/_vendor.py +0 -27
  104. azure/ai/textanalytics/_generated/v3_1/aio/operations/__init__.py +0 -18
  105. azure/ai/textanalytics/_generated/v3_1/aio/operations/_patch.py +0 -19
  106. azure/ai/textanalytics/_generated/v3_1/aio/operations/_text_analytics_client_operations.py +0 -1291
  107. azure/ai/textanalytics/_generated/v3_1/models/__init__.py +0 -205
  108. azure/ai/textanalytics/_generated/v3_1/models/_models_py3.py +0 -3976
  109. azure/ai/textanalytics/_generated/v3_1/models/_patch.py +0 -19
  110. azure/ai/textanalytics/_generated/v3_1/models/_text_analytics_client_enums.py +0 -367
  111. azure/ai/textanalytics/_generated/v3_1/operations/__init__.py +0 -18
  112. azure/ai/textanalytics/_generated/v3_1/operations/_patch.py +0 -19
  113. azure/ai/textanalytics/_generated/v3_1/operations/_text_analytics_client_operations.py +0 -1709
  114. azure/ai/textanalytics/_lro.py +0 -552
  115. azure/ai/textanalytics/_models.py +0 -3142
  116. azure/ai/textanalytics/_policies.py +0 -66
  117. azure/ai/textanalytics/_request_handlers.py +0 -104
  118. azure/ai/textanalytics/_response_handlers.py +0 -580
  119. azure/ai/textanalytics/_text_analytics_client.py +0 -1802
  120. azure/ai/textanalytics/_user_agent.py +0 -8
  121. azure/ai/textanalytics/_validate.py +0 -113
  122. azure/ai/textanalytics/aio/_base_client_async.py +0 -95
  123. azure/ai/textanalytics/aio/_lro_async.py +0 -501
  124. azure/ai/textanalytics/aio/_response_handlers_async.py +0 -94
  125. azure/ai/textanalytics/aio/_text_analytics_client_async.py +0 -1800
  126. azure_ai_textanalytics-5.3.0b1.dist-info/RECORD +0 -115
  127. {azure_ai_textanalytics-5.3.0b1.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info/licenses}/LICENSE +0 -0
  128. {azure_ai_textanalytics-5.3.0b1.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info}/top_level.txt +0 -0
@@ -1,203 +1,32 @@
1
- # ------------------------------------
2
- # Copyright (c) Microsoft Corporation.
3
- # Licensed under the MIT License.
4
- # ------------------------------------
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) Python Code Generator.
6
+ # Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
+ # --------------------------------------------------------------------------
8
+ # pylint: disable=wrong-import-position
5
9
 
6
- from ._text_analytics_client import TextAnalyticsClient
10
+ from typing import TYPE_CHECKING
11
+
12
+ if TYPE_CHECKING:
13
+ from ._patch import * # pylint: disable=unused-wildcard-import
14
+
15
+ from ._client import TextAnalysisClient # type: ignore
7
16
  from ._version import VERSION
8
- from ._base_client import TextAnalyticsApiVersion
9
- from ._models import (
10
- DetectLanguageInput,
11
- TextDocumentInput,
12
- DetectedLanguage,
13
- DocumentError,
14
- CategorizedEntity,
15
- LinkedEntity,
16
- AnalyzeSentimentResult,
17
- RecognizeEntitiesResult,
18
- DetectLanguageResult,
19
- TextAnalyticsError,
20
- TextAnalyticsWarning,
21
- ExtractKeyPhrasesResult,
22
- RecognizeLinkedEntitiesResult,
23
- TextDocumentStatistics,
24
- LinkedEntityMatch,
25
- TextDocumentBatchStatistics,
26
- SentenceSentiment,
27
- SentimentConfidenceScores,
28
- MinedOpinion,
29
- TargetSentiment,
30
- AssessmentSentiment,
31
- RecognizePiiEntitiesResult,
32
- PiiEntity,
33
- PiiEntityDomain,
34
- AnalyzeHealthcareEntitiesResult,
35
- HealthcareEntity,
36
- HealthcareEntityDataSource,
37
- RecognizeEntitiesAction,
38
- RecognizeLinkedEntitiesAction,
39
- RecognizePiiEntitiesAction,
40
- ExtractKeyPhrasesAction,
41
- _AnalyzeActionsType,
42
- HealthcareRelation,
43
- HealthcareRelationRole,
44
- HealthcareEntityAssertion,
45
- AnalyzeSentimentAction,
46
- PiiEntityCategory,
47
- HealthcareEntityRelation,
48
- EntityConditionality,
49
- EntityCertainty,
50
- EntityAssociation,
51
- HealthcareEntityCategory,
52
- RecognizeCustomEntitiesAction,
53
- RecognizeCustomEntitiesResult,
54
- SingleLabelClassifyAction,
55
- MultiLabelClassifyAction,
56
- ClassifyDocumentResult,
57
- ClassificationCategory,
58
- AnalyzeHealthcareEntitiesAction,
59
- TextAnalysisKind,
60
- ExtractSummaryAction,
61
- ExtractSummaryResult,
62
- SummarySentence,
63
- AbstractSummaryResult,
64
- AbstractiveSummary,
65
- SummaryContext,
66
- AbstractSummaryAction,
67
- DynamicClassificationResult,
68
- )
69
- from ._generated.models import (
70
- HealthcareDocumentType,
71
- BaseResolution,
72
- ResolutionKind,
73
- AgeResolution,
74
- AreaResolution,
75
- BooleanResolution,
76
- CurrencyResolution,
77
- DateTimeResolution,
78
- InformationResolution,
79
- LengthResolution,
80
- NumberResolution,
81
- NumericRangeResolution,
82
- OrdinalResolution,
83
- SpeedResolution,
84
- TemperatureResolution,
85
- TemporalSpanResolution,
86
- VolumeResolution,
87
- WeightResolution,
88
- AgeUnit,
89
- AreaUnit,
90
- TemporalModifier,
91
- InformationUnit,
92
- LengthUnit,
93
- NumberKind,
94
- RangeKind,
95
- RelativeTo,
96
- SpeedUnit,
97
- TemperatureUnit,
98
- VolumeUnit,
99
- WeightUnit,
100
- ClassificationType,
101
- DateTimeSubKind,
102
- )
103
- from ._lro import AnalyzeHealthcareEntitiesLROPoller, AnalyzeActionsLROPoller, TextAnalysisLROPoller
17
+
18
+ __version__ = VERSION
19
+
20
+ try:
21
+ from ._patch import __all__ as _patch_all
22
+ from ._patch import *
23
+ except ImportError:
24
+ _patch_all = []
25
+ from ._patch import patch_sdk as _patch_sdk
104
26
 
105
27
  __all__ = [
106
- "TextAnalyticsApiVersion",
107
- "TextAnalyticsClient",
108
- "DetectLanguageInput",
109
- "TextDocumentInput",
110
- "DetectedLanguage",
111
- "RecognizeEntitiesResult",
112
- "DetectLanguageResult",
113
- "CategorizedEntity",
114
- "TextAnalyticsError",
115
- "TextAnalyticsWarning",
116
- "ExtractKeyPhrasesResult",
117
- "RecognizeLinkedEntitiesResult",
118
- "AnalyzeSentimentResult",
119
- "TextDocumentStatistics",
120
- "DocumentError",
121
- "LinkedEntity",
122
- "LinkedEntityMatch",
123
- "TextDocumentBatchStatistics",
124
- "SentenceSentiment",
125
- "SentimentConfidenceScores",
126
- "MinedOpinion",
127
- "TargetSentiment",
128
- "AssessmentSentiment",
129
- "RecognizePiiEntitiesResult",
130
- "PiiEntity",
131
- "PiiEntityDomain",
132
- "AnalyzeHealthcareEntitiesResult",
133
- "HealthcareEntity",
134
- "HealthcareEntityDataSource",
135
- "RecognizeEntitiesAction",
136
- "RecognizeLinkedEntitiesAction",
137
- "RecognizePiiEntitiesAction",
138
- "ExtractKeyPhrasesAction",
139
- "_AnalyzeActionsType",
140
- "PiiEntityCategory",
141
- "HealthcareEntityRelation",
142
- "HealthcareRelation",
143
- "HealthcareRelationRole",
144
- "HealthcareEntityAssertion",
145
- "EntityConditionality",
146
- "EntityCertainty",
147
- "EntityAssociation",
148
- "AnalyzeSentimentAction",
149
- "AnalyzeHealthcareEntitiesLROPoller",
150
- "AnalyzeActionsLROPoller",
151
- "HealthcareEntityCategory",
152
- "RecognizeCustomEntitiesAction",
153
- "RecognizeCustomEntitiesResult",
154
- "SingleLabelClassifyAction",
155
- "MultiLabelClassifyAction",
156
- "ClassifyDocumentResult",
157
- "ClassificationCategory",
158
- "AnalyzeHealthcareEntitiesAction",
159
- "TextAnalysisLROPoller",
160
- "TextAnalysisKind",
161
- "ExtractSummaryAction",
162
- "ExtractSummaryResult",
163
- "SummarySentence",
164
- "HealthcareDocumentType",
165
- "BaseResolution",
166
- "ResolutionKind",
167
- "AgeResolution",
168
- "AreaResolution",
169
- "BooleanResolution",
170
- "CurrencyResolution",
171
- "DateTimeResolution",
172
- "InformationResolution",
173
- "LengthResolution",
174
- "NumberResolution",
175
- "NumericRangeResolution",
176
- "OrdinalResolution",
177
- "SpeedResolution",
178
- "TemperatureResolution",
179
- "TemporalSpanResolution",
180
- "VolumeResolution",
181
- "WeightResolution",
182
- "AgeUnit",
183
- "AreaUnit",
184
- "TemporalModifier",
185
- "InformationUnit",
186
- "LengthUnit",
187
- "NumberKind",
188
- "RangeKind",
189
- "RelativeTo",
190
- "SpeedUnit",
191
- "TemperatureUnit",
192
- "VolumeUnit",
193
- "WeightUnit",
194
- "AbstractSummaryResult",
195
- "AbstractiveSummary",
196
- "SummaryContext",
197
- "AbstractSummaryAction",
198
- "ClassificationType",
199
- "DynamicClassificationResult",
200
- "DateTimeSubKind",
28
+ "TextAnalysisClient",
201
29
  ]
30
+ __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
202
31
 
203
- __version__ = VERSION
32
+ _patch_sdk()
@@ -0,0 +1,111 @@
1
+ # pylint: disable=line-too-long,useless-suppression
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) Python Code Generator.
7
+ # Changes may cause incorrect behavior and will be lost if the code is regenerated.
8
+ # --------------------------------------------------------------------------
9
+
10
+ from copy import deepcopy
11
+ from typing import Any, TYPE_CHECKING, Union
12
+ from typing_extensions import Self
13
+
14
+ from azure.core import PipelineClient
15
+ from azure.core.credentials import AzureKeyCredential
16
+ from azure.core.pipeline import policies
17
+ from azure.core.rest import HttpRequest, HttpResponse
18
+
19
+ from ._configuration import TextAnalysisClientConfiguration
20
+ from ._operations import _TextAnalysisClientOperationsMixin
21
+ from ._utils.serialization import Deserializer, Serializer
22
+
23
+ if TYPE_CHECKING:
24
+ from azure.core.credentials import TokenCredential
25
+
26
+
27
+ class TextAnalysisClient(_TextAnalysisClientOperationsMixin):
28
+ """The language service API is a suite of natural language processing (NLP) skills built with
29
+ best-in-class Microsoft machine learning algorithms. The API can be used to analyze
30
+ unstructured text for tasks such as sentiment analysis, key phrase extraction, language
31
+ detection and question answering. Further documentation can be found in <a
32
+ href=\\"`https://learn.microsoft.com/azure/cognitive-services/language-service/overview\\">https://learn.microsoft.com/azure/cognitive-services/language-service/overview
33
+ <https://learn.microsoft.com/azure/cognitive-services/language-service/overview\\">https://learn.microsoft.com/azure/cognitive-services/language-service/overview>`_</a>.0.
34
+
35
+ :param endpoint: Supported Cognitive Services endpoint (e.g.,
36
+ https://<resource-name>.api.cognitiveservices.azure.com). Required.
37
+ :type endpoint: str
38
+ :param credential: Credential used to authenticate requests to the service. Is either a key
39
+ credential type or a token credential type. Required.
40
+ :type credential: ~azure.core.credentials.AzureKeyCredential or
41
+ ~azure.core.credentials.TokenCredential
42
+ :keyword api_version: The API version to use for this operation. Default value is
43
+ "2025-05-15-preview". Note that overriding this default value may result in unsupported
44
+ behavior.
45
+ :paramtype api_version: str
46
+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
47
+ Retry-After header is present.
48
+ """
49
+
50
+ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
51
+ _endpoint = "{Endpoint}/language"
52
+ self._config = TextAnalysisClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)
53
+
54
+ _policies = kwargs.pop("policies", None)
55
+ if _policies is None:
56
+ _policies = [
57
+ policies.RequestIdPolicy(**kwargs),
58
+ self._config.headers_policy,
59
+ self._config.user_agent_policy,
60
+ self._config.proxy_policy,
61
+ policies.ContentDecodePolicy(**kwargs),
62
+ self._config.redirect_policy,
63
+ self._config.retry_policy,
64
+ self._config.authentication_policy,
65
+ self._config.custom_hook_policy,
66
+ self._config.logging_policy,
67
+ policies.DistributedTracingPolicy(**kwargs),
68
+ policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
69
+ self._config.http_logging_policy,
70
+ ]
71
+ self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
72
+
73
+ self._serialize = Serializer()
74
+ self._deserialize = Deserializer()
75
+ self._serialize.client_side_validation = False
76
+
77
+ def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
78
+ """Runs the network request through the client's chained policies.
79
+
80
+ >>> from azure.core.rest import HttpRequest
81
+ >>> request = HttpRequest("GET", "https://www.example.org/")
82
+ <HttpRequest [GET], url: 'https://www.example.org/'>
83
+ >>> response = client.send_request(request)
84
+ <HttpResponse: 200 OK>
85
+
86
+ For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
87
+
88
+ :param request: The network request you want to make. Required.
89
+ :type request: ~azure.core.rest.HttpRequest
90
+ :keyword bool stream: Whether the response payload will be streamed. Defaults to False.
91
+ :return: The response of your network call. Does not do error handling on your response.
92
+ :rtype: ~azure.core.rest.HttpResponse
93
+ """
94
+
95
+ request_copy = deepcopy(request)
96
+ path_format_arguments = {
97
+ "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
98
+ }
99
+
100
+ request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
101
+ return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
102
+
103
+ def close(self) -> None:
104
+ self._client.close()
105
+
106
+ def __enter__(self) -> Self:
107
+ self._client.__enter__()
108
+ return self
109
+
110
+ def __exit__(self, *exc_details: Any) -> None:
111
+ self._client.__exit__(*exc_details)
@@ -0,0 +1,73 @@
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) Python 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, Union
10
+
11
+ from azure.core.credentials import AzureKeyCredential
12
+ from azure.core.pipeline import policies
13
+
14
+ from ._version import VERSION
15
+
16
+ if TYPE_CHECKING:
17
+ from azure.core.credentials import TokenCredential
18
+
19
+
20
+ class TextAnalysisClientConfiguration: # pylint: disable=too-many-instance-attributes
21
+ """Configuration for TextAnalysisClient.
22
+
23
+ Note that all parameters used to create this instance are saved as instance
24
+ attributes.
25
+
26
+ :param endpoint: Supported Cognitive Services endpoint (e.g.,
27
+ https://<resource-name>.api.cognitiveservices.azure.com). Required.
28
+ :type endpoint: str
29
+ :param credential: Credential used to authenticate requests to the service. Is either a key
30
+ credential type or a token credential type. Required.
31
+ :type credential: ~azure.core.credentials.AzureKeyCredential or
32
+ ~azure.core.credentials.TokenCredential
33
+ :keyword api_version: The API version to use for this operation. Default value is
34
+ "2025-05-15-preview". Note that overriding this default value may result in unsupported
35
+ behavior.
36
+ :paramtype api_version: str
37
+ """
38
+
39
+ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
40
+ api_version: str = kwargs.pop("api_version", "2025-05-15-preview")
41
+
42
+ if endpoint is None:
43
+ raise ValueError("Parameter 'endpoint' must not be None.")
44
+ if credential is None:
45
+ raise ValueError("Parameter 'credential' must not be None.")
46
+
47
+ self.endpoint = endpoint
48
+ self.credential = credential
49
+ self.api_version = api_version
50
+ self.credential_scopes = kwargs.pop("credential_scopes", ["https://cognitiveservices.azure.com/.default"])
51
+ kwargs.setdefault("sdk_moniker", "ai-textanalytics/{}".format(VERSION))
52
+ self.polling_interval = kwargs.get("polling_interval", 30)
53
+ self._configure(**kwargs)
54
+
55
+ def _infer_policy(self, **kwargs):
56
+ if isinstance(self.credential, AzureKeyCredential):
57
+ return policies.AzureKeyCredentialPolicy(self.credential, "Ocp-Apim-Subscription-Key", **kwargs)
58
+ if hasattr(self.credential, "get_token"):
59
+ return policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
60
+ raise TypeError(f"Unsupported credential: {self.credential}")
61
+
62
+ def _configure(self, **kwargs: Any) -> None:
63
+ self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
64
+ self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
65
+ self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
66
+ self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
67
+ self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**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.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs)
71
+ self.authentication_policy = kwargs.get("authentication_policy")
72
+ if self.credential and not self.authentication_policy:
73
+ self.authentication_policy = self._infer_policy(**kwargs)
@@ -2,17 +2,22 @@
2
2
  # --------------------------------------------------------------------------
3
3
  # Copyright (c) Microsoft Corporation. All rights reserved.
4
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.
5
+ # Code generated by Microsoft (R) Python Code Generator.
6
6
  # Changes may cause incorrect behavior and will be lost if the code is regenerated.
7
7
  # --------------------------------------------------------------------------
8
+ # pylint: disable=wrong-import-position
8
9
 
9
- from ._text_analytics_client_operations import TextAnalyticsClientOperationsMixin
10
+ from typing import TYPE_CHECKING
11
+
12
+ if TYPE_CHECKING:
13
+ from ._patch import * # pylint: disable=unused-wildcard-import
14
+
15
+ from ._operations import _TextAnalysisClientOperationsMixin # type: ignore # pylint: disable=unused-import
10
16
 
11
17
  from ._patch import __all__ as _patch_all
12
- from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import
18
+ from ._patch import *
13
19
  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()
20
+
21
+ __all__ = []
22
+ __all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
23
+ _patch_sdk()