|
2 | 2 |
|
3 | 3 | from __future__ import annotations |
4 | 4 |
|
5 | | -from typing import Any, cast |
| 5 | +from typing import Type, cast |
6 | 6 |
|
7 | 7 | import httpx |
8 | 8 |
|
@@ -78,21 +78,16 @@ def get( |
78 | 78 | raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") |
79 | 79 | if not operation_id: |
80 | 80 | raise ValueError(f"Expected a non-empty value for `operation_id` but received {operation_id!r}") |
81 | | - return cast( |
82 | | - BulkOperationGetResponse, |
83 | | - self._get( |
84 | | - f"/accounts/{account_id}/rules/lists/bulk_operations/{operation_id}", |
85 | | - options=make_request_options( |
86 | | - extra_headers=extra_headers, |
87 | | - extra_query=extra_query, |
88 | | - extra_body=extra_body, |
89 | | - timeout=timeout, |
90 | | - post_parser=ResultWrapper[BulkOperationGetResponse]._unwrapper, |
91 | | - ), |
92 | | - cast_to=cast( |
93 | | - Any, ResultWrapper[BulkOperationGetResponse] |
94 | | - ), # Union types cannot be passed in as arguments in the type system |
| 81 | + return self._get( |
| 82 | + f"/accounts/{account_id}/rules/lists/bulk_operations/{operation_id}", |
| 83 | + options=make_request_options( |
| 84 | + extra_headers=extra_headers, |
| 85 | + extra_query=extra_query, |
| 86 | + extra_body=extra_body, |
| 87 | + timeout=timeout, |
| 88 | + post_parser=ResultWrapper[BulkOperationGetResponse]._unwrapper, |
95 | 89 | ), |
| 90 | + cast_to=cast(Type[BulkOperationGetResponse], ResultWrapper[BulkOperationGetResponse]), |
96 | 91 | ) |
97 | 92 |
|
98 | 93 |
|
@@ -152,21 +147,16 @@ async def get( |
152 | 147 | raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") |
153 | 148 | if not operation_id: |
154 | 149 | raise ValueError(f"Expected a non-empty value for `operation_id` but received {operation_id!r}") |
155 | | - return cast( |
156 | | - BulkOperationGetResponse, |
157 | | - await self._get( |
158 | | - f"/accounts/{account_id}/rules/lists/bulk_operations/{operation_id}", |
159 | | - options=make_request_options( |
160 | | - extra_headers=extra_headers, |
161 | | - extra_query=extra_query, |
162 | | - extra_body=extra_body, |
163 | | - timeout=timeout, |
164 | | - post_parser=ResultWrapper[BulkOperationGetResponse]._unwrapper, |
165 | | - ), |
166 | | - cast_to=cast( |
167 | | - Any, ResultWrapper[BulkOperationGetResponse] |
168 | | - ), # Union types cannot be passed in as arguments in the type system |
| 150 | + return await self._get( |
| 151 | + f"/accounts/{account_id}/rules/lists/bulk_operations/{operation_id}", |
| 152 | + options=make_request_options( |
| 153 | + extra_headers=extra_headers, |
| 154 | + extra_query=extra_query, |
| 155 | + extra_body=extra_body, |
| 156 | + timeout=timeout, |
| 157 | + post_parser=ResultWrapper[BulkOperationGetResponse]._unwrapper, |
169 | 158 | ), |
| 159 | + cast_to=cast(Type[BulkOperationGetResponse], ResultWrapper[BulkOperationGetResponse]), |
170 | 160 | ) |
171 | 161 |
|
172 | 162 |
|
|
0 commit comments