Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR azure-ai-documentintelligence] [DI] Add python customizations #9531

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"commit": "d3ecec32b5fa8f10d02dc604ce2585fafd14fadf",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"typespec_src": "specification/ai/DocumentIntelligence",
"@azure-tools/typespec-python": "0.36.5"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,30 @@
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wrong-import-position

from ._patch import DocumentIntelligenceClient
from ._patch import DocumentIntelligenceAdministrationClient
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ._patch import * # pylint: disable=unused-wildcard-import

from ._client import DocumentIntelligenceClient # type: ignore
from ._client import DocumentIntelligenceAdministrationClient # type: ignore
from ._version import VERSION

__version__ = VERSION


from ._patch import AnalyzeDocumentLROPoller
try:
from ._patch import __all__ as _patch_all
from ._patch import *
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk

__all__ = [
"AnalyzeDocumentLROPoller",
"DocumentIntelligenceClient",
"DocumentIntelligenceAdministrationClient",
]
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore

_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,8 @@ class DocumentIntelligenceClient(DocumentIntelligenceClientOperationsMixin):
AzureKeyCredential type or a TokenCredential type. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential or
~azure.core.credentials.TokenCredential
:keyword api_version: The API version to use for this operation. Default value is
"2024-07-31-preview". Note that overriding this default value may result in unsupported
behavior.
:keyword api_version: The API version to use for this operation. Default value is "2024-11-30".
Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
Expand Down Expand Up @@ -118,9 +117,8 @@ class DocumentIntelligenceAdministrationClient(DocumentIntelligenceAdministratio
AzureKeyCredential type or a TokenCredential type. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential or
~azure.core.credentials.TokenCredential
:keyword api_version: The API version to use for this operation. Default value is
"2024-07-31-preview". Note that overriding this default value may result in unsupported
behavior.
:keyword api_version: The API version to use for this operation. Default value is "2024-11-30".
Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ class DocumentIntelligenceClientConfiguration: # pylint: disable=too-many-insta
AzureKeyCredential type or a TokenCredential type. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential or
~azure.core.credentials.TokenCredential
:keyword api_version: The API version to use for this operation. Default value is
"2024-07-31-preview". Note that overriding this default value may result in unsupported
behavior.
:keyword api_version: The API version to use for this operation. Default value is "2024-11-30".
Note that overriding this default value may result in unsupported behavior.
:paramtype api_version: str
"""

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

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

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

if endpoint is None:
raise ValueError("Parameter 'endpoint' must not be None.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
# pylint: disable=protected-access, arguments-differ, signature-differs, broad-except, too-many-lines
# pylint: disable=protected-access, broad-except

import copy
import calendar
Expand Down Expand Up @@ -574,7 +574,7 @@ def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None:
def copy(self) -> "Model":
return Model(self.__dict__)

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

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

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

@classmethod
def _deserialize(cls, data, exist_discriminators):
if not hasattr(cls, "__mapping__"): # pylint: disable=no-member
if not hasattr(cls, "__mapping__"):
return cls(data)
discriminator = cls._get_discriminator(exist_discriminators)
if discriminator is None:
Expand All @@ -633,7 +633,7 @@ def _deserialize(cls, data, exist_discriminators):
discriminator_value = data.find(xml_name).text # pyright: ignore
else:
discriminator_value = data.get(discriminator._rest_name)
mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member
mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore
return mapped_cls._deserialize(data, exist_discriminators)

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

try:
if module and _is_model(annotation):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,23 @@
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
# pylint: disable=wrong-import-position

from ._patch import DocumentIntelligenceClientOperationsMixin
from ._patch import DocumentIntelligenceAdministrationClientOperationsMixin
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ._patch import * # pylint: disable=unused-wildcard-import

from ._operations import DocumentIntelligenceClientOperationsMixin # type: ignore
from ._operations import DocumentIntelligenceAdministrationClientOperationsMixin # type: ignore

from ._patch import __all__ as _patch_all
from ._patch import *
from ._patch import patch_sdk as _patch_sdk

__all__ = [
"DocumentIntelligenceClientOperationsMixin",
"DocumentIntelligenceAdministrationClientOperationsMixin",
]
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
Loading