Skip to content

Commit

Permalink
feat: Make Any replace all other return types
Browse files Browse the repository at this point in the history
  • Loading branch information
robertschweizer committed Apr 1, 2023
1 parent 14ece43 commit 90aba2c
Show file tree
Hide file tree
Showing 12 changed files with 122 additions and 120 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from http import HTTPStatus
from typing import Any, Dict, Union
from typing import Any, Dict

import httpx

Expand Down Expand Up @@ -33,7 +33,7 @@ def _get_kwargs(
}


def _parse_response(*, client: Client, response: httpx.Response) -> Union[Any, HTTPValidationError, None]:
def _parse_response(*, client: Client, response: httpx.Response) -> Any:
if response.status_code == HTTPStatus.OK:
response_200 = response.json()
return response_200
Expand All @@ -47,7 +47,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Union[Any, H
return None


def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError, None]]:
def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
Expand All @@ -60,7 +60,7 @@ def sync_detailed(
*,
client: Client,
json_body: AModel,
) -> Response[Union[Any, HTTPValidationError, None]]:
) -> Response[Any]:
"""Path with callback
Try sending a request related to a callback
Expand All @@ -73,7 +73,7 @@ def sync_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Union[Any, HTTPValidationError, None]]
Response[Any]
"""

kwargs = _get_kwargs(
Expand All @@ -93,7 +93,7 @@ def sync(
*,
client: Client,
json_body: AModel,
) -> Union[Any, HTTPValidationError, None]:
) -> Any:
"""Path with callback
Try sending a request related to a callback
Expand All @@ -106,7 +106,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Union[Any, HTTPValidationError, None]
Any
"""

return sync_detailed(
Expand All @@ -119,7 +119,7 @@ async def asyncio_detailed(
*,
client: Client,
json_body: AModel,
) -> Response[Union[Any, HTTPValidationError, None]]:
) -> Response[Any]:
"""Path with callback
Try sending a request related to a callback
Expand All @@ -132,7 +132,7 @@ async def asyncio_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Union[Any, HTTPValidationError, None]]
Response[Any]
"""

kwargs = _get_kwargs(
Expand All @@ -150,7 +150,7 @@ async def asyncio(
*,
client: Client,
json_body: AModel,
) -> Union[Any, HTTPValidationError, None]:
) -> Any:
"""Path with callback
Try sending a request related to a callback
Expand All @@ -163,7 +163,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Union[Any, HTTPValidationError, None]
Any
"""

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def _get_kwargs(
}


def _parse_response(*, client: Client, response: httpx.Response) -> Union[Any, HTTPValidationError, None]:
def _parse_response(*, client: Client, response: httpx.Response) -> Any:
if response.status_code == HTTPStatus.OK:
response_200 = response.json()
return response_200
Expand All @@ -114,7 +114,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Union[Any, H
return None


def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError, None]]:
def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
Expand All @@ -137,7 +137,7 @@ def sync_detailed(
enum_prop: AnEnum,
model_prop: "ModelWithUnionProperty",
required_model_prop: "ModelWithUnionProperty",
) -> Response[Union[Any, HTTPValidationError, None]]:
) -> Response[Any]:
"""Defaults
Args:
Expand All @@ -158,7 +158,7 @@ def sync_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Union[Any, HTTPValidationError, None]]
Response[Any]
"""

kwargs = _get_kwargs(
Expand Down Expand Up @@ -198,7 +198,7 @@ def sync(
enum_prop: AnEnum,
model_prop: "ModelWithUnionProperty",
required_model_prop: "ModelWithUnionProperty",
) -> Union[Any, HTTPValidationError, None]:
) -> Any:
"""Defaults
Args:
Expand All @@ -219,7 +219,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Union[Any, HTTPValidationError, None]
Any
"""

return sync_detailed(
Expand Down Expand Up @@ -252,7 +252,7 @@ async def asyncio_detailed(
enum_prop: AnEnum,
model_prop: "ModelWithUnionProperty",
required_model_prop: "ModelWithUnionProperty",
) -> Response[Union[Any, HTTPValidationError, None]]:
) -> Response[Any]:
"""Defaults
Args:
Expand All @@ -273,7 +273,7 @@ async def asyncio_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Union[Any, HTTPValidationError, None]]
Response[Any]
"""

kwargs = _get_kwargs(
Expand Down Expand Up @@ -311,7 +311,7 @@ async def asyncio(
enum_prop: AnEnum,
model_prop: "ModelWithUnionProperty",
required_model_prop: "ModelWithUnionProperty",
) -> Union[Any, HTTPValidationError, None]:
) -> Any:
"""Defaults
Args:
Expand All @@ -332,7 +332,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Union[Any, HTTPValidationError, None]
Any
"""

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from http import HTTPStatus
from typing import Any, Dict, Union
from typing import Any, Dict

import httpx

Expand Down Expand Up @@ -38,7 +38,7 @@ def _get_kwargs(
}


def _parse_response(*, client: Client, response: httpx.Response) -> Union[Any, HTTPValidationError, None]:
def _parse_response(*, client: Client, response: httpx.Response) -> Any:
if response.status_code == HTTPStatus.OK:
response_200 = response.json()
return response_200
Expand All @@ -52,7 +52,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Union[Any, H
return None


def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError, None]]:
def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
Expand All @@ -65,7 +65,7 @@ def sync_detailed(
*,
client: Client,
int_enum: AnIntEnum,
) -> Response[Union[Any, HTTPValidationError, None]]:
) -> Response[Any]:
"""Int Enum
Args:
Expand All @@ -76,7 +76,7 @@ def sync_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Union[Any, HTTPValidationError, None]]
Response[Any]
"""

kwargs = _get_kwargs(
Expand All @@ -96,7 +96,7 @@ def sync(
*,
client: Client,
int_enum: AnIntEnum,
) -> Union[Any, HTTPValidationError, None]:
) -> Any:
"""Int Enum
Args:
Expand All @@ -107,7 +107,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Union[Any, HTTPValidationError, None]
Any
"""

return sync_detailed(
Expand All @@ -120,7 +120,7 @@ async def asyncio_detailed(
*,
client: Client,
int_enum: AnIntEnum,
) -> Response[Union[Any, HTTPValidationError, None]]:
) -> Response[Any]:
"""Int Enum
Args:
Expand All @@ -131,7 +131,7 @@ async def asyncio_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Union[Any, HTTPValidationError, None]]
Response[Any]
"""

kwargs = _get_kwargs(
Expand All @@ -149,7 +149,7 @@ async def asyncio(
*,
client: Client,
int_enum: AnIntEnum,
) -> Union[Any, HTTPValidationError, None]:
) -> Any:
"""Int Enum
Args:
Expand All @@ -160,7 +160,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Union[Any, HTTPValidationError, None]
Any
"""

return (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from http import HTTPStatus
from typing import Any, Dict, Union
from typing import Any, Dict

import httpx

Expand Down Expand Up @@ -33,7 +33,7 @@ def _get_kwargs(
}


def _parse_response(*, client: Client, response: httpx.Response) -> Union[Any, HTTPValidationError, None]:
def _parse_response(*, client: Client, response: httpx.Response) -> Any:
if response.status_code == HTTPStatus.OK:
response_200 = response.json()
return response_200
Expand All @@ -47,7 +47,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Union[Any, H
return None


def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError, None]]:
def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]:
return Response(
status_code=HTTPStatus(response.status_code),
content=response.content,
Expand All @@ -60,7 +60,7 @@ def sync_detailed(
*,
client: Client,
json_body: AModel,
) -> Response[Union[Any, HTTPValidationError, None]]:
) -> Response[Any]:
"""Json Body
Try sending a JSON body
Expand All @@ -73,7 +73,7 @@ def sync_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Union[Any, HTTPValidationError, None]]
Response[Any]
"""

kwargs = _get_kwargs(
Expand All @@ -93,7 +93,7 @@ def sync(
*,
client: Client,
json_body: AModel,
) -> Union[Any, HTTPValidationError, None]:
) -> Any:
"""Json Body
Try sending a JSON body
Expand All @@ -106,7 +106,7 @@ def sync(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Union[Any, HTTPValidationError, None]
Any
"""

return sync_detailed(
Expand All @@ -119,7 +119,7 @@ async def asyncio_detailed(
*,
client: Client,
json_body: AModel,
) -> Response[Union[Any, HTTPValidationError, None]]:
) -> Response[Any]:
"""Json Body
Try sending a JSON body
Expand All @@ -132,7 +132,7 @@ async def asyncio_detailed(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Response[Union[Any, HTTPValidationError, None]]
Response[Any]
"""

kwargs = _get_kwargs(
Expand All @@ -150,7 +150,7 @@ async def asyncio(
*,
client: Client,
json_body: AModel,
) -> Union[Any, HTTPValidationError, None]:
) -> Any:
"""Json Body
Try sending a JSON body
Expand All @@ -163,7 +163,7 @@ async def asyncio(
httpx.TimeoutException: If the request takes longer than Client.timeout.
Returns:
Union[Any, HTTPValidationError, None]
Any
"""

return (
Expand Down
Loading

0 comments on commit 90aba2c

Please sign in to comment.