forked from Azure/azure-sdk-for-python
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[textanalytics] feature/ta-language-beta (Azure#24195)
* [textanalytics] regenerate ta 2022-03-01-preview (Azure#23758) * regenerate ta 2022-03-01-preview * add back v3.2-preview.2 to uncomplicate things for now * [textanalytics] use language API for analyze text operations (Azure#23814) * language api compat code changes * use language api for sync/async detect_language * use language api for sync/async recognize_entities * use language api for sync/async recognize_pii_entities * use language api for sync/async recognize_linked_entities * use language api for sync/async extract_key_phrases * use language api for sync/async analyze_sentiment * add recordings * [textanalytics] map language API to actions (Azure#24149) * initial work, not all tests passing * fixes for tests and recordings * fix import * fix pylint * skip missed tests affected by modelVersion service bug * add healthcare entities mapping to language + tests/recordings * lint
- Loading branch information
1 parent
3bd0bc3
commit ffdee53
Showing
719 changed files
with
211,526 additions
and
41,173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
sdk/textanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_check.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# pylint: disable=too-many-lines | ||
# ------------------------------------ | ||
# Copyright (c) Microsoft Corporation. | ||
# Licensed under the MIT License. | ||
# ------------------------------------ | ||
|
||
import re | ||
|
||
|
||
def is_language_api(api_version): | ||
"""Language API is date-based | ||
""" | ||
return re.search(r'\d{4}-\d{2}-\d{2}', api_version) |
205 changes: 179 additions & 26 deletions
205
...xtanalytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/_operations_mixin.py
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
200 changes: 175 additions & 25 deletions
200
...alytics/azure-ai-textanalytics/azure/ai/textanalytics/_generated/aio/_operations_mixin.py
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
.../azure-ai-textanalytics/azure/ai/textanalytics/_generated/v2022_03_01_preview/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# Code generated by Microsoft (R) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
from ._text_analytics_client import TextAnalyticsClient | ||
__all__ = ['TextAnalyticsClient'] | ||
|
||
# `._patch.py` is used for handwritten extensions to the generated code | ||
# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md | ||
from ._patch import patch_sdk | ||
patch_sdk() |
75 changes: 75 additions & 0 deletions
75
...-ai-textanalytics/azure/ai/textanalytics/_generated/v2022_03_01_preview/_configuration.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# coding=utf-8 | ||
# -------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# Code generated by Microsoft (R) AutoRest Code Generator. | ||
# Changes may cause incorrect behavior and will be lost if the code is regenerated. | ||
# -------------------------------------------------------------------------- | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
from azure.core.configuration import Configuration | ||
from azure.core.pipeline import policies | ||
|
||
if TYPE_CHECKING: | ||
# pylint: disable=unused-import,ungrouped-imports | ||
from typing import Any | ||
|
||
from azure.core.credentials import TokenCredential | ||
|
||
VERSION = "unknown" | ||
|
||
class TextAnalyticsClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes | ||
"""Configuration for TextAnalyticsClient. | ||
Note that all parameters used to create this instance are saved as instance | ||
attributes. | ||
:param credential: Credential needed for the client to connect to Azure. | ||
:type credential: ~azure.core.credentials.TokenCredential | ||
:param endpoint: Supported Cognitive Services endpoint (e.g., | ||
https://:code:`<resource-name>`.api.cognitiveservices.azure.com). | ||
:type endpoint: str | ||
:keyword api_version: Api Version. The default value is "2022-03-01-preview". Note that | ||
overriding this default value may result in unsupported behavior. | ||
:paramtype api_version: str | ||
""" | ||
|
||
def __init__( | ||
self, | ||
credential, # type: "TokenCredential" | ||
endpoint, # type: str | ||
**kwargs # type: Any | ||
): | ||
# type: (...) -> None | ||
super(TextAnalyticsClientConfiguration, self).__init__(**kwargs) | ||
api_version = kwargs.pop('api_version', "2022-03-01-preview") # type: str | ||
|
||
if credential is None: | ||
raise ValueError("Parameter 'credential' must not be None.") | ||
if endpoint is None: | ||
raise ValueError("Parameter 'endpoint' must not be None.") | ||
|
||
self.credential = credential | ||
self.endpoint = endpoint | ||
self.api_version = api_version | ||
self.credential_scopes = kwargs.pop('credential_scopes', ['https://cognitiveservices.azure.com/.default']) | ||
kwargs.setdefault('sdk_moniker', 'ai-textanalytics/{}'.format(VERSION)) | ||
self._configure(**kwargs) | ||
|
||
def _configure( | ||
self, | ||
**kwargs # type: Any | ||
): | ||
# type: (...) -> None | ||
self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) | ||
self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) | ||
self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) | ||
self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) | ||
self.http_logging_policy = kwargs.get('http_logging_policy') or policies.HttpLoggingPolicy(**kwargs) | ||
self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) | ||
self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) | ||
self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) | ||
self.authentication_policy = kwargs.get('authentication_policy') | ||
if self.credential and not self.authentication_policy: | ||
self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) |
Oops, something went wrong.