Skip to content

Commit afa1de3

Browse files
feat: Make Any replace all other return types
1 parent 01908a5 commit afa1de3

12 files changed

+122
-120
lines changed

end_to_end_tests/golden-record/my_test_api_client/api/tests/callback_test.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from http import HTTPStatus
2-
from typing import Any, Dict, Union
2+
from typing import Any, Dict
33

44
import httpx
55

@@ -33,7 +33,7 @@ def _get_kwargs(
3333
}
3434

3535

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

4949

50-
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError, None]]:
50+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]:
5151
return Response(
5252
status_code=HTTPStatus(response.status_code),
5353
content=response.content,
@@ -60,7 +60,7 @@ def sync_detailed(
6060
*,
6161
client: Client,
6262
json_body: AModel,
63-
) -> Response[Union[Any, HTTPValidationError, None]]:
63+
) -> Response[Any]:
6464
"""Path with callback
6565
6666
Try sending a request related to a callback
@@ -73,7 +73,7 @@ def sync_detailed(
7373
httpx.TimeoutException: If the request takes longer than Client.timeout.
7474
7575
Returns:
76-
Response[Union[Any, HTTPValidationError, None]]
76+
Response[Any]
7777
"""
7878

7979
kwargs = _get_kwargs(
@@ -93,7 +93,7 @@ def sync(
9393
*,
9494
client: Client,
9595
json_body: AModel,
96-
) -> Union[Any, HTTPValidationError, None]:
96+
) -> Any:
9797
"""Path with callback
9898
9999
Try sending a request related to a callback
@@ -106,7 +106,7 @@ def sync(
106106
httpx.TimeoutException: If the request takes longer than Client.timeout.
107107
108108
Returns:
109-
Union[Any, HTTPValidationError, None]
109+
Any
110110
"""
111111

112112
return sync_detailed(
@@ -119,7 +119,7 @@ async def asyncio_detailed(
119119
*,
120120
client: Client,
121121
json_body: AModel,
122-
) -> Response[Union[Any, HTTPValidationError, None]]:
122+
) -> Response[Any]:
123123
"""Path with callback
124124
125125
Try sending a request related to a callback
@@ -132,7 +132,7 @@ async def asyncio_detailed(
132132
httpx.TimeoutException: If the request takes longer than Client.timeout.
133133
134134
Returns:
135-
Response[Union[Any, HTTPValidationError, None]]
135+
Response[Any]
136136
"""
137137

138138
kwargs = _get_kwargs(
@@ -150,7 +150,7 @@ async def asyncio(
150150
*,
151151
client: Client,
152152
json_body: AModel,
153-
) -> Union[Any, HTTPValidationError, None]:
153+
) -> Any:
154154
"""Path with callback
155155
156156
Try sending a request related to a callback
@@ -163,7 +163,7 @@ async def asyncio(
163163
httpx.TimeoutException: If the request takes longer than Client.timeout.
164164
165165
Returns:
166-
Union[Any, HTTPValidationError, None]
166+
Any
167167
"""
168168

169169
return (

end_to_end_tests/golden-record/my_test_api_client/api/tests/defaults_tests_defaults_post.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def _get_kwargs(
100100
}
101101

102102

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

116116

117-
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError, None]]:
117+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]:
118118
return Response(
119119
status_code=HTTPStatus(response.status_code),
120120
content=response.content,
@@ -137,7 +137,7 @@ def sync_detailed(
137137
enum_prop: AnEnum,
138138
model_prop: "ModelWithUnionProperty",
139139
required_model_prop: "ModelWithUnionProperty",
140-
) -> Response[Union[Any, HTTPValidationError, None]]:
140+
) -> Response[Any]:
141141
"""Defaults
142142
143143
Args:
@@ -158,7 +158,7 @@ def sync_detailed(
158158
httpx.TimeoutException: If the request takes longer than Client.timeout.
159159
160160
Returns:
161-
Response[Union[Any, HTTPValidationError, None]]
161+
Response[Any]
162162
"""
163163

164164
kwargs = _get_kwargs(
@@ -198,7 +198,7 @@ def sync(
198198
enum_prop: AnEnum,
199199
model_prop: "ModelWithUnionProperty",
200200
required_model_prop: "ModelWithUnionProperty",
201-
) -> Union[Any, HTTPValidationError, None]:
201+
) -> Any:
202202
"""Defaults
203203
204204
Args:
@@ -219,7 +219,7 @@ def sync(
219219
httpx.TimeoutException: If the request takes longer than Client.timeout.
220220
221221
Returns:
222-
Union[Any, HTTPValidationError, None]
222+
Any
223223
"""
224224

225225
return sync_detailed(
@@ -252,7 +252,7 @@ async def asyncio_detailed(
252252
enum_prop: AnEnum,
253253
model_prop: "ModelWithUnionProperty",
254254
required_model_prop: "ModelWithUnionProperty",
255-
) -> Response[Union[Any, HTTPValidationError, None]]:
255+
) -> Response[Any]:
256256
"""Defaults
257257
258258
Args:
@@ -273,7 +273,7 @@ async def asyncio_detailed(
273273
httpx.TimeoutException: If the request takes longer than Client.timeout.
274274
275275
Returns:
276-
Response[Union[Any, HTTPValidationError, None]]
276+
Response[Any]
277277
"""
278278

279279
kwargs = _get_kwargs(
@@ -311,7 +311,7 @@ async def asyncio(
311311
enum_prop: AnEnum,
312312
model_prop: "ModelWithUnionProperty",
313313
required_model_prop: "ModelWithUnionProperty",
314-
) -> Union[Any, HTTPValidationError, None]:
314+
) -> Any:
315315
"""Defaults
316316
317317
Args:
@@ -332,7 +332,7 @@ async def asyncio(
332332
httpx.TimeoutException: If the request takes longer than Client.timeout.
333333
334334
Returns:
335-
Union[Any, HTTPValidationError, None]
335+
Any
336336
"""
337337

338338
return (

end_to_end_tests/golden-record/my_test_api_client/api/tests/int_enum_tests_int_enum_post.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from http import HTTPStatus
2-
from typing import Any, Dict, Union
2+
from typing import Any, Dict
33

44
import httpx
55

@@ -38,7 +38,7 @@ def _get_kwargs(
3838
}
3939

4040

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

5454

55-
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError, None]]:
55+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]:
5656
return Response(
5757
status_code=HTTPStatus(response.status_code),
5858
content=response.content,
@@ -65,7 +65,7 @@ def sync_detailed(
6565
*,
6666
client: Client,
6767
int_enum: AnIntEnum,
68-
) -> Response[Union[Any, HTTPValidationError, None]]:
68+
) -> Response[Any]:
6969
"""Int Enum
7070
7171
Args:
@@ -76,7 +76,7 @@ def sync_detailed(
7676
httpx.TimeoutException: If the request takes longer than Client.timeout.
7777
7878
Returns:
79-
Response[Union[Any, HTTPValidationError, None]]
79+
Response[Any]
8080
"""
8181

8282
kwargs = _get_kwargs(
@@ -96,7 +96,7 @@ def sync(
9696
*,
9797
client: Client,
9898
int_enum: AnIntEnum,
99-
) -> Union[Any, HTTPValidationError, None]:
99+
) -> Any:
100100
"""Int Enum
101101
102102
Args:
@@ -107,7 +107,7 @@ def sync(
107107
httpx.TimeoutException: If the request takes longer than Client.timeout.
108108
109109
Returns:
110-
Union[Any, HTTPValidationError, None]
110+
Any
111111
"""
112112

113113
return sync_detailed(
@@ -120,7 +120,7 @@ async def asyncio_detailed(
120120
*,
121121
client: Client,
122122
int_enum: AnIntEnum,
123-
) -> Response[Union[Any, HTTPValidationError, None]]:
123+
) -> Response[Any]:
124124
"""Int Enum
125125
126126
Args:
@@ -131,7 +131,7 @@ async def asyncio_detailed(
131131
httpx.TimeoutException: If the request takes longer than Client.timeout.
132132
133133
Returns:
134-
Response[Union[Any, HTTPValidationError, None]]
134+
Response[Any]
135135
"""
136136

137137
kwargs = _get_kwargs(
@@ -149,7 +149,7 @@ async def asyncio(
149149
*,
150150
client: Client,
151151
int_enum: AnIntEnum,
152-
) -> Union[Any, HTTPValidationError, None]:
152+
) -> Any:
153153
"""Int Enum
154154
155155
Args:
@@ -160,7 +160,7 @@ async def asyncio(
160160
httpx.TimeoutException: If the request takes longer than Client.timeout.
161161
162162
Returns:
163-
Union[Any, HTTPValidationError, None]
163+
Any
164164
"""
165165

166166
return (

end_to_end_tests/golden-record/my_test_api_client/api/tests/json_body_tests_json_body_post.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from http import HTTPStatus
2-
from typing import Any, Dict, Union
2+
from typing import Any, Dict
33

44
import httpx
55

@@ -33,7 +33,7 @@ def _get_kwargs(
3333
}
3434

3535

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

4949

50-
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError, None]]:
50+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Any]:
5151
return Response(
5252
status_code=HTTPStatus(response.status_code),
5353
content=response.content,
@@ -60,7 +60,7 @@ def sync_detailed(
6060
*,
6161
client: Client,
6262
json_body: AModel,
63-
) -> Response[Union[Any, HTTPValidationError, None]]:
63+
) -> Response[Any]:
6464
"""Json Body
6565
6666
Try sending a JSON body
@@ -73,7 +73,7 @@ def sync_detailed(
7373
httpx.TimeoutException: If the request takes longer than Client.timeout.
7474
7575
Returns:
76-
Response[Union[Any, HTTPValidationError, None]]
76+
Response[Any]
7777
"""
7878

7979
kwargs = _get_kwargs(
@@ -93,7 +93,7 @@ def sync(
9393
*,
9494
client: Client,
9595
json_body: AModel,
96-
) -> Union[Any, HTTPValidationError, None]:
96+
) -> Any:
9797
"""Json Body
9898
9999
Try sending a JSON body
@@ -106,7 +106,7 @@ def sync(
106106
httpx.TimeoutException: If the request takes longer than Client.timeout.
107107
108108
Returns:
109-
Union[Any, HTTPValidationError, None]
109+
Any
110110
"""
111111

112112
return sync_detailed(
@@ -119,7 +119,7 @@ async def asyncio_detailed(
119119
*,
120120
client: Client,
121121
json_body: AModel,
122-
) -> Response[Union[Any, HTTPValidationError, None]]:
122+
) -> Response[Any]:
123123
"""Json Body
124124
125125
Try sending a JSON body
@@ -132,7 +132,7 @@ async def asyncio_detailed(
132132
httpx.TimeoutException: If the request takes longer than Client.timeout.
133133
134134
Returns:
135-
Response[Union[Any, HTTPValidationError, None]]
135+
Response[Any]
136136
"""
137137

138138
kwargs = _get_kwargs(
@@ -150,7 +150,7 @@ async def asyncio(
150150
*,
151151
client: Client,
152152
json_body: AModel,
153-
) -> Union[Any, HTTPValidationError, None]:
153+
) -> Any:
154154
"""Json Body
155155
156156
Try sending a JSON body
@@ -163,7 +163,7 @@ async def asyncio(
163163
httpx.TimeoutException: If the request takes longer than Client.timeout.
164164
165165
Returns:
166-
Union[Any, HTTPValidationError, None]
166+
Any
167167
"""
168168

169169
return (

0 commit comments

Comments
 (0)