Skip to content
Merged
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 autorest/codegen/serializers/builder_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ def _response_docstring_type_template(self, builder: BuilderType) -> str:
def _response_type_annotation(self, builder: BuilderType, modify_if_head_as_boolean: bool = True) -> str:
if (
modify_if_head_as_boolean
and builder.request_builder.method == "head"
and builder.request_builder.method.lower() == "head"
and self.code_model.options["head_as_boolean"]
):
return "bool"
Expand All @@ -643,7 +643,7 @@ def _response_docstring_text_template(self, builder: BuilderType) -> str: # pyl

def response_docstring(self, builder: BuilderType) -> List[str]:
responses_with_body = [r for r in builder.responses if r.has_body]
if builder.request_builder.method == "head" and self.code_model.options["head_as_boolean"]:
if builder.request_builder.method.lower() == "head" and self.code_model.options["head_as_boolean"]:
response_docstring_text = "bool"
rtype = "bool"
elif responses_with_body:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ def __init__(self, client, config, serializer, deserializer) -> None:
async def head200(
self,
**kwargs: Any
) -> None:
) -> bool:
"""Return 200 status code if successful.

:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:return: bool, or the result of cls(response)
:rtype: bool
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType[None]
Expand Down Expand Up @@ -83,12 +83,12 @@ async def head200(
async def head204(
self,
**kwargs: Any
) -> None:
) -> bool:
"""Return 204 status code if successful.

:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:return: bool, or the result of cls(response)
:rtype: bool
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType[None]
Expand Down Expand Up @@ -122,12 +122,12 @@ async def head204(
async def head404(
self,
**kwargs: Any
) -> None:
) -> bool:
"""Return 404 status code if successful.

:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:return: bool, or the result of cls(response)
:rtype: bool
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType[None]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ def head200(
self,
**kwargs # type: Any
):
# type: (...) -> None
# type: (...) -> bool
"""Return 200 status code if successful.

:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:return: bool, or the result of cls(response)
:rtype: bool
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType[None]
Expand Down Expand Up @@ -134,12 +134,12 @@ def head204(
self,
**kwargs # type: Any
):
# type: (...) -> None
# type: (...) -> bool
"""Return 204 status code if successful.

:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:return: bool, or the result of cls(response)
:rtype: bool
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType[None]
Expand Down Expand Up @@ -174,12 +174,12 @@ def head404(
self,
**kwargs # type: Any
):
# type: (...) -> None
# type: (...) -> bool
"""Return 404 status code if successful.

:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:return: bool, or the result of cls(response)
:rtype: bool
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop('cls', None) # type: ClsType[None]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ async def custom_named_request_id_param_grouping(
custom_named_request_id_param_grouping.metadata = {"url": "/azurespecials/customNamedRequestIdParamGrouping"} # type: ignore

@distributed_trace_async
async def custom_named_request_id_head(self, foo_client_request_id: str, **kwargs: Any) -> None:
async def custom_named_request_id_head(self, foo_client_request_id: str, **kwargs: Any) -> bool:
"""Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request.

:param foo_client_request_id: The fooRequestId.
:type foo_client_request_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:return: bool, or the result of cls(response)
:rtype: bool
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop("cls", None) # type: ClsType[None]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,14 @@ def custom_named_request_id_head(
foo_client_request_id, # type: str
**kwargs # type: Any
):
# type: (...) -> None
# type: (...) -> bool
"""Send foo-client-request-id = 9C4D50EE-2D56-4CD3-8152-34347DC9F2B0 in the header of the request.

:param foo_client_request_id: The fooRequestId.
:type foo_client_request_id: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:return: bool, or the result of cls(response)
:rtype: bool
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop("cls", None) # type: ClsType[None]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None:
self._config = config

@distributed_trace_async
async def head200(self, **kwargs: Any) -> None:
async def head200(self, **kwargs: Any) -> bool:
"""Return 200 status code if successful.

:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:return: bool, or the result of cls(response)
:rtype: bool
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop("cls", None) # type: ClsType[None]
Expand All @@ -80,12 +80,12 @@ async def head200(self, **kwargs: Any) -> None:
head200.metadata = {"url": "/http/success/200"} # type: ignore

@distributed_trace_async
async def head204(self, **kwargs: Any) -> None:
async def head204(self, **kwargs: Any) -> bool:
"""Return 204 status code if successful.

:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:return: bool, or the result of cls(response)
:rtype: bool
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop("cls", None) # type: ClsType[None]
Expand All @@ -112,12 +112,12 @@ async def head204(self, **kwargs: Any) -> None:
head204.metadata = {"url": "/http/success/204"} # type: ignore

@distributed_trace_async
async def head404(self, **kwargs: Any) -> None:
async def head404(self, **kwargs: Any) -> bool:
"""Return 404 status code if successful.

:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:return: bool, or the result of cls(response)
:rtype: bool
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop("cls", None) # type: ClsType[None]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ def __init__(self, client, config, serializer, deserializer):
def head200(
self, **kwargs # type: Any
):
# type: (...) -> None
# type: (...) -> bool
"""Return 200 status code if successful.

:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:return: bool, or the result of cls(response)
:rtype: bool
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop("cls", None) # type: ClsType[None]
Expand Down Expand Up @@ -134,12 +134,12 @@ def head200(
def head204(
self, **kwargs # type: Any
):
# type: (...) -> None
# type: (...) -> bool
"""Return 204 status code if successful.

:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:return: bool, or the result of cls(response)
:rtype: bool
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop("cls", None) # type: ClsType[None]
Expand Down Expand Up @@ -169,12 +169,12 @@ def head204(
def head404(
self, **kwargs # type: Any
):
# type: (...) -> None
# type: (...) -> bool
"""Return 404 status code if successful.

:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:return: bool, or the result of cls(response)
:rtype: bool
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop("cls", None) # type: ClsType[None]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None:
self._config = config

@distributed_trace_async
async def head200(self, **kwargs: Any) -> None:
async def head200(self, **kwargs: Any) -> bool:
"""Return 200 status code if successful.

:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:return: bool, or the result of cls(response)
:rtype: bool
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop("cls", None) # type: ClsType[None]
Expand All @@ -80,12 +80,12 @@ async def head200(self, **kwargs: Any) -> None:
head200.metadata = {"url": "/http/success/200"} # type: ignore

@distributed_trace_async
async def head204(self, **kwargs: Any) -> None:
async def head204(self, **kwargs: Any) -> bool:
"""Return 204 status code if successful.

:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:return: bool, or the result of cls(response)
:rtype: bool
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop("cls", None) # type: ClsType[None]
Expand All @@ -112,12 +112,12 @@ async def head204(self, **kwargs: Any) -> None:
head204.metadata = {"url": "/http/success/204"} # type: ignore

@distributed_trace_async
async def head404(self, **kwargs: Any) -> None:
async def head404(self, **kwargs: Any) -> bool:
"""Return 404 status code if successful.

:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:return: bool, or the result of cls(response)
:rtype: bool
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop("cls", None) # type: ClsType[None]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ def __init__(self, client, config, serializer, deserializer):
def head200(
self, **kwargs # type: Any
):
# type: (...) -> None
# type: (...) -> bool
"""Return 200 status code if successful.

:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:return: bool, or the result of cls(response)
:rtype: bool
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop("cls", None) # type: ClsType[None]
Expand Down Expand Up @@ -134,12 +134,12 @@ def head200(
def head204(
self, **kwargs # type: Any
):
# type: (...) -> None
# type: (...) -> bool
"""Return 204 status code if successful.

:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:return: bool, or the result of cls(response)
:rtype: bool
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop("cls", None) # type: ClsType[None]
Expand Down Expand Up @@ -169,12 +169,12 @@ def head204(
def head404(
self, **kwargs # type: Any
):
# type: (...) -> None
# type: (...) -> bool
"""Return 404 status code if successful.

:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:return: bool, or the result of cls(response)
:rtype: bool
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop("cls", None) # type: ClsType[None]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None:
self._config = config

@distributed_trace_async
async def head200(self, **kwargs: Any) -> None:
async def head200(self, **kwargs: Any) -> bool:
"""Return 200 status code if successful.

:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:return: bool, or the result of cls(response)
:rtype: bool
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop("cls", None) # type: ClsType[None]
Expand All @@ -80,12 +80,12 @@ async def head200(self, **kwargs: Any) -> None:
head200.metadata = {"url": "/http/success/200"} # type: ignore

@distributed_trace_async
async def head204(self, **kwargs: Any) -> None:
async def head204(self, **kwargs: Any) -> bool:
"""Return 204 status code if successful.

:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:return: bool, or the result of cls(response)
:rtype: bool
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop("cls", None) # type: ClsType[None]
Expand All @@ -112,12 +112,12 @@ async def head204(self, **kwargs: Any) -> None:
head204.metadata = {"url": "/http/success/204"} # type: ignore

@distributed_trace_async
async def head404(self, **kwargs: Any) -> None:
async def head404(self, **kwargs: Any) -> bool:
"""Return 404 status code if successful.

:keyword callable cls: A custom type or function that will be passed the direct response
:return: None, or the result of cls(response)
:rtype: None
:return: bool, or the result of cls(response)
:rtype: bool
:raises: ~azure.core.exceptions.HttpResponseError
"""
cls = kwargs.pop("cls", None) # type: ClsType[None]
Expand Down
Loading