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,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
- "AbstractSummaryAction",
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,95 +0,0 @@
1
- # ------------------------------------
2
- # Copyright (c) Microsoft Corporation.
3
- # Licensed under the MIT License.
4
- # ------------------------------------
5
- from typing import Any, Union
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 .._generated.aio import TextAnalyticsClient as _TextAnalyticsClient
10
- from .._policies import TextAnalyticsResponseHookPolicy, QuotaExceededPolicy
11
- from .._user_agent import USER_AGENT
12
- from .._version import DEFAULT_API_VERSION
13
-
14
-
15
- def _authentication_policy(credential):
16
- authentication_policy = None
17
- if credential is None:
18
- raise ValueError("Parameter 'credential' must not be None.")
19
- if isinstance(credential, AzureKeyCredential):
20
- authentication_policy = AzureKeyCredentialPolicy(
21
- name="Ocp-Apim-Subscription-Key", credential=credential
22
- )
23
- elif credential is not None and not hasattr(credential, "get_token"):
24
- raise TypeError(
25
- "Unsupported credential: {}. Use an instance of AzureKeyCredential "
26
- "or a token credential from azure.identity".format(type(credential))
27
- )
28
- return authentication_policy
29
-
30
-
31
- class AsyncTextAnalyticsClientBase:
32
- def __init__(
33
- self,
34
- endpoint: str,
35
- credential: Union[AzureKeyCredential, AsyncTokenCredential],
36
- **kwargs: Any
37
- ) -> None:
38
- http_logging_policy = HttpLoggingPolicy(**kwargs)
39
- http_logging_policy.allowed_header_names.update(
40
- {
41
- "Operation-Location",
42
- "apim-request-id",
43
- "x-envoy-upstream-service-time",
44
- "Strict-Transport-Security",
45
- "x-content-type-options",
46
- "warn-code",
47
- "warn-agent",
48
- "warn-text",
49
- }
50
- )
51
- http_logging_policy.allowed_query_params.update(
52
- {
53
- "model-version",
54
- "showStats",
55
- "loggingOptOut",
56
- "domain",
57
- "stringIndexType",
58
- "piiCategories",
59
- "$top",
60
- "$skip",
61
- "opinionMining",
62
- "api-version"
63
- }
64
- )
65
- try:
66
- endpoint = endpoint.rstrip("/")
67
- except AttributeError:
68
- raise ValueError("Parameter 'endpoint' must be a string.")
69
- self._api_version = kwargs.pop("api_version", DEFAULT_API_VERSION)
70
- if hasattr(self._api_version, "value"):
71
- self._api_version = self._api_version.value
72
- self._client = _TextAnalyticsClient(
73
- endpoint=endpoint,
74
- credential=credential, # type: ignore
75
- api_version=self._api_version,
76
- sdk_moniker=USER_AGENT,
77
- authentication_policy=kwargs.pop("authentication_policy", _authentication_policy(credential)),
78
- custom_hook_policy=kwargs.pop("custom_hook_policy", TextAnalyticsResponseHookPolicy(**kwargs)),
79
- http_logging_policy=kwargs.pop("http_logging_policy", http_logging_policy),
80
- per_retry_policies=kwargs.get("per_retry_policies", QuotaExceededPolicy()),
81
- **kwargs
82
- )
83
-
84
- async def __aenter__(self) -> "AsyncTextAnalyticsClientBase":
85
- await self._client.__aenter__()
86
- return self
87
-
88
- async def __aexit__(self, *args: "Any") -> None:
89
- await self._client.__aexit__(*args)
90
-
91
- async def close(self) -> None:
92
- """Close sockets opened by the client.
93
- Calling this method is unnecessary when using the client as a context manager.
94
- """
95
- await self._client.__aexit__()