Skip to content
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
Expand Up @@ -4,4 +4,4 @@ include azure/ai/documentintelligence/py.typed
recursive-include tests *.py
recursive-include samples *.py *.md
include azure/__init__.py
include azure/ai/__init__.py
include azure/ai/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"commit": "079f70d6f2b754db6b736e117196104efd2dd496",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"typespec_src": "specification/ai/DocumentIntelligence",
"@azure-tools/typespec-python": "0.44.2"
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
DocumentIntelligenceAdministrationClientOperationsMixin,
DocumentIntelligenceClientOperationsMixin,
)
from ._serialization import Deserializer, Serializer
from ._utils.serialization import Deserializer, Serializer

if TYPE_CHECKING:
from azure.core.credentials import TokenCredential
Expand All @@ -34,8 +34,8 @@ class DocumentIntelligenceClient(DocumentIntelligenceClientOperationsMixin):

:param endpoint: The Document Intelligence service endpoint. Required.
:type endpoint: str
:param credential: Credential used to authenticate requests to the service. Is either a
AzureKeyCredential type or a TokenCredential type. Required.
:param credential: Credential used to authenticate requests to the service. Is either a key
credential type or a token credential 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-11-30".
Expand All @@ -48,6 +48,7 @@ class DocumentIntelligenceClient(DocumentIntelligenceClientOperationsMixin):
def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
_endpoint = "{endpoint}/documentintelligence"
self._config = DocumentIntelligenceClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)

_policies = kwargs.pop("policies", None)
if _policies is None:
_policies = [
Expand Down Expand Up @@ -113,8 +114,8 @@ class DocumentIntelligenceAdministrationClient(DocumentIntelligenceAdministratio

:param endpoint: The Document Intelligence service endpoint. Required.
:type endpoint: str
:param credential: Credential used to authenticate requests to the service. Is either a
AzureKeyCredential type or a TokenCredential type. Required.
:param credential: Credential used to authenticate requests to the service. Is either a key
credential type or a token credential 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-11-30".
Expand All @@ -129,6 +130,7 @@ def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCr
self._config = DocumentIntelligenceAdministrationClientConfiguration(
endpoint=endpoint, credential=credential, **kwargs
)

_policies = kwargs.pop("policies", None)
if _policies is None:
_policies = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# pylint: disable=line-too-long,useless-suppression
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
Expand Down Expand Up @@ -25,8 +26,8 @@ class DocumentIntelligenceClientConfiguration: # pylint: disable=too-many-insta
:param endpoint: The Document Intelligence service endpoint. Required.
:type endpoint: str
:param credential: Credential used to authenticate requests to the service. Is either a
AzureKeyCredential type or a TokenCredential type. Required.
:param credential: Credential used to authenticate requests to the service. Is either a key
credential type or a token credential 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-11-30".
Expand Down Expand Up @@ -79,8 +80,8 @@ class DocumentIntelligenceAdministrationClientConfiguration: # pylint: disable=
:param endpoint: The Document Intelligence service endpoint. Required.
:type endpoint: str
:param credential: Credential used to authenticate requests to the service. Is either a
AzureKeyCredential type or a TokenCredential type. Required.
:param credential: Credential used to authenticate requests to the service. Is either a key
credential type or a token credential 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-11-30".
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
# Code generated by Microsoft (R) Python Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from collections.abc import MutableMapping
from io import IOBase
import json
import sys
from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, TypeVar, Union, cast, overload
import urllib.parse

from azure.core import PipelineClient
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
Expand All @@ -31,15 +32,15 @@
from azure.core.utils import case_insensitive_dict

from .. import models as _models
from .._model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize
from .._serialization import Serializer
from .._vendor import DocumentIntelligenceAdministrationClientMixinABC, DocumentIntelligenceClientMixinABC

if sys.version_info >= (3, 9):
from collections.abc import MutableMapping
else:
from typing import MutableMapping # type: ignore
JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
from .._configuration import (
DocumentIntelligenceAdministrationClientConfiguration,
DocumentIntelligenceClientConfiguration,
)
from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize
from .._utils.serialization import Serializer
from .._utils.utils import ClientMixinABC

JSON = MutableMapping[str, Any]
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]

Expand Down Expand Up @@ -745,7 +746,9 @@ def build_document_intelligence_administration_delete_classifier_request( # pyl
return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs)


class DocumentIntelligenceClientOperationsMixin(DocumentIntelligenceClientMixinABC): # pylint: disable=name-too-long
class DocumentIntelligenceClientOperationsMixin( # pylint: disable=name-too-long
ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], DocumentIntelligenceClientConfiguration]
):

def _analyze_document_initial(
self,
Expand Down Expand Up @@ -1069,7 +1072,7 @@ def get_long_running_output(pipeline_response):
"str", response.headers.get("Operation-Location")
)

deserialized = _deserialize(_models.AnalyzeResult, response.json().get("analyzeResult"))
deserialized = _deserialize(_models.AnalyzeResult, response.json().get("analyzeResult", {}))
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
Expand Down Expand Up @@ -1607,7 +1610,7 @@ def get_long_running_output(pipeline_response):
"str", response.headers.get("Operation-Location")
)

deserialized = _deserialize(_models.AnalyzeBatchResult, response.json().get("result"))
deserialized = _deserialize(_models.AnalyzeBatchResult, response.json().get("result", {}))
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
Expand Down Expand Up @@ -1699,7 +1702,7 @@ def prepare_request(next_link=None):

def extract_data(pipeline_response):
deserialized = pipeline_response.http_response.json()
list_of_elem = _deserialize(List[_models.AnalyzeBatchOperation], deserialized["value"])
list_of_elem = _deserialize(List[_models.AnalyzeBatchOperation], deserialized.get("value", []))
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.get("nextLink") or None, iter(list_of_elem)
Expand Down Expand Up @@ -2082,7 +2085,7 @@ def get_long_running_output(pipeline_response):
"str", response.headers.get("Operation-Location")
)

deserialized = _deserialize(_models.AnalyzeResult, response.json().get("analyzeResult"))
deserialized = _deserialize(_models.AnalyzeResult, response.json().get("analyzeResult", {}))
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
Expand Down Expand Up @@ -2112,7 +2115,7 @@ def get_long_running_output(pipeline_response):


class DocumentIntelligenceAdministrationClientOperationsMixin( # pylint: disable=too-many-public-methods,name-too-long
DocumentIntelligenceAdministrationClientMixinABC
ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], DocumentIntelligenceAdministrationClientConfiguration]
):

def _build_document_model_initial(
Expand Down Expand Up @@ -2271,7 +2274,7 @@ def get_long_running_output(pipeline_response):
"str", response.headers.get("Operation-Location")
)

deserialized = _deserialize(_models.DocumentModelDetails, response.json().get("result"))
deserialized = _deserialize(_models.DocumentModelDetails, response.json().get("result", {}))
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
Expand Down Expand Up @@ -2455,7 +2458,7 @@ def get_long_running_output(pipeline_response):
"str", response.headers.get("Operation-Location")
)

deserialized = _deserialize(_models.DocumentModelDetails, response.json().get("result"))
deserialized = _deserialize(_models.DocumentModelDetails, response.json().get("result", {}))
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
Expand Down Expand Up @@ -2783,7 +2786,7 @@ def get_long_running_output(pipeline_response):
"str", response.headers.get("Operation-Location")
)

deserialized = _deserialize(_models.DocumentModelDetails, response.json().get("result"))
deserialized = _deserialize(_models.DocumentModelDetails, response.json().get("result", {}))
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
Expand Down Expand Up @@ -2938,7 +2941,7 @@ def prepare_request(next_link=None):

def extract_data(pipeline_response):
deserialized = pipeline_response.http_response.json()
list_of_elem = _deserialize(List[_models.DocumentModelDetails], deserialized["value"])
list_of_elem = _deserialize(List[_models.DocumentModelDetails], deserialized.get("value", []))
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.get("nextLink") or None, iter(list_of_elem)
Expand Down Expand Up @@ -3202,7 +3205,9 @@ def prepare_request(next_link=None):

def extract_data(pipeline_response):
deserialized = pipeline_response.http_response.json()
list_of_elem = _deserialize(List[_models.DocumentIntelligenceOperationDetails], deserialized["value"])
list_of_elem = _deserialize(
List[_models.DocumentIntelligenceOperationDetails], deserialized.get("value", [])
)
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.get("nextLink") or None, iter(list_of_elem)
Expand Down Expand Up @@ -3381,7 +3386,7 @@ def get_long_running_output(pipeline_response):
"str", response.headers.get("Operation-Location")
)

deserialized = _deserialize(_models.DocumentClassifierDetails, response.json().get("result"))
deserialized = _deserialize(_models.DocumentClassifierDetails, response.json().get("result", {}))
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
Expand Down Expand Up @@ -3715,7 +3720,7 @@ def get_long_running_output(pipeline_response):
"str", response.headers.get("Operation-Location")
)

deserialized = _deserialize(_models.DocumentClassifierDetails, response.json().get("result"))
deserialized = _deserialize(_models.DocumentClassifierDetails, response.json().get("result", {}))
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized
Expand Down Expand Up @@ -3871,7 +3876,7 @@ def prepare_request(next_link=None):

def extract_data(pipeline_response):
deserialized = pipeline_response.http_response.json()
list_of_elem = _deserialize(List[_models.DocumentClassifierDetails], deserialized["value"])
list_of_elem = _deserialize(List[_models.DocumentClassifierDetails], deserialized.get("value", []))
if cls:
list_of_elem = cls(list_of_elem) # type: ignore
return deserialized.get("nextLink") or None, iter(list_of_elem)
Expand Down
Loading