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,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-10-01-preview". Note that overriding
32
- this 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-10-01-preview") # 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,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
- """
@@ -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/azure/cognitive-services/language-service/overview">https://docs.microsoft.com/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-10-01-preview". Note that overriding
37
- this 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-10-01-preview". Note that overriding
32
- this 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-10-01-preview") # 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,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
- """
@@ -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/azure/cognitive-services/language-service/overview">https://docs.microsoft.com/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-10-01-preview". Note that overriding
37
- this 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,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,121 +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 Any, Callable, Dict, Optional, TypeVar, Union, cast, List
10
-
11
- from .....aio._lro_async import AsyncAnalyzeActionsLROPoller, AsyncAnalyzeActionsLROPollingMethod
12
- from azure.core.pipeline import PipelineResponse
13
- from azure.core.pipeline.transport import AsyncHttpResponse
14
- from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
15
- from azure.core.rest import HttpRequest
16
- from azure.core.tracing.decorator_async import distributed_trace_async
17
- from azure.core.utils import case_insensitive_dict
18
- from ._text_analytics_client_operations import TextAnalyticsClientOperationsMixin as GeneratedTextAnalyticsClientOperationsMixin
19
-
20
- from ... import models as _models
21
- T = TypeVar('T')
22
- ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
23
-
24
-
25
- class TextAnalyticsClientOperationsMixin(GeneratedTextAnalyticsClientOperationsMixin):
26
-
27
- @distributed_trace_async
28
- async def begin_analyze_text_submit_job(
29
- self,
30
- body: _models.AnalyzeTextJobsInput,
31
- **kwargs: Any
32
- ) -> AsyncAnalyzeActionsLROPoller[_models.AnalyzeTextJobState]:
33
- """Submit text analysis job.
34
-
35
- Submit a collection of text documents for analysis. Specify one or more unique tasks to be
36
- executed as a long-running operation.
37
-
38
- :param body: Collection of documents to analyze and one or more tasks to execute.
39
- :type body: ~azure.ai.textanalytics.v2022_10_01_preview.models.AnalyzeTextJobsInput
40
- :keyword callable cls: A custom type or function that will be passed the direct response
41
- :keyword str continuation_token: A continuation token to restart a poller from a saved state.
42
- :keyword polling: By default, your polling method will be AsyncAnalyzeActionsLROPollingMethod.
43
- Pass in False for this operation to not poll, or pass in your own initialized polling object
44
- for a personal polling strategy.
45
- :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
46
- :keyword int polling_interval: Default waiting time between two polls for LRO operations if no
47
- Retry-After header is present.
48
- :return: An instance of AsyncAnalyzeActionsLROPoller that returns either AnalyzeTextJobState or
49
- the result of cls(response)
50
- :rtype:
51
- ~.....aio._lro_async.AsyncAnalyzeActionsLROPoller[~azure.ai.textanalytics.v2022_10_01_preview.models.AnalyzeTextJobState]
52
- :raises: ~azure.core.exceptions.HttpResponseError
53
- """
54
-
55
- poller_cls = kwargs.pop("poller_cls", AsyncAnalyzeActionsLROPoller) # Handwritten
56
- _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
57
- _params = case_insensitive_dict(kwargs.pop("params", {}) or {})
58
-
59
- api_version = kwargs.pop('api_version', _params.pop('api-version', "2022-10-01-preview")) # type: str
60
- content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str]
61
- cls = kwargs.pop('cls', None) # type: ClsType[_models.AnalyzeTextJobState]
62
- polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod]
63
- lro_delay = kwargs.pop(
64
- 'polling_interval',
65
- self._config.polling_interval
66
- )
67
- cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
68
- if cont_token is None:
69
- raw_result = await self._analyze_text_submit_job_initial( # type: ignore
70
- body=body,
71
- api_version=api_version,
72
- content_type=content_type,
73
- cls=lambda x,y,z: x,
74
- headers=_headers,
75
- params=_params,
76
- **kwargs
77
- )
78
- kwargs.pop('error_map', None)
79
-
80
- def get_long_running_output(pipeline_response):
81
- deserialized = self._deserialize('AnalyzeTextJobState', pipeline_response)
82
- if cls:
83
- return cls(pipeline_response, deserialized, {})
84
- return deserialized
85
-
86
- path_format_arguments = {
87
- "Endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, 'str', skip_quote=True),
88
- }
89
-
90
- if polling is True:
91
- polling_method = cast(AsyncPollingMethod, AsyncAnalyzeActionsLROPollingMethod(
92
- lro_delay,
93
-
94
- path_format_arguments=path_format_arguments,
95
- **kwargs
96
- )) # type: AsyncPollingMethod
97
- elif polling is False:
98
- polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
99
- else:
100
- polling_method = polling
101
- if cont_token:
102
- return poller_cls.from_continuation_token( # Handwritten
103
- polling_method=polling_method,
104
- continuation_token=cont_token,
105
- client=self._client,
106
- deserialization_callback=get_long_running_output
107
- )
108
- return poller_cls(self._client, raw_result, get_long_running_output, polling_method) # Handwritten
109
-
110
- begin_analyze_text_submit_job.metadata = {'url': "/analyze-text/jobs"} # type: ignore
111
-
112
-
113
- __all__: List[str] = ["TextAnalyticsClientOperationsMixin"] # Add all objects you want publicly available to users at this package level
114
-
115
- def patch_sdk():
116
- """Do not remove from this file.
117
-
118
- `patch_sdk` is a last resort escape hatch that allows you to do customizations
119
- you can't accomplish using the techniques described in
120
- https://aka.ms/azsdk/python/dpcodegen/python/customize
121
- """