Skip to content

Commit bb7869e

Browse files
author
SDKAuto
committed
CodeGen from PR 31811 in Azure/azure-rest-api-specs
Merge a3bce4c434c5792943cd9d3a1cd66c19f176b847 into ada2aba3ac674ba632c07571421d64484230289a
1 parent 2510f19 commit bb7869e

Some content is hidden

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

49 files changed

+3472
-3085
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"commit": "1dd73d74c9754a8514f3dee4845bd22226845206",
3+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4+
"typespec_src": "specification/ai/DocumentIntelligence",
5+
"@azure-tools/typespec-python": "0.37.1"
6+
}

sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/__init__.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,30 @@
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 ._patch import DocumentIntelligenceClient
10-
from ._patch import DocumentIntelligenceAdministrationClient
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 DocumentIntelligenceClient # type: ignore
16+
from ._client import DocumentIntelligenceAdministrationClient # type: ignore
1117
from ._version import VERSION
1218

1319
__version__ = VERSION
1420

15-
16-
from ._patch import AnalyzeDocumentLROPoller
21+
try:
22+
from ._patch import __all__ as _patch_all
23+
from ._patch import *
24+
except ImportError:
25+
_patch_all = []
1726
from ._patch import patch_sdk as _patch_sdk
1827

1928
__all__ = [
20-
"AnalyzeDocumentLROPoller",
2129
"DocumentIntelligenceClient",
2230
"DocumentIntelligenceAdministrationClient",
2331
]
32+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
2433

2534
_patch_sdk()

sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_client.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,8 @@ class DocumentIntelligenceClient(DocumentIntelligenceClientOperationsMixin):
3838
AzureKeyCredential type or a TokenCredential type. Required.
3939
:type credential: ~azure.core.credentials.AzureKeyCredential or
4040
~azure.core.credentials.TokenCredential
41-
:keyword api_version: The API version to use for this operation. Default value is
42-
"2024-07-31-preview". Note that overriding this default value may result in unsupported
43-
behavior.
41+
:keyword api_version: The API version to use for this operation. Default value is "2024-11-30".
42+
Note that overriding this default value may result in unsupported behavior.
4443
:paramtype api_version: str
4544
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
4645
Retry-After header is present.
@@ -118,9 +117,8 @@ class DocumentIntelligenceAdministrationClient(DocumentIntelligenceAdministratio
118117
AzureKeyCredential type or a TokenCredential type. Required.
119118
:type credential: ~azure.core.credentials.AzureKeyCredential or
120119
~azure.core.credentials.TokenCredential
121-
:keyword api_version: The API version to use for this operation. Default value is
122-
"2024-07-31-preview". Note that overriding this default value may result in unsupported
123-
behavior.
120+
:keyword api_version: The API version to use for this operation. Default value is "2024-11-30".
121+
Note that overriding this default value may result in unsupported behavior.
124122
:paramtype api_version: str
125123
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
126124
Retry-After header is present.

sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_configuration.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,13 @@ class DocumentIntelligenceClientConfiguration: # pylint: disable=too-many-insta
2929
AzureKeyCredential type or a TokenCredential type. Required.
3030
:type credential: ~azure.core.credentials.AzureKeyCredential or
3131
~azure.core.credentials.TokenCredential
32-
:keyword api_version: The API version to use for this operation. Default value is
33-
"2024-07-31-preview". Note that overriding this default value may result in unsupported
34-
behavior.
32+
:keyword api_version: The API version to use for this operation. Default value is "2024-11-30".
33+
Note that overriding this default value may result in unsupported behavior.
3534
:paramtype api_version: str
3635
"""
3736

3837
def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
39-
api_version: str = kwargs.pop("api_version", "2024-07-31-preview")
38+
api_version: str = kwargs.pop("api_version", "2024-11-30")
4039

4140
if endpoint is None:
4241
raise ValueError("Parameter 'endpoint' must not be None.")
@@ -84,14 +83,13 @@ class DocumentIntelligenceAdministrationClientConfiguration: # pylint: disable=
8483
AzureKeyCredential type or a TokenCredential type. Required.
8584
:type credential: ~azure.core.credentials.AzureKeyCredential or
8685
~azure.core.credentials.TokenCredential
87-
:keyword api_version: The API version to use for this operation. Default value is
88-
"2024-07-31-preview". Note that overriding this default value may result in unsupported
89-
behavior.
86+
:keyword api_version: The API version to use for this operation. Default value is "2024-11-30".
87+
Note that overriding this default value may result in unsupported behavior.
9088
:paramtype api_version: str
9189
"""
9290

9391
def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
94-
api_version: str = kwargs.pop("api_version", "2024-07-31-preview")
92+
api_version: str = kwargs.pop("api_version", "2024-11-30")
9593

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

sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_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,

sdk/documentintelligence/azure-ai-documentintelligence/azure/ai/documentintelligence/_operations/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,23 @@
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 ._patch import DocumentIntelligenceClientOperationsMixin
10-
from ._patch import DocumentIntelligenceAdministrationClientOperationsMixin
10+
from typing import TYPE_CHECKING
1111

12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
1214

15+
from ._operations import DocumentIntelligenceClientOperationsMixin # type: ignore
16+
from ._operations import DocumentIntelligenceAdministrationClientOperationsMixin # type: ignore
17+
18+
from ._patch import __all__ as _patch_all
19+
from ._patch import *
1320
from ._patch import patch_sdk as _patch_sdk
1421

1522
__all__ = [
1623
"DocumentIntelligenceClientOperationsMixin",
1724
"DocumentIntelligenceAdministrationClientOperationsMixin",
1825
]
26+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
1927
_patch_sdk()

0 commit comments

Comments
 (0)