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
@@ -0,0 +1,6 @@
{
"commit": "9458b84485608b75bb0aa3057a951e41102c6f40",
"repository_url": "https://github.com/test-repo-billy/azure-rest-api-specs",
"typespec_src": "specification/ai/HealthInsights/HealthInsights.RadiologyInsights",
"@azure-tools/typespec-python": "0.31.1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,21 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._patch import RadiologyInsightsClient
from ._client import RadiologyInsightsClient
from ._version import VERSION

__version__ = VERSION


try:
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk

__all__ = [
"RadiologyInsightsClient",
]

__all__.extend([p for p in _patch_all if p not in __all__])

_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ class RadiologyInsightsClient(
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-04-01".
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-08-01-preview". 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 @@ -31,13 +31,14 @@ class RadiologyInsightsClientConfiguration: # pylint: disable=too-many-instance
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-04-01".
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-08-01-preview". 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-04-01")
api_version: str = kwargs.pop("api_version", "2024-08-01-preview")

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 @@ -52,7 +52,7 @@ def build_radiology_insights_infer_radiology_insights_request( # pylint: disabl
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-04-01"))
api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-08-01-preview"))
accept = _headers.pop("Accept", "application/json")

# Construct URL
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# pylint: disable=protected-access
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
Expand All @@ -7,264 +6,9 @@

Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
from typing import (
Any,
IO,
Optional,
Dict,
Union,
cast,
overload,
List,
MutableMapping,
TypeVar,
Callable,
TYPE_CHECKING,
) # pylint: disable=line-too-long
from azure.core.credentials import AzureKeyCredential
from azure.core.rest import HttpRequest, HttpResponse
from azure.core.pipeline import PipelineResponse
from azure.core.polling import LROPoller, NoPolling, PollingMethod
from azure.core.polling.base_polling import LROBasePolling
from azure.core.tracing.decorator import distributed_trace
from azure.core.utils import case_insensitive_dict
from typing import List

from . import models as _models
from ._model_base import _deserialize
from ._client import RadiologyInsightsClient as _RadiologyInsightsClient


JSON = MutableMapping[str, Any] # pylint: disable=unsubscriptable-object
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]

if TYPE_CHECKING:
# pylint: disable=unused-import,ungrouped-imports
from azure.core.credentials import TokenCredential


class RadiologyInsightsClient: # pylint: disable=client-accepts-api-version-keyword
"""RadiologyInsightsClient.

:param endpoint: Supported Cognitive Services endpoints (protocol and hostname, for example:
https://westus2.api.cognitive.microsoft.com). Required.
:type endpoint: str
:param credential: Credential used to authenticate requests to the service. Is either a
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-04-01".
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.
"""

def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
self._client = _RadiologyInsightsClient(endpoint=endpoint, credential=credential, **kwargs)

@overload
def begin_infer_radiology_insights(
self,
id: str,
resource: _models.RadiologyInsightsJob,
*,
expand: Optional[List[str]] = None,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.RadiologyInsightsInferenceResult]:
# pylint: disable=line-too-long
"""Create Radiology Insights inference result.

Creates a Radiology Insights inference result with the given request body.

:param id: The unique ID of the inference result. Required.
:type id: str
:param resource: The resource instance. Required.
:type resource: ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob
:keyword expand: Expand the indicated resources into the response. Default value is None.
:paramtype expand: list[str]
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping
:rtype: ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsResult]
:raises ~azure.core.exceptions.HttpResponseError:"""

@overload
def begin_infer_radiology_insights(
self,
id: str,
resource: JSON,
*,
expand: Optional[List[str]] = None,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.RadiologyInsightsInferenceResult]:
# pylint: disable=line-too-long
"""Create Radiology Insights inference result.

Creates a Radiology Insights inference result with the given request body.

:param id: The unique ID of the inference result. Required.
:type id: str
:param resource: The resource instance. Required.
:type resource: JSON
:keyword expand: Expand the indicated resources into the response. Default value is None.
:paramtype expand: list[str]
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping
:rtype: ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult]
:raises ~azure.core.exceptions.HttpResponseError:"""

@overload
def begin_infer_radiology_insights(
self,
id: str,
resource: IO[bytes],
*,
expand: Optional[List[str]] = None,
content_type: str = "application/json",
**kwargs: Any
) -> LROPoller[_models.RadiologyInsightsInferenceResult]:
# pylint: disable=line-too-long
"""Create Radiology Insights inference result.

Creates a Radiology Insights inference result with the given request body.

:param id: The unique ID of the inference result. Required.
:type id: str
:param resource: The resource instance. Required.
:type resource: IO[bytes]
:keyword expand: Expand the indicated resources into the response. Default value is None.
:paramtype expand: list[str]
:keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json".
:paramtype content_type: str
:return: An instance of LROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping
:rtype: ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult]
:raises ~azure.core.exceptions.HttpResponseError:"""

@distributed_trace
def begin_infer_radiology_insights(
self,
id: str,
resource: Union[_models.RadiologyInsightsJob, JSON, IO[bytes]],
*,
expand: Optional[List[str]] = None,
**kwargs: Any
) -> LROPoller[_models.RadiologyInsightsInferenceResult]:
# pylint: disable=line-too-long
"""Create Radiology Insights inference result.

Creates a Radiology Insights inference result with the given request body.

:param id: The unique ID of the inference result. Required.
:type id: str
:param resource: The resource instance. Is one of the following types: RadiologyInsightsJob, JSON, IO[bytes] Required.
:type resource: ~azure.healthinsights.radiologyinsights.models.RadiologyInsightsJob or JSON or IO[bytes]
:keyword expand: Expand the indicated resources into the response. Default value is None.
:paramtype expand: list[str]
:return: An instance of LROPoller that returns RadiologyInsightsInferenceResult. The RadiologyInsightsInferenceResult is compatible with MutableMapping
:rtype: ~azure.core.polling.LROPoller[~azure.healthinsights.radiologyinsights.models.RadiologyInsightsInferenceResult]
:raises ~azure.core.exceptions.HttpResponseError:"""

_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = kwargs.pop("params", {}) or {}

content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[_models.RadiologyInsightsJob] = kwargs.pop("cls", None)
polling: Union[bool, PollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop(
"polling_interval", self._client._config.polling_interval # pylint: disable=protected-access
)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = self._client._infer_radiology_insights_initial( # pylint: disable=protected-access
id=id,
resource=resource,
expand=expand,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
raw_result.http_response.read() # type: ignore
kwargs.pop("error_map", None)

def get_long_running_output(pipeline_response):
response_headers = {}
response = pipeline_response.http_response
response_headers["x-ms-request-id"] = self._client._deserialize( # pylint: disable=protected-access
"str", response.headers.get("x-ms-request-id")
)
response_headers["Operation-Location"] = self._client._deserialize( # pylint: disable=protected-access
"str", response.headers.get("Operation-Location")
)
deserialized = _deserialize(_models.RadiologyInsightsInferenceResult, response.json().get("result"))
if cls:
return cls(pipeline_response, deserialized, response_headers) # type: ignore
return deserialized

path_format_arguments = {
"endpoint": self._client._serialize.url( # pylint: disable=protected-access
"self._client._config.endpoint", self._client._config.endpoint, "str", skip_quote=True
),
}

if polling is True:
polling_method: PollingMethod = cast(
PollingMethod, LROBasePolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs)
)
elif polling is False:
polling_method = cast(PollingMethod, NoPolling())
else:
polling_method = polling
if cont_token:
return LROPoller[_models.RadiologyInsightsInferenceResult].from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client._client, # pylint: disable=protected-access
deserialization_callback=get_long_running_output,
)
return LROPoller[_models.RadiologyInsightsInferenceResult](
self._client._client, raw_result, get_long_running_output, polling_method # type: ignore # pylint: disable=protected-access
)

def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
"""Runs the network request through the client's chained policies.

>>> from azure.core.rest import HttpRequest
>>> request = HttpRequest("GET", "https://www.example.org/")
<HttpRequest [GET], url: 'https://www.example.org/'>
>>> response = client.send_request(request)
<HttpResponse: 200 OK>

For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request

:param request: The network request you want to make. Required.
:type request: ~azure.core.rest.HttpRequest
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
:return: The response of your network call. Does not do error handling on your response.
:rtype: ~azure.core.rest.HttpResponse
"""

return self._client.send_request(request, stream=stream, **kwargs) # type: ignore

def close(self) -> None:
self._client.close()

def __enter__(self) -> "RadiologyInsightsClient":
self._client.__enter__()
return self

def __exit__(self, *exc_details: Any) -> None:
self._client.__exit__(*exc_details)


__all__: List[str] = [
"RadiologyInsightsClient"
] # Add all objects you want publicly available to users at this package level # pylint: disable=line-too-long
__all__: List[str] = [] # Add all objects you want publicly available to users at this package level


def patch_sdk():
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------

from ._patch import RadiologyInsightsClient

from ._client import RadiologyInsightsClient

try:
from ._patch import __all__ as _patch_all
from ._patch import * # pylint: disable=unused-wildcard-import
except ImportError:
_patch_all = []
from ._patch import patch_sdk as _patch_sdk

__all__ = [
"RadiologyInsightsClient",
]

__all__.extend([p for p in _patch_all if p not in __all__])

_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ class RadiologyInsightsClient(
AzureKeyCredential type or a TokenCredential type. Required.
:type credential: ~azure.core.credentials.AzureKeyCredential or
~azure.core.credentials_async.AsyncTokenCredential
:keyword api_version: The API version to use for this operation. Default value is "2024-04-01".
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-08-01-preview". 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
Loading