Skip to content

Commit

Permalink
Regenerate for autorest.python (2024-12-09 03:01:38)
Browse files Browse the repository at this point in the history
  • Loading branch information
AutoPrFromHttpClientPython authored and AutoPrFromHttpClientPython committed Dec 9, 2024
1 parent 41502a3 commit a7013a2
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 76 deletions.
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 @@ -68,14 +68,6 @@ async def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[_models.Pe
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 +91,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 @@ -126,12 +122,6 @@ async def do_something(self, what_action: str, **kwargs: Any) -> _models.PetActi
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 +146,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 @@ -183,12 +177,6 @@ async def has_models_param(self, models: str = "value1", **kwargs: Any) -> None:
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 +201,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 @@ -125,14 +125,6 @@ def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[_models.Pet]:
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 +148,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 @@ -183,12 +179,6 @@ def do_something(self, what_action: str, **kwargs: Any) -> _models.PetAction:
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 +203,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 Down Expand Up @@ -242,12 +236,6 @@ def has_models_param( # pylint: disable=inconsistent-return-statements
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 +260,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,9 @@ async def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[JSON]:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
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 +99,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 @@ -139,7 +137,6 @@ async def do_something(self, what_action: str, **kwargs: Any) -> JSON:
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
500: HttpResponseError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

Expand Down Expand Up @@ -193,7 +190,6 @@ async def has_models_param(self, *, models: str = "value1", **kwargs: Any) -> No
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,9 @@ def get_pet_by_id(self, pet_id: str, **kwargs: Any) -> Optional[JSON]:
"""
error_map: MutableMapping = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
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 +156,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 @@ -196,7 +194,6 @@ def do_something(self, what_action: str, **kwargs: Any) -> JSON:
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
500: HttpResponseError,
}
error_map.update(kwargs.pop("error_map", {}) or {})

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

Expand Down

0 comments on commit a7013a2

Please sign in to comment.