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