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 packages/autorest.python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"homepage": "https://github.com/Azure/autorest.python/blob/main/README.md",
"dependencies": {
"@typespec/http-client-python": "~0.3.12",
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNDM5MDE3MS9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.3.12.tgz",
"@autorest/system-requirements": "~1.0.2",
"fs-extra": "~11.2.0",
"tsx": "~4.19.1"
Expand All @@ -47,4 +47,4 @@
"requirements.txt",
"generator/"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ async def patch_single(self, body: JSON, **kwargs: Any) -> None:

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize("object", pipeline_response)
raise HttpResponseError(response=response, model=error)
raise HttpResponseError(response=response)

if cls:
return cls(pipeline_response, None, {}) # type: ignore
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,7 @@ def patch_single(self, body: JSON, **kwargs: Any) -> None: # pylint: disable=in

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize("object", pipeline_response)
raise HttpResponseError(response=response, model=error)
raise HttpResponseError(response=response)

if cls:
return cls(pipeline_response, None, {}) # type: ignore
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ async def get(self, **kwargs: Any) -> JSON:

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize("object", pipeline_response)
raise HttpResponseError(response=response, model=error)
raise HttpResponseError(response=response)

deserialized = self._deserialize("object", pipeline_response.http_response)

Expand Down Expand Up @@ -127,8 +126,7 @@ async def put(self, put_object: JSON, **kwargs: Any) -> None:

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize("object", pipeline_response)
raise HttpResponseError(response=response, model=error)
raise HttpResponseError(response=response)

if cls:
return cls(pipeline_response, None, {}) # type: ignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ def get(self, **kwargs: Any) -> JSON:

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize("object", pipeline_response)
raise HttpResponseError(response=response, model=error)
raise HttpResponseError(response=response)

deserialized = self._deserialize("object", pipeline_response.http_response)

Expand Down Expand Up @@ -161,8 +160,7 @@ def put(self, put_object: JSON, **kwargs: Any) -> None: # pylint: disable=incon

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize("object", pipeline_response)
raise HttpResponseError(response=response, model=error)
raise HttpResponseError(response=response)

if cls:
return cls(pipeline_response, None, {}) # type: ignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast
from typing import Any, Callable, Dict, Optional, TypeVar

from azure.core.exceptions import (
ClientAuthenticationError,
Expand Down Expand Up @@ -66,16 +66,6 @@ async def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[_models.Pe
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
400: HttpResponseError,
404: cast(
Type[HttpResponseError],
lambda response: ResourceNotFoundError(
response=response, model=self._deserialize(_models.NotFoundErrorBase, response)
),
),
501: HttpResponseError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

Expand All @@ -99,8 +89,12 @@ async def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[_models.Pe
response = pipeline_response.http_response

if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
raise HttpResponseError(response=response)
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = None
if response.status_code == 404:
error = self._deserialize.failsafe_deserialize(_models.NotFoundErrorBase, pipeline_response)
raise ResourceNotFoundError(response=response, model=error)
raise HttpResponseError(response=response, model=error)

deserialized = None
if response.status_code == 200:
Expand All @@ -123,15 +117,6 @@ async def do_something(self, what_action: str, **kwargs: Any) -> _models.PetActi
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
500: cast(
Type[HttpResponseError],
lambda response: HttpResponseError(
response=response, model=self._deserialize(_models.PetActionError, response)
),
),
}
error_map.update(kwargs.pop("error_map", {}) or {})

Expand All @@ -156,7 +141,11 @@ async def do_something(self, what_action: str, **kwargs: Any) -> _models.PetActi

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.PetActionError, pipeline_response)
error = None
if response.status_code == 500:
error = self._deserialize.failsafe_deserialize(_models.PetActionError, pipeline_response)
else:
error = self._deserialize.failsafe_deserialize(_models.PetActionError, pipeline_response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize("PetAction", pipeline_response.http_response)
Expand All @@ -180,15 +169,6 @@ async def has_models_param(self, models: str = "value1", **kwargs: Any) -> None:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
500: cast(
Type[HttpResponseError],
lambda response: HttpResponseError(
response=response, model=self._deserialize(_models.PetActionError, response)
),
),
}
error_map.update(kwargs.pop("error_map", {}) or {})

Expand All @@ -213,7 +193,11 @@ async def has_models_param(self, models: str = "value1", **kwargs: Any) -> None:

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.PetActionError, pipeline_response)
error = None
if response.status_code == 500:
error = self._deserialize.failsafe_deserialize(_models.PetActionError, pipeline_response)
else:
error = self._deserialize.failsafe_deserialize(_models.PetActionError, pipeline_response)
raise HttpResponseError(response=response, model=error)

if cls:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast
from typing import Any, Callable, Dict, Optional, TypeVar

from azure.core.exceptions import (
ClientAuthenticationError,
Expand Down Expand Up @@ -123,16 +123,6 @@ def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[_models.Pet]:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
400: HttpResponseError,
404: cast(
Type[HttpResponseError],
lambda response: ResourceNotFoundError(
response=response, model=self._deserialize(_models.NotFoundErrorBase, response)
),
),
501: HttpResponseError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

Expand All @@ -156,8 +146,12 @@ def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[_models.Pet]:
response = pipeline_response.http_response

if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
raise HttpResponseError(response=response)
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = None
if response.status_code == 404:
error = self._deserialize.failsafe_deserialize(_models.NotFoundErrorBase, pipeline_response)
raise ResourceNotFoundError(response=response, model=error)
raise HttpResponseError(response=response, model=error)

deserialized = None
if response.status_code == 200:
Expand All @@ -180,15 +174,6 @@ def do_something(self, what_action: str, **kwargs: Any) -> _models.PetAction:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
500: cast(
Type[HttpResponseError],
lambda response: HttpResponseError(
response=response, model=self._deserialize(_models.PetActionError, response)
),
),
}
error_map.update(kwargs.pop("error_map", {}) or {})

Expand All @@ -213,7 +198,11 @@ def do_something(self, what_action: str, **kwargs: Any) -> _models.PetAction:

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.PetActionError, pipeline_response)
error = None
if response.status_code == 500:
error = self._deserialize.failsafe_deserialize(_models.PetActionError, pipeline_response)
else:
error = self._deserialize.failsafe_deserialize(_models.PetActionError, pipeline_response)
raise HttpResponseError(response=response, model=error)

deserialized = self._deserialize("PetAction", pipeline_response.http_response)
Expand All @@ -239,15 +228,6 @@ def has_models_param( # pylint: disable=inconsistent-return-statements
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
500: cast(
Type[HttpResponseError],
lambda response: HttpResponseError(
response=response, model=self._deserialize(_models.PetActionError, response)
),
),
}
error_map.update(kwargs.pop("error_map", {}) or {})

Expand All @@ -272,7 +252,11 @@ def has_models_param( # pylint: disable=inconsistent-return-statements

if response.status_code not in [200]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.PetActionError, pipeline_response)
error = None
if response.status_code == 500:
error = self._deserialize.failsafe_deserialize(_models.PetActionError, pipeline_response)
else:
error = self._deserialize.failsafe_deserialize(_models.PetActionError, pipeline_response)
raise HttpResponseError(response=response, model=error)

if cls:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast
from typing import Any, Callable, Dict, Optional, TypeVar, cast

from azure.core.exceptions import (
ClientAuthenticationError,
Expand Down Expand Up @@ -73,11 +73,6 @@ async def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[JSON]:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
400: HttpResponseError,
404: cast(Type[HttpResponseError], lambda response: ResourceNotFoundError(response=response)),
501: HttpResponseError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

Expand All @@ -101,7 +96,7 @@ async def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[JSON]:
response = pipeline_response.http_response

if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response)

deserialized = None
Expand Down Expand Up @@ -136,10 +131,6 @@ async def do_something(self, what_action: str, **kwargs: Any) -> JSON:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
500: HttpResponseError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

Expand Down Expand Up @@ -190,10 +181,6 @@ async def has_models_param(self, *, models: str = "value1", **kwargs: Any) -> No
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
500: HttpResponseError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, Callable, Dict, Optional, Type, TypeVar, cast
from typing import Any, Callable, Dict, Optional, TypeVar, cast

from azure.core.exceptions import (
ClientAuthenticationError,
Expand Down Expand Up @@ -130,11 +130,6 @@ def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[JSON]:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
400: HttpResponseError,
404: cast(Type[HttpResponseError], lambda response: ResourceNotFoundError(response=response)),
501: HttpResponseError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

Expand All @@ -158,7 +153,7 @@ def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[JSON]:
response = pipeline_response.http_response

if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map) # type: ignore
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response)

deserialized = None
Expand Down Expand Up @@ -193,10 +188,6 @@ def do_something(self, what_action: str, **kwargs: Any) -> JSON:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
500: HttpResponseError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

Expand Down Expand Up @@ -249,10 +240,6 @@ def has_models_param( # pylint: disable=inconsistent-return-statements
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
500: HttpResponseError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

Expand Down
4 changes: 2 additions & 2 deletions packages/typespec-python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"js-yaml": "~4.1.0",
"semver": "~7.6.2",
"tsx": "~4.19.1",
"@typespec/http-client-python": "~0.3.12",
"@typespec/http-client-python": "https://artprodcus3.artifacts.visualstudio.com/A0fb41ef4-5012-48a9-bf39-4ee3de03ee35/29ec6040-b234-4e31-b139-33dc4287b756/_apis/artifact/cGlwZWxpbmVhcnRpZmFjdDovL2F6dXJlLXNkay9wcm9qZWN0SWQvMjllYzYwNDAtYjIzNC00ZTMxLWIxMzktMzNkYzQyODdiNzU2L2J1aWxkSWQvNDM5MDE3MS9hcnRpZmFjdE5hbWUvYnVpbGRfYXJ0aWZhY3RzX3B5dGhvbg2/content?format=file&subPath=%2Fpackages%2Ftypespec-http-client-python-0.3.12.tgz",
"fs-extra": "~11.2.0"
},
"devDependencies": {
Expand Down Expand Up @@ -90,4 +90,4 @@
"chalk": "5.3.0",
"@types/fs-extra": "11.0.4"
}
}
}
Loading
Loading