better and clean;

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2023-05-08 12:58:35 -07:00
parent c209414459
commit 8cf515b39f
92 changed files with 2619 additions and 1373 deletions

View File

@ -33,7 +33,7 @@ def _get_kwargs(
}
def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, Mesh, Error]]:
def _parse_response(*, response: httpx.Response) -> Optional[Union[Mesh, Error]]:
if response.status_code == 200:
response_200 = Mesh.from_dict(response.json())
return response_200
@ -43,10 +43,12 @@ def _parse_response(*, response: httpx.Response) -> Optional[Union[Any, Mesh, Er
if response.status_code == 500:
response_5XX = Error.from_dict(response.json())
return response_5XX
return None
return Error.from_dict(response.json())
def _build_response(*, response: httpx.Response) -> Response[Union[Any, Mesh, Error]]:
def _build_response(
*, response: httpx.Response
) -> Response[Optional[Union[Mesh, Error]]]:
return Response(
status_code=response.status_code,
content=response.content,
@ -61,7 +63,7 @@ def sync_detailed(
body: bytes,
*,
client: Client,
) -> Response[Union[Any, Mesh, Error]]:
) -> Response[Optional[Union[Mesh, Error]]]:
kwargs = _get_kwargs(
input_format=input_format,
output_format=output_format,
@ -83,7 +85,7 @@ def sync(
body: bytes,
*,
client: Client,
) -> Optional[Union[Any, Mesh, Error]]:
) -> Optional[Union[Mesh, Error]]:
"""This is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better.""" # noqa: E501
return sync_detailed(
@ -100,7 +102,7 @@ async def asyncio_detailed(
body: bytes,
*,
client: Client,
) -> Response[Union[Any, Mesh, Error]]:
) -> Response[Optional[Union[Mesh, Error]]]:
kwargs = _get_kwargs(
input_format=input_format,
output_format=output_format,
@ -120,7 +122,7 @@ async def asyncio(
body: bytes,
*,
client: Client,
) -> Optional[Union[Any, Mesh, Error]]:
) -> Optional[Union[Mesh, Error]]:
"""This is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better.""" # noqa: E501
return (