Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/textanalytics/azure-ai-textanalytics/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ Social Security Numbers, bank account information, credit card numbers, and more

```python
from azure.core.credentials import AzureKeyCredential
from azure.ai.textanalytics import TextAnalyticsClient, ApiVersion
from azure.ai.textanalytics import TextAnalyticsClient

credential = AzureKeyCredential("<api_key>")
endpoint="https://<region>.api.cognitive.microsoft.com/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from ._text_analytics_client import TextAnalyticsClient
from ._version import VERSION
from ._base_client import ApiVersion
from ._base_client import TextAnalyticsApiVersion
from ._models import (
DetectLanguageInput,
TextDocumentInput,
Expand Down Expand Up @@ -34,7 +34,7 @@
)

__all__ = [
'ApiVersion',
'TextAnalyticsApiVersion',
'TextAnalyticsClient',
'DetectLanguageInput',
'TextDocumentInput',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from ._policies import TextAnalyticsResponseHookPolicy
from ._user_agent import USER_AGENT

class ApiVersion(str, Enum):
class TextAnalyticsApiVersion(str, Enum):
"""Text Analytics API versions supported by this package"""

#: this is the default version
Expand All @@ -36,7 +36,7 @@ def __init__(self, endpoint, credential, **kwargs):
self._client = _TextAnalyticsClient(
endpoint=endpoint,
credential=credential,
api_version=kwargs.pop("api_version", ApiVersion.V3_1_PREVIEW_1),
api_version=kwargs.pop("api_version", TextAnalyticsApiVersion.V3_1_PREVIEW_1),
sdk_moniker=USER_AGENT,
authentication_policy=_authentication_policy(credential),
custom_hook_policy=TextAnalyticsResponseHookPolicy(**kwargs),
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class TextAnalyticsClient(TextAnalyticsClientBase):
Defaults to "en".
:keyword api_version: The API version of the service to use for requests. It defaults to the
latest service version. Setting to an older version may result in reduced feature compatibility.
:paramtype api_version: str or ~azure.ai.textanalytics.ApiVersion
:paramtype api_version: str or ~azure.ai.textanalytics.TextAnalyticsApiVersion

.. admonition:: Example:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from .._generated.aio import TextAnalyticsClient as _TextAnalyticsClient
from .._policies import TextAnalyticsResponseHookPolicy
from .._user_agent import USER_AGENT
from .._base_client import ApiVersion
from .._base_client import TextAnalyticsApiVersion


def _authentication_policy(credential):
Expand All @@ -31,7 +31,7 @@ def __init__(self, endpoint, credential, **kwargs):
self._client = _TextAnalyticsClient(
endpoint=endpoint,
credential=credential,
api_version=kwargs.pop("api_version", ApiVersion.V3_1_PREVIEW_1),
api_version=kwargs.pop("api_version", TextAnalyticsApiVersion.V3_1_PREVIEW_1),
sdk_moniker=USER_AGENT,
authentication_policy=_authentication_policy(credential),
custom_hook_policy=TextAnalyticsResponseHookPolicy(**kwargs),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class TextAnalyticsClient(AsyncTextAnalyticsClientBase):
Defaults to "en".
:keyword api_version: The API version of the service to use for requests. It defaults to the
latest service version. Setting to an older version may result in reduced feature compatibility.
:paramtype api_version: str or ~azure.ai.textanalytics.ApiVersion
:paramtype api_version: str or ~azure.ai.textanalytics.TextAnalyticsApiVersion

.. admonition:: Example:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class AnalyzeSentimentWithOpinionMiningSampleAsync(object):
async def analyze_sentiment_with_opinion_mining(self):
from azure.core.credentials import AzureKeyCredential
from azure.ai.textanalytics.aio import TextAnalyticsClient
from azure.ai.textanalytics import ApiVersion

endpoint = os.environ["AZURE_TEXT_ANALYTICS_ENDPOINT"]
key = os.environ["AZURE_TEXT_ANALYTICS_KEY"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class RecognizePiiEntitiesSampleAsync(object):
async def recognize_pii_entities_async(self):
# [START recognize_pii_entities_async]
from azure.core.credentials import AzureKeyCredential
from azure.ai.textanalytics import ApiVersion
from azure.ai.textanalytics.aio import TextAnalyticsClient

endpoint = os.environ["AZURE_TEXT_ANALYTICS_ENDPOINT"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
class AnalyzeSentimentWithOpinionMiningSample(object):
def sample_analyze_sentiment_with_opinion_mining(self):
from azure.core.credentials import AzureKeyCredential
from azure.ai.textanalytics import TextAnalyticsClient, ApiVersion
from azure.ai.textanalytics import TextAnalyticsClient

endpoint = os.environ["AZURE_TEXT_ANALYTICS_ENDPOINT"]
key = os.environ["AZURE_TEXT_ANALYTICS_KEY"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class RecognizePiiEntitiesSample(object):
def recognize_pii_entities(self):
# [START recognize_pii_entities]
from azure.core.credentials import AzureKeyCredential
from azure.ai.textanalytics import TextAnalyticsClient, ApiVersion
from azure.ai.textanalytics import TextAnalyticsClient

endpoint = os.environ["AZURE_TEXT_ANALYTICS_ENDPOINT"]
key = os.environ["AZURE_TEXT_ANALYTICS_KEY"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
TextAnalyticsClient,
TextDocumentInput,
VERSION,
ApiVersion
TextAnalyticsApiVersion
)

# pre-apply the client_cls positional argument so it needn't be explicitly passed below
Expand Down Expand Up @@ -659,7 +659,7 @@ def test_opinion_mining_no_mined_opinions(self, client):
assert not document.sentences[0].mined_opinions

@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer(client_kwargs={"api_version": ApiVersion.V3_0})
@TextAnalyticsClientPreparer(client_kwargs={"api_version": TextAnalyticsApiVersion.V3_0})
def test_opinion_mining_v3(self, client):
with pytest.raises(NotImplementedError) as excinfo:
client.analyze_sentiment(["will fail"], show_opinion_mining=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
VERSION,
DetectLanguageInput,
TextDocumentInput,
ApiVersion
TextAnalyticsApiVersion
)

from testcase import GlobalTextAnalyticsAccountPreparer
Expand Down Expand Up @@ -675,7 +675,7 @@ async def test_opinion_mining_no_mined_opinions(self, client):
assert not document.sentences[0].mined_opinions

@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer(client_kwargs={"api_version": ApiVersion.V3_0})
@TextAnalyticsClientPreparer(client_kwargs={"api_version": TextAnalyticsApiVersion.V3_0})
async def test_opinion_mining_v3(self, client):
with pytest.raises(NotImplementedError) as excinfo:
await client.analyze_sentiment(["will fail"], show_opinion_mining=True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# ------------------------------------
import functools
from azure.core.credentials import AzureKeyCredential
from azure.ai.textanalytics import TextAnalyticsClient, ApiVersion
from azure.ai.textanalytics import TextAnalyticsClient, TextAnalyticsApiVersion
from testcase import TextAnalyticsTest, GlobalTextAnalyticsAccountPreparer
from testcase import TextAnalyticsClientPreparer as _TextAnalyticsClientPreparer

Expand All @@ -19,11 +19,11 @@ def test_default_api_version(self, client):
assert "v3.1-preview.1" in client._client._client._base_url

@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer(client_kwargs={"api_version": ApiVersion.V3_0})
@TextAnalyticsClientPreparer(client_kwargs={"api_version": TextAnalyticsApiVersion.V3_0})
def test_v3_0_api_version(self, client):
assert "v3.0" in client._client._client._base_url

@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer(client_kwargs={"api_version": ApiVersion.V3_1_PREVIEW_1})
@TextAnalyticsClientPreparer(client_kwargs={"api_version": TextAnalyticsApiVersion.V3_1_PREVIEW_1})
def test_v3_1_preview_1_api_version(self, client):
assert "v3.1-preview.1" in client._client._client._base_url
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Licensed under the MIT License.
# ------------------------------------
import functools
from azure.ai.textanalytics import ApiVersion
from azure.ai.textanalytics import TextAnalyticsApiVersion
from azure.ai.textanalytics.aio import TextAnalyticsClient
from testcase import TextAnalyticsTest, GlobalTextAnalyticsAccountPreparer
from testcase import TextAnalyticsClientPreparer as _TextAnalyticsClientPreparer
Expand All @@ -19,11 +19,11 @@ def test_default_api_version(self, client):
assert "v3.1-preview.1" in client._client._client._base_url

@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer(client_kwargs={"api_version": ApiVersion.V3_0})
@TextAnalyticsClientPreparer(client_kwargs={"api_version": TextAnalyticsApiVersion.V3_0})
def test_v3_0_api_version(self, client):
assert "v3.0" in client._client._client._base_url

@GlobalTextAnalyticsAccountPreparer()
@TextAnalyticsClientPreparer(client_kwargs={"api_version": ApiVersion.V3_1_PREVIEW_1})
@TextAnalyticsClientPreparer(client_kwargs={"api_version": TextAnalyticsApiVersion.V3_1_PREVIEW_1})
def test_v3_1_preview_1_api_version(self, client):
assert "v3.1-preview.1" in client._client._client._base_url
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from azure.ai.textanalytics import (
TextDocumentInput,
VERSION,
ApiVersion
)

# pre-apply the client_cls positional argument so it needn't be explicitly passed below
Expand Down