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.

Files changed (128) hide show
  1. azure/ai/textanalytics/__init__.py +26 -193
  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.0b2.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info}/METADATA +668 -403
  26. azure_ai_textanalytics-6.0.0b1.dist-info/RECORD +29 -0
  27. {azure_ai_textanalytics-5.3.0b2.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info}/WHEEL +1 -1
  28. azure/ai/textanalytics/_base_client.py +0 -113
  29. azure/ai/textanalytics/_check.py +0 -22
  30. azure/ai/textanalytics/_dict_mixin.py +0 -57
  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 -405
  68. azure/ai/textanalytics/_generated/v2022_10_01_preview/models/_models_py3.py +0 -8420
  69. azure/ai/textanalytics/_generated/v2022_10_01_preview/models/_patch.py +0 -486
  70. azure/ai/textanalytics/_generated/v2022_10_01_preview/models/_text_analytics_client_enums.py +0 -729
  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 -553
  115. azure/ai/textanalytics/_models.py +0 -3158
  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 -583
  119. azure/ai/textanalytics/_text_analytics_client.py +0 -2081
  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 -98
  123. azure/ai/textanalytics/aio/_lro_async.py +0 -503
  124. azure/ai/textanalytics/aio/_response_handlers_async.py +0 -94
  125. azure/ai/textanalytics/aio/_text_analytics_client_async.py +0 -2077
  126. azure_ai_textanalytics-5.3.0b2.dist-info/RECORD +0 -115
  127. {azure_ai_textanalytics-5.3.0b2.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info/licenses}/LICENSE +0 -0
  128. {azure_ai_textanalytics-5.3.0b2.dist-info → azure_ai_textanalytics-6.0.0b1.dist-info}/top_level.txt +0 -0
@@ -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,66 +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 endpoints (protocol and hostname, for example:
29
- https://westus.api.cognitive.microsoft.com). Required.
30
- :type endpoint: str
31
- """
32
-
33
- def __init__(
34
- self,
35
- credential: "TokenCredential",
36
- endpoint: str,
37
- **kwargs: Any
38
- ) -> None:
39
- super(TextAnalyticsClientConfiguration, self).__init__(**kwargs)
40
- if credential is None:
41
- raise ValueError("Parameter 'credential' must not be None.")
42
- if endpoint is None:
43
- raise ValueError("Parameter 'endpoint' must not be None.")
44
-
45
- self.credential = credential
46
- self.endpoint = endpoint
47
- self.credential_scopes = kwargs.pop('credential_scopes', ['https://cognitiveservices.azure.com/.default'])
48
- kwargs.setdefault('sdk_moniker', 'ai-textanalytics/{}'.format(VERSION))
49
- self._configure(**kwargs)
50
-
51
- def _configure(
52
- self,
53
- **kwargs # type: Any
54
- ):
55
- # type: (...) -> None
56
- self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
57
- self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
58
- self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
59
- self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
60
- self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
61
- self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs)
62
- self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
63
- self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs)
64
- self.authentication_policy = kwargs.get('authentication_policy')
65
- if self.credential and not self.authentication_policy:
66
- self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
@@ -1,31 +0,0 @@
1
- # coding=utf-8
2
- # --------------------------------------------------------------------------
3
- #
4
- # Copyright (c) Microsoft Corporation. All rights reserved.
5
- #
6
- # The MIT License (MIT)
7
- #
8
- # Permission is hereby granted, free of charge, to any person obtaining a copy
9
- # of this software and associated documentation files (the ""Software""), to
10
- # deal in the Software without restriction, including without limitation the
11
- # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12
- # sell copies of the Software, and to permit persons to whom the Software is
13
- # furnished to do so, subject to the following conditions:
14
- #
15
- # The above copyright notice and this permission notice shall be included in
16
- # all copies or substantial portions of the Software.
17
- #
18
- # THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
- # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24
- # IN THE SOFTWARE.
25
- #
26
- # --------------------------------------------------------------------------
27
-
28
- # This file is used for handwritten extensions to the generated code. Example:
29
- # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
30
- def patch_sdk():
31
- pass
@@ -1,96 +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 Text Analytics API is a suite of text analytics web services built with best-in-class
26
- Microsoft machine learning algorithms. The API can be used to analyze unstructured text for
27
- tasks such as sentiment analysis, key phrase extraction and language detection. No training
28
- data is needed to use this API; just bring your text data. This API uses advanced natural
29
- language processing techniques to deliver best in class predictions. Further documentation can
30
- be found in https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview.
31
-
32
- :param credential: Credential needed for the client to connect to Azure. Required.
33
- :type credential: ~azure.core.credentials.TokenCredential
34
- :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example:
35
- https://westus.api.cognitive.microsoft.com). Required.
36
- :type endpoint: str
37
- """
38
-
39
- def __init__(
40
- self,
41
- credential: "TokenCredential",
42
- endpoint: str,
43
- **kwargs: Any
44
- ) -> None:
45
- _endpoint = '{Endpoint}/text/analytics/v3.0'
46
- self._config = TextAnalyticsClientConfiguration(credential=credential, endpoint=endpoint, **kwargs)
47
- self._client = PipelineClient(base_url=_endpoint, config=self._config, **kwargs)
48
-
49
- client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
50
- self._serialize = Serializer(client_models)
51
- self._deserialize = Deserializer(client_models)
52
- self._serialize.client_side_validation = False
53
-
54
-
55
- def _send_request(
56
- self,
57
- request: HttpRequest,
58
- **kwargs: Any
59
- ) -> HttpResponse:
60
- """Runs the network request through the client's chained policies.
61
-
62
- >>> from azure.core.rest import HttpRequest
63
- >>> request = HttpRequest("GET", "https://www.example.org/")
64
- <HttpRequest [GET], url: 'https://www.example.org/'>
65
- >>> response = client._send_request(request)
66
- <HttpResponse: 200 OK>
67
-
68
- For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
69
-
70
- :param request: The network request you want to make. Required.
71
- :type request: ~azure.core.rest.HttpRequest
72
- :keyword bool stream: Whether the response payload will be streamed. Defaults to False.
73
- :return: The response of your network call. Does not do error handling on your response.
74
- :rtype: ~azure.core.rest.HttpResponse
75
- """
76
-
77
- request_copy = deepcopy(request)
78
- path_format_arguments = {
79
- "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
80
- }
81
-
82
- request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
83
- return self._client.send_request(request_copy, **kwargs)
84
-
85
- def close(self):
86
- # type: () -> None
87
- self._client.close()
88
-
89
- def __enter__(self):
90
- # type: () -> TextAnalyticsClient
91
- self._client.__enter__()
92
- return self
93
-
94
- def __exit__(self, *exc_details):
95
- # type: (Any) -> None
96
- self._client.__exit__(*exc_details)
@@ -1,33 +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
- class MixinABC(ABC):
29
- """DO NOT use this class. It is for internal typing use only."""
30
- _client: "PipelineClient"
31
- _config: TextAnalyticsClientConfiguration
32
- _serialize: "Serializer"
33
- _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,65 +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 endpoints (protocol and hostname, for example:
29
- https://westus.api.cognitive.microsoft.com). Required.
30
- :type endpoint: str
31
- """
32
-
33
- def __init__(
34
- self,
35
- credential: "AsyncTokenCredential",
36
- endpoint: str,
37
- **kwargs: Any
38
- ) -> None:
39
- super(TextAnalyticsClientConfiguration, self).__init__(**kwargs)
40
- if credential is None:
41
- raise ValueError("Parameter 'credential' must not be None.")
42
- if endpoint is None:
43
- raise ValueError("Parameter 'endpoint' must not be None.")
44
-
45
- self.credential = credential
46
- self.endpoint = endpoint
47
- self.credential_scopes = kwargs.pop('credential_scopes', ['https://cognitiveservices.azure.com/.default'])
48
- kwargs.setdefault('sdk_moniker', 'ai-textanalytics/{}'.format(VERSION))
49
- self._configure(**kwargs)
50
-
51
- def _configure(
52
- self,
53
- **kwargs: Any
54
- ) -> None:
55
- self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs)
56
- self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs)
57
- self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs)
58
- self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs)
59
- self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs)
60
- self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs)
61
- self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs)
62
- self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs)
63
- self.authentication_policy = kwargs.get('authentication_policy')
64
- if self.credential and not self.authentication_policy:
65
- self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs)
@@ -1,31 +0,0 @@
1
- # coding=utf-8
2
- # --------------------------------------------------------------------------
3
- #
4
- # Copyright (c) Microsoft Corporation. All rights reserved.
5
- #
6
- # The MIT License (MIT)
7
- #
8
- # Permission is hereby granted, free of charge, to any person obtaining a copy
9
- # of this software and associated documentation files (the ""Software""), to
10
- # deal in the Software without restriction, including without limitation the
11
- # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
12
- # sell copies of the Software, and to permit persons to whom the Software is
13
- # furnished to do so, subject to the following conditions:
14
- #
15
- # The above copyright notice and this permission notice shall be included in
16
- # all copies or substantial portions of the Software.
17
- #
18
- # THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23
- # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24
- # IN THE SOFTWARE.
25
- #
26
- # --------------------------------------------------------------------------
27
-
28
- # This file is used for handwritten extensions to the generated code. Example:
29
- # https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md
30
- def patch_sdk():
31
- pass
@@ -1,93 +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 Text Analytics API is a suite of text analytics web services built with best-in-class
26
- Microsoft machine learning algorithms. The API can be used to analyze unstructured text for
27
- tasks such as sentiment analysis, key phrase extraction and language detection. No training
28
- data is needed to use this API; just bring your text data. This API uses advanced natural
29
- language processing techniques to deliver best in class predictions. Further documentation can
30
- be found in https://docs.microsoft.com/en-us/azure/cognitive-services/text-analytics/overview.
31
-
32
- :param credential: Credential needed for the client to connect to Azure. Required.
33
- :type credential: ~azure.core.credentials_async.AsyncTokenCredential
34
- :param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example:
35
- https://westus.api.cognitive.microsoft.com). Required.
36
- :type endpoint: str
37
- """
38
-
39
- def __init__(
40
- self,
41
- credential: "AsyncTokenCredential",
42
- endpoint: str,
43
- **kwargs: Any
44
- ) -> None:
45
- _endpoint = '{Endpoint}/text/analytics/v3.0'
46
- self._config = TextAnalyticsClientConfiguration(credential=credential, endpoint=endpoint, **kwargs)
47
- self._client = AsyncPipelineClient(base_url=_endpoint, config=self._config, **kwargs)
48
-
49
- client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
50
- self._serialize = Serializer(client_models)
51
- self._deserialize = Deserializer(client_models)
52
- self._serialize.client_side_validation = False
53
-
54
-
55
- def _send_request(
56
- self,
57
- request: HttpRequest,
58
- **kwargs: Any
59
- ) -> Awaitable[AsyncHttpResponse]:
60
- """Runs the network request through the client's chained policies.
61
-
62
- >>> from azure.core.rest import HttpRequest
63
- >>> request = HttpRequest("GET", "https://www.example.org/")
64
- <HttpRequest [GET], url: 'https://www.example.org/'>
65
- >>> response = await client._send_request(request)
66
- <AsyncHttpResponse: 200 OK>
67
-
68
- For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
69
-
70
- :param request: The network request you want to make. Required.
71
- :type request: ~azure.core.rest.HttpRequest
72
- :keyword bool stream: Whether the response payload will be streamed. Defaults to False.
73
- :return: The response of your network call. Does not do error handling on your response.
74
- :rtype: ~azure.core.rest.AsyncHttpResponse
75
- """
76
-
77
- request_copy = deepcopy(request)
78
- path_format_arguments = {
79
- "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
80
- }
81
-
82
- request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
83
- return self._client.send_request(request_copy, **kwargs)
84
-
85
- async def close(self) -> None:
86
- await self._client.close()
87
-
88
- async def __aenter__(self) -> "TextAnalyticsClient":
89
- await self._client.__aenter__()
90
- return self
91
-
92
- async def __aexit__(self, *exc_details) -> None:
93
- await self._client.__aexit__(*exc_details)
@@ -1,27 +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 AsyncPipelineClient
18
-
19
- from ..._serialization import Deserializer, Serializer
20
-
21
-
22
- class MixinABC(ABC):
23
- """DO NOT use this class. It is for internal typing use only."""
24
- _client: "AsyncPipelineClient"
25
- _config: TextAnalyticsClientConfiguration
26
- _serialize: "Serializer"
27
- _deserialize: "Deserializer"
@@ -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()
@@ -1,19 +0,0 @@
1
- # ------------------------------------
2
- # Copyright (c) Microsoft Corporation.
3
- # Licensed under the MIT License.
4
- # ------------------------------------
5
- """Customize generated code here.
6
-
7
- Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
8
- """
9
- from typing import List
10
-
11
- __all__: List[str] = [] # Add all objects you want publicly available to users at this package level
12
-
13
- def patch_sdk():
14
- """Do not remove from this file.
15
-
16
- `patch_sdk` is a last resort escape hatch that allows you to do customizations
17
- you can't accomplish using the techniques described in
18
- https://aka.ms/azsdk/python/dpcodegen/python/customize
19
- """