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
4 changes: 2 additions & 2 deletions sdk/vision/azure-ai-vision-imageanalysis/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
include *.md
include LICENSE
include azure/ai/vision/imageanalysis/py.typed
recursive-include tests *.py *.md sample.jpg
recursive-include samples *.py *.md sample.jpg run_all_samples.cmd run_all_samples.ps1
recursive-include tests *.py
recursive-include samples *.py *.md
include azure/__init__.py
include azure/ai/__init__.py
include azure/ai/vision/__init__.py
8 changes: 4 additions & 4 deletions sdk/vision/azure-ai-vision-imageanalysis/_meta.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"commit": "bef35d01d2572ba131d7f2d4cd8d6313ec649525",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"typespec_src": "specification/cognitiveservices/Vision.ImageAnalysis",
"@azure-tools/typespec-python": "0.15.0"
"commit": "c29452397f8d29456182b951987a765d1ae01bb1",
"repository_url": "https://github.com/test-repo-billy/azure-rest-api-specs",
"typespec_src": "specification/ai/ImageAnalysis",
"@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 ImageAnalysisClient
from ._client import ImageAnalysisClient
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__ = [
"ImageAnalysisClient",
]

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

_patch_sdk()

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
StreamClosedError,
StreamConsumedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
Expand Down Expand Up @@ -173,121 +175,8 @@ def _analyze_from_image_data(
:return: ImageAnalysisResult. The ImageAnalysisResult is compatible with MutableMapping
:rtype: ~azure.ai.vision.imageanalysis.models.ImageAnalysisResult
:raises ~azure.core.exceptions.HttpResponseError:

Example:
.. code-block:: python

# response body for status code(s): 200
response == {
"metadata": {
"height": 0,
"width": 0
},
"modelVersion": "str",
"captionResult": {
"confidence": 0.0,
"text": "str"
},
"denseCaptionsResult": {
"values": [
{
"boundingBox": {
"h": 0,
"w": 0,
"x": 0,
"y": 0
},
"confidence": 0.0,
"text": "str"
}
]
},
"objectsResult": {
"values": [
{
"boundingBox": {
"h": 0,
"w": 0,
"x": 0,
"y": 0
},
"tags": [
{
"confidence": 0.0,
"name": "str"
}
]
}
]
},
"peopleResult": {
"values": [
{
"boundingBox": {
"h": 0,
"w": 0,
"x": 0,
"y": 0
},
"confidence": 0.0
}
]
},
"readResult": {
"blocks": [
{
"lines": [
{
"boundingPolygon": [
{
"x": 0,
"y": 0
}
],
"text": "str",
"words": [
{
"boundingPolygon": [
{
"x":
0,
"y":
0
}
],
"confidence": 0.0,
"text": "str"
}
]
}
]
}
]
},
"smartCropsResult": {
"values": [
{
"aspectRatio": 0.0,
"boundingBox": {
"h": 0,
"w": 0,
"x": 0,
"y": 0
}
}
]
},
"tagsResult": {
"values": [
{
"confidence": 0.0,
"name": "str"
}
]
}
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -329,7 +218,10 @@ def _analyze_from_image_data(

if response.status_code not in [200]:
if _stream:
response.read() # Load the body in memory and close the socket
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response)

Expand Down Expand Up @@ -433,126 +325,8 @@ def _analyze_from_url(
:return: ImageAnalysisResult. The ImageAnalysisResult is compatible with MutableMapping
:rtype: ~azure.ai.vision.imageanalysis.models.ImageAnalysisResult
:raises ~azure.core.exceptions.HttpResponseError:

Example:
.. code-block:: python

# JSON input template you can fill out and use as your body input.
image_url = {
"url": "str"
}

# response body for status code(s): 200
response == {
"metadata": {
"height": 0,
"width": 0
},
"modelVersion": "str",
"captionResult": {
"confidence": 0.0,
"text": "str"
},
"denseCaptionsResult": {
"values": [
{
"boundingBox": {
"h": 0,
"w": 0,
"x": 0,
"y": 0
},
"confidence": 0.0,
"text": "str"
}
]
},
"objectsResult": {
"values": [
{
"boundingBox": {
"h": 0,
"w": 0,
"x": 0,
"y": 0
},
"tags": [
{
"confidence": 0.0,
"name": "str"
}
]
}
]
},
"peopleResult": {
"values": [
{
"boundingBox": {
"h": 0,
"w": 0,
"x": 0,
"y": 0
},
"confidence": 0.0
}
]
},
"readResult": {
"blocks": [
{
"lines": [
{
"boundingPolygon": [
{
"x": 0,
"y": 0
}
],
"text": "str",
"words": [
{
"boundingPolygon": [
{
"x":
0,
"y":
0
}
],
"confidence": 0.0,
"text": "str"
}
]
}
]
}
]
},
"smartCropsResult": {
"values": [
{
"aspectRatio": 0.0,
"boundingBox": {
"h": 0,
"w": 0,
"x": 0,
"y": 0
}
}
]
},
"tagsResult": {
"values": [
{
"confidence": 0.0,
"name": "str"
}
]
}
}
"""
error_map: MutableMapping[int, Type[HttpResponseError]] = {
error_map: MutableMapping[int, Type[HttpResponseError]] = { # pylint: disable=unsubscriptable-object
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
Expand Down Expand Up @@ -599,7 +373,10 @@ def _analyze_from_url(

if response.status_code not in [200]:
if _stream:
response.read() # Load the body in memory and close the socket
try:
response.read() # Load the body in memory and close the socket
except (StreamConsumedError, StreamClosedError):
pass
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
"""Customize generated code here.

Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize
"""
from typing import List

__all__: List[str] = [] # Add all objects you want publicly available to users at this package level
Expand Down
Loading