Skip to content

Commit 96c7f09

Browse files
author
SDKAuto
committed
CodeGen from PR 31023 in Azure/azure-rest-api-specs
Merge 71ccd39727cde29ee50d56c7e2b1fff9aacd8c30 into de825aa1e9bc91476240630a2142d42a380de1c9
1 parent df74f95 commit 96c7f09

File tree

57 files changed

+1117
-2860
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1117
-2860
lines changed
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
2-
"commit": "37acfe2967e5e1be1169146ac461eb1875c9476e",
2+
"commit": "b2187aab18f4c58e427bbf9f0551c07a88e0955b",
33
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
44
"typespec_src": "specification/ai/Face",
5-
"@azure-tools/typespec-python": "0.23.8",
6-
"@autorest/python": "6.13.15"
5+
"@azure-tools/typespec-python": "0.38.1"
76
}

sdk/face/azure-ai-vision-face/azure/ai/vision/face/__init__.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,32 @@
55
# Code generated by Microsoft (R) Python Code Generator.
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
89

9-
from ._client import FaceAdministrationClient
10-
from ._patch import FaceClient
11-
from ._patch import FaceSessionClient
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._client import FaceAdministrationClient # type: ignore
16+
from ._client import FaceClient # type: ignore
17+
from ._client import FaceSessionClient # type: ignore
1218
from ._version import VERSION
1319

1420
__version__ = VERSION
1521

16-
22+
try:
23+
from ._patch import __all__ as _patch_all
24+
from ._patch import *
25+
except ImportError:
26+
_patch_all = []
1727
from ._patch import patch_sdk as _patch_sdk
1828

1929
__all__ = [
2030
"FaceAdministrationClient",
2131
"FaceClient",
2232
"FaceSessionClient",
2333
]
24-
34+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
2535

2636
_patch_sdk()

sdk/face/azure-ai-vision-face/azure/ai/vision/face/_client.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ class FaceAdministrationClient:
4242
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example:
4343
https://{resource-name}.cognitiveservices.azure.com). Required.
4444
:type endpoint: str
45-
:param credential: Credential used to authenticate requests to the service. Is either a
46-
AzureKeyCredential type or a TokenCredential type. Required.
45+
:param credential: Credential used to authenticate requests to the service. Is either a key
46+
credential type or a token credential type. Required.
4747
:type credential: ~azure.core.credentials.AzureKeyCredential or
4848
~azure.core.credentials.TokenCredential
49-
:keyword api_version: API Version. Known values are "v1.2-preview.1" and None. Default value is
50-
"v1.2-preview.1". Note that overriding this default value may result in unsupported behavior.
49+
:keyword api_version: API Version. Known values are "v1.2" and None. Default value is "v1.2".
50+
Note that overriding this default value may result in unsupported behavior.
5151
:paramtype api_version: str or ~azure.ai.vision.face.models.Versions
5252
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
5353
Retry-After header is present.
@@ -127,12 +127,12 @@ class FaceClient(FaceClientOperationsMixin):
127127
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example:
128128
https://{resource-name}.cognitiveservices.azure.com). Required.
129129
:type endpoint: str
130-
:param credential: Credential used to authenticate requests to the service. Is either a
131-
AzureKeyCredential type or a TokenCredential type. Required.
130+
:param credential: Credential used to authenticate requests to the service. Is either a key
131+
credential type or a token credential type. Required.
132132
:type credential: ~azure.core.credentials.AzureKeyCredential or
133133
~azure.core.credentials.TokenCredential
134-
:keyword api_version: API Version. Known values are "v1.2-preview.1" and None. Default value is
135-
"v1.2-preview.1". Note that overriding this default value may result in unsupported behavior.
134+
:keyword api_version: API Version. Known values are "v1.2" and None. Default value is "v1.2".
135+
Note that overriding this default value may result in unsupported behavior.
136136
:paramtype api_version: str or ~azure.ai.vision.face.models.Versions
137137
"""
138138

@@ -206,12 +206,12 @@ class FaceSessionClient(FaceSessionClientOperationsMixin):
206206
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example:
207207
https://{resource-name}.cognitiveservices.azure.com). Required.
208208
:type endpoint: str
209-
:param credential: Credential used to authenticate requests to the service. Is either a
210-
AzureKeyCredential type or a TokenCredential type. Required.
209+
:param credential: Credential used to authenticate requests to the service. Is either a key
210+
credential type or a token credential type. Required.
211211
:type credential: ~azure.core.credentials.AzureKeyCredential or
212212
~azure.core.credentials.TokenCredential
213-
:keyword api_version: API Version. Known values are "v1.2-preview.1" and None. Default value is
214-
"v1.2-preview.1". Note that overriding this default value may result in unsupported behavior.
213+
:keyword api_version: API Version. Known values are "v1.2" and None. Default value is "v1.2".
214+
Note that overriding this default value may result in unsupported behavior.
215215
:paramtype api_version: str or ~azure.ai.vision.face.models.Versions
216216
"""
217217

sdk/face/azure-ai-vision-face/azure/ai/vision/face/_configuration.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,17 @@ class FaceAdministrationClientConfiguration: # pylint: disable=too-many-instanc
2626
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example:
2727
https://{resource-name}.cognitiveservices.azure.com). Required.
2828
:type endpoint: str
29-
:param credential: Credential used to authenticate requests to the service. Is either a
30-
AzureKeyCredential type or a TokenCredential type. Required.
29+
:param credential: Credential used to authenticate requests to the service. Is either a key
30+
credential type or a token credential type. Required.
3131
:type credential: ~azure.core.credentials.AzureKeyCredential or
3232
~azure.core.credentials.TokenCredential
33-
:keyword api_version: API Version. Known values are "v1.2-preview.1" and None. Default value is
34-
"v1.2-preview.1". Note that overriding this default value may result in unsupported behavior.
33+
:keyword api_version: API Version. Known values are "v1.2" and None. Default value is "v1.2".
34+
Note that overriding this default value may result in unsupported behavior.
3535
:paramtype api_version: str or ~azure.ai.vision.face.models.Versions
3636
"""
3737

3838
def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
39-
api_version: str = kwargs.pop("api_version", "v1.2-preview.1")
39+
api_version: str = kwargs.pop("api_version", "v1.2")
4040

4141
if endpoint is None:
4242
raise ValueError("Parameter 'endpoint' must not be None.")
@@ -81,17 +81,17 @@ class FaceClientConfiguration: # pylint: disable=too-many-instance-attributes
8181
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example:
8282
https://{resource-name}.cognitiveservices.azure.com). Required.
8383
:type endpoint: str
84-
:param credential: Credential used to authenticate requests to the service. Is either a
85-
AzureKeyCredential type or a TokenCredential type. Required.
84+
:param credential: Credential used to authenticate requests to the service. Is either a key
85+
credential type or a token credential type. Required.
8686
:type credential: ~azure.core.credentials.AzureKeyCredential or
8787
~azure.core.credentials.TokenCredential
88-
:keyword api_version: API Version. Known values are "v1.2-preview.1" and None. Default value is
89-
"v1.2-preview.1". Note that overriding this default value may result in unsupported behavior.
88+
:keyword api_version: API Version. Known values are "v1.2" and None. Default value is "v1.2".
89+
Note that overriding this default value may result in unsupported behavior.
9090
:paramtype api_version: str or ~azure.ai.vision.face.models.Versions
9191
"""
9292

9393
def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
94-
api_version: str = kwargs.pop("api_version", "v1.2-preview.1")
94+
api_version: str = kwargs.pop("api_version", "v1.2")
9595

9696
if endpoint is None:
9797
raise ValueError("Parameter 'endpoint' must not be None.")
@@ -136,17 +136,17 @@ class FaceSessionClientConfiguration: # pylint: disable=too-many-instance-attri
136136
:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example:
137137
https://{resource-name}.cognitiveservices.azure.com). Required.
138138
:type endpoint: str
139-
:param credential: Credential used to authenticate requests to the service. Is either a
140-
AzureKeyCredential type or a TokenCredential type. Required.
139+
:param credential: Credential used to authenticate requests to the service. Is either a key
140+
credential type or a token credential type. Required.
141141
:type credential: ~azure.core.credentials.AzureKeyCredential or
142142
~azure.core.credentials.TokenCredential
143-
:keyword api_version: API Version. Known values are "v1.2-preview.1" and None. Default value is
144-
"v1.2-preview.1". Note that overriding this default value may result in unsupported behavior.
143+
:keyword api_version: API Version. Known values are "v1.2" and None. Default value is "v1.2".
144+
Note that overriding this default value may result in unsupported behavior.
145145
:paramtype api_version: str or ~azure.ai.vision.face.models.Versions
146146
"""
147147

148148
def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
149-
api_version: str = kwargs.pop("api_version", "v1.2-preview.1")
149+
api_version: str = kwargs.pop("api_version", "v1.2")
150150

151151
if endpoint is None:
152152
raise ValueError("Parameter 'endpoint' must not be None.")

sdk/face/azure-ai-vision-face/azure/ai/vision/face/_model_base.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Licensed under the MIT License. See License.txt in the project root for
66
# license information.
77
# --------------------------------------------------------------------------
8-
# pylint: disable=protected-access, arguments-differ, signature-differs, broad-except, too-many-lines
8+
# pylint: disable=protected-access, broad-except
99

1010
import copy
1111
import calendar
@@ -574,7 +574,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None:
574574
def copy(self) -> "Model":
575575
return Model(self.__dict__)
576576

577-
def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: # pylint: disable=unused-argument
577+
def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self:
578578
if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated:
579579
# we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping',
580580
# 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object'
@@ -585,8 +585,8 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: # pylint: di
585585
annotations = {
586586
k: v
587587
for mro_class in mros
588-
if hasattr(mro_class, "__annotations__") # pylint: disable=no-member
589-
for k, v in mro_class.__annotations__.items() # pylint: disable=no-member
588+
if hasattr(mro_class, "__annotations__")
589+
for k, v in mro_class.__annotations__.items()
590590
}
591591
for attr, rf in attr_to_rest_field.items():
592592
rf._module = cls.__module__
@@ -601,8 +601,8 @@ def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: # pylint: di
601601

602602
def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None:
603603
for base in cls.__bases__:
604-
if hasattr(base, "__mapping__"): # pylint: disable=no-member
605-
base.__mapping__[discriminator or cls.__name__] = cls # type: ignore # pylint: disable=no-member
604+
if hasattr(base, "__mapping__"):
605+
base.__mapping__[discriminator or cls.__name__] = cls # type: ignore
606606

607607
@classmethod
608608
def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]:
@@ -613,7 +613,7 @@ def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField
613613

614614
@classmethod
615615
def _deserialize(cls, data, exist_discriminators):
616-
if not hasattr(cls, "__mapping__"): # pylint: disable=no-member
616+
if not hasattr(cls, "__mapping__"):
617617
return cls(data)
618618
discriminator = cls._get_discriminator(exist_discriminators)
619619
if discriminator is None:
@@ -633,7 +633,7 @@ def _deserialize(cls, data, exist_discriminators):
633633
discriminator_value = data.find(xml_name).text # pyright: ignore
634634
else:
635635
discriminator_value = data.get(discriminator._rest_name)
636-
mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member
636+
mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore
637637
return mapped_cls._deserialize(data, exist_discriminators)
638638

639639
def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.Any]:
@@ -754,7 +754,7 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur
754754
except AttributeError:
755755
model_name = annotation
756756
if module is not None:
757-
annotation = _get_model(module, model_name)
757+
annotation = _get_model(module, model_name) # type: ignore
758758

759759
try:
760760
if module and _is_model(annotation):
@@ -894,6 +894,22 @@ def _deserialize(
894894
return _deserialize_with_callable(deserializer, value)
895895

896896

897+
def _failsafe_deserialize(
898+
deserializer: typing.Any,
899+
value: typing.Any,
900+
module: typing.Optional[str] = None,
901+
rf: typing.Optional["_RestField"] = None,
902+
format: typing.Optional[str] = None,
903+
) -> typing.Any:
904+
try:
905+
return _deserialize(deserializer, value, module, rf, format)
906+
except DeserializationError:
907+
_LOGGER.warning(
908+
"Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True
909+
)
910+
return None
911+
912+
897913
class _RestField:
898914
def __init__(
899915
self,

0 commit comments

Comments
 (0)