Skip to content

Commit f67e097

Browse files
committed
redundant-cast
1 parent 7d2938a commit f67e097

5 files changed

Lines changed: 7 additions & 14 deletions

File tree

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,6 @@ exclude = [
298298
[tool.ty.rules]
299299
invalid-assignment = "ignore"
300300
call-non-callable = "ignore"
301-
redundant-cast = "ignore"
302301
invalid-argument-type = "ignore"
303302
unresolved-attribute = "ignore"
304303
not-iterable = "ignore"

src/runloop_api_client/_base_client.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,7 @@ def _parser(resp: AsyncPageT) -> AsyncPageT:
303303

304304
async def __aiter__(self) -> AsyncIterator[_T]:
305305
# https://github.com/microsoft/pyright/issues/3464
306-
page = cast(
307-
AsyncPageT,
308-
await self, # type: ignore
309-
)
306+
page = await self
310307
async for item in page:
311308
yield item
312309

src/runloop_api_client/_compat.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,14 +149,11 @@ def model_dump(
149149
# warnings are not supported in Pydantic v1
150150
warnings=True if PYDANTIC_V1 else warnings,
151151
)
152-
return cast(
153-
"dict[str, Any]",
154-
model.dict( # pyright: ignore[reportDeprecated, reportUnnecessaryCast]
152+
return model.dict( # pyright: ignore[reportDeprecated, reportUnnecessaryCast]
155153
exclude=exclude,
156154
exclude_unset=exclude_unset,
157155
exclude_defaults=exclude_defaults,
158-
),
159-
)
156+
)
160157

161158

162159
def model_parse(model: type[_ModelT], data: Any) -> _ModelT:

src/runloop_api_client/_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ def construct_type(*, value: object, type_: object, metadata: Optional[List[Any]
499499

500500
if is_union(origin):
501501
try:
502-
return validate_type(type_=cast("type[object]", original_type or type_), value=value)
502+
return validate_type(type_=original_type or type_, value=value)
503503
except Exception:
504504
pass
505505

src/runloop_api_client/_response.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ def wrapped(*args: P.args, **kwargs: P.kwargs) -> AsyncResponseContextManager[As
679679

680680
make_request = func(*args, **kwargs)
681681

682-
return AsyncResponseContextManager(cast(Awaitable[AsyncAPIResponse[R]], make_request))
682+
return AsyncResponseContextManager(make_request)
683683

684684
return wrapped
685685

@@ -729,7 +729,7 @@ def wrapped(*args: P.args, **kwargs: P.kwargs) -> AsyncResponseContextManager[_A
729729

730730
make_request = func(*args, **kwargs)
731731

732-
return AsyncResponseContextManager(cast(Awaitable[_AsyncAPIResponseT], make_request))
732+
return AsyncResponseContextManager(make_request)
733733

734734
return wrapped
735735

@@ -809,7 +809,7 @@ def wrapped(*args: P.args, **kwargs: P.kwargs) -> Awaitable[_AsyncAPIResponseT]:
809809

810810
kwargs["extra_headers"] = extra_headers
811811

812-
return cast(Awaitable[_AsyncAPIResponseT], func(*args, **kwargs))
812+
return func(*args, **kwargs)
813813

814814
return wrapped
815815

0 commit comments

Comments
 (0)