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
12 changes: 0 additions & 12 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@
"sdk/storage/azure-storage-queue/**",
"sdk/synapse/azure-synapse/**",
"sdk/synapse/azure-synapse-artifacts/**",
"sdk/translation/azure-ai-translation-document/samples/assets/**",
"sdk/translation/azure-ai-translation-document/doc/**",
"sdk/translation/azure-ai-translation-document/tests/glossaries-valid.csv",
"sdk/storage/azure-storage-blob/**",
"sdk/eventhub/azure-eventhub-checkpointstoreblob/azure/eventhub/extensions/checkpointstoreblob/_vendor/**",
"sdk/eventhub/azure-eventhub-checkpointstoreblob-aio/azure/eventhub/extensions/checkpointstoreblobaio/_vendor/**",
Expand All @@ -119,15 +116,6 @@
"sdk/monitor/azure-monitor-opentelemetry-exporter/samples/traces/django/sample/db.sqlite3",
"sdk/loadtestservice/azure-developer-loadtesting/**",
"sdk/openai/azure-openai/tests/assets/**",
"sdk/translation/azure-ai-translation-text/azure/ai/translation/text/_serialization.py",
"sdk/translation/azure-ai-translation-text/tests/test_break_sentence.py",
"sdk/translation/azure-ai-translation-text/tests/test_translation.py",
"sdk/translation/azure-ai-translation-text/tests/test_transliteration.py",
"sdk/translation/azure-ai-translation-text/tests/test_break_sentence_async.py",
"sdk/translation/azure-ai-translation-text/tests/test_translation_async.py",
"sdk/translation/azure-ai-translation-text/tests/test_transliteration_async.py",
"sdk/translation/azure-ai-translation-text/azure/ai/translation/text/_model_base.py",
Comment thread
jrjrguo marked this conversation as resolved.
"sdk/translation/test-resources.json",
"eng/**/*.json",
"eng/*.txt",
"eng/tox/tox.ini",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -774,16 +774,16 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur

# is it optional?
try:
if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore
if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore # pylint: disable=unidiomatic-typecheck
if len(annotation.__args__) <= 2: # pyright: ignore
if_obj_deserializer = _get_deserialize_callable_from_annotation(
next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore
next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore # pylint: disable=unidiomatic-typecheck
)

return functools.partial(_deserialize_with_optional, if_obj_deserializer)
# the type is Optional[Union[...]], we need to remove the None type from the Union
annotation_copy = copy.copy(annotation)
annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore
annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore # pylint: disable=unidiomatic-typecheck
return _get_deserialize_callable_from_annotation(annotation_copy, module, rf)
except AttributeError:
pass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def deserialize_from_http_generics(cls, body_bytes: Optional[Union[AnyStr, IO]],
class UTC(datetime.tzinfo):
"""Time Zone info for handling UTC"""

def utcoffset(self, dt):
def utcoffset(self, dt): # pylint: disable=unused-argument
"""UTF offset for UTC is 0.

:param datetime.datetime dt: The datetime
Expand All @@ -198,7 +198,7 @@ def utcoffset(self, dt):
"""
return datetime.timedelta(0)

def tzname(self, dt):
def tzname(self, dt): # pylint: disable=unused-argument
"""Timestamp representation.

:param datetime.datetime dt: The datetime
Expand All @@ -207,7 +207,7 @@ def tzname(self, dt):
"""
return "Z"

def dst(self, dt):
def dst(self, dt): # pylint: disable=unused-argument
"""No daylight saving for UTC.

:param datetime.datetime dt: The datetime
Expand All @@ -230,16 +230,16 @@ class _FixedOffset(datetime.tzinfo): # type: ignore
def __init__(self, offset) -> None:
self.__offset = offset

def utcoffset(self, dt):
def utcoffset(self, dt): # pylint: disable=unused-argument
return self.__offset

def tzname(self, dt):
def tzname(self, dt): # pylint: disable=unused-argument
return str(self.__offset.total_seconds() / 3600)

def __repr__(self):
return "<FixedOffset {}>".format(self.tzname(None))

def dst(self, dt):
def dst(self, dt): # pylint: disable=unused-argument
return datetime.timedelta(0)

def __getinitargs__(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@
"azure.ai.translation.text.aio.TextTranslationClient.translate": "TextTranslation.translate",
"azure.ai.translation.text.TextTranslationClient.transliterate": "TextTranslation.transliterate",
"azure.ai.translation.text.aio.TextTranslationClient.transliterate": "TextTranslation.transliterate"
}
},
"CrossLanguageVersion": "83074cc6cb65"
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
# --------------------------------------------------------------------------

from copy import deepcopy
import sys
from typing import Any, Optional, TYPE_CHECKING, Union
from typing_extensions import Self

from azure.core import PipelineClient
from azure.core.credentials import AzureKeyCredential
Expand All @@ -19,6 +19,11 @@
from ._operations import _TextTranslationClientOperationsMixin
from ._utils.serialization import Deserializer, Serializer

if sys.version_info >= (3, 11):
from typing import Self
else:
from typing_extensions import Self # type: ignore

if TYPE_CHECKING:
from azure.core.credentials import TokenCredential

Expand All @@ -36,9 +41,9 @@ class TextTranslationClient(_TextTranslationClientOperationsMixin):
credential type or a token credential type. Default value is None.
:type credential: ~azure.core.credentials.AzureKeyCredential or
~azure.core.credentials.TokenCredential
:keyword api_version: Mandatory API version parameter. Known values are "2026-06-06". Default
value is "2026-06-06". Note that overriding this default value may result in unsupported
behavior.
:keyword api_version: Mandatory API version parameter. Known values are "2026-06-06" and None.
Default value is None. If not set, the operation's default API version will be used. Note that
overriding this default value may result in unsupported behavior.
:paramtype api_version: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ class TextTranslationClientConfiguration: # pylint: disable=too-many-instance-a
credential type or a token credential type. Default value is None.
:type credential: ~azure.core.credentials.AzureKeyCredential or
~azure.core.credentials.TokenCredential
:keyword api_version: Mandatory API version parameter. Known values are "2026-06-06". Default
value is "2026-06-06". Note that overriding this default value may result in unsupported
behavior.
:keyword api_version: Mandatory API version parameter. Known values are "2026-06-06" and None.
Default value is None. If not set, the operation's default API version will be used. Note that
overriding this default value may result in unsupported behavior.
Comment thread
jrjrguo marked this conversation as resolved.
:paramtype api_version: str
"""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def build_text_translation_get_supported_languages_request( # pylint: disable=n
_headers["Accept"] = _SERIALIZER.header("accept", accept, "str")
if_match = prep_if_match(etag, match_condition)
if if_match is not None:
_headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str")
_headers["if-match"] = _SERIALIZER.header("if_match", if_match, "str")
if_none_match = prep_if_none_match(etag, match_condition)
if if_none_match is not None:
_headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""

from collections.abc import MutableMapping
from typing import Any, cast, IO, List, Optional, overload, Union

Expand Down
Loading
Loading