Skip to content

Commit

Permalink
work around litestar issue 4019
Browse files Browse the repository at this point in the history
  • Loading branch information
AbstractUmbra committed Feb 20, 2025
1 parent 4d820ef commit 79bd6fe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions rtfs/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ async def get_rtfs( # noqa: RUF029 # required in use of litestar callbacks
name="RTFS Libraries",
responses={200: ResponseSpec(data_container=dict[Literal["available_libraries"], dict[str, str | None]])},
sync_to_thread=True,
status_code=200,
)
def get_rtfs_libraries(rtfs: Indexes) -> Response[Mapping[str, Any]]:
return Response(
Expand All @@ -158,8 +159,9 @@ def get_rtfs_libraries(rtfs: Indexes) -> Response[Mapping[str, Any]]:
responses={202: ResponseSpec(data_container=RefreshResponse, description="Results of the refresh")},
security=[{"apiKey": []}],
sync_to_thread=True,
status_code=202,
)
def refresh_indexes(request: Request[str, str, State]) -> Response[dict[str, Any]]:
def refresh_indexes(request: Request[str, str, State]) -> Response[RefreshResponse]:
indexer = _reload_indexer(REPO_CONFIG)

success = indexer.reload()
Expand All @@ -169,7 +171,7 @@ def refresh_indexes(request: Request[str, str, State]) -> Response[dict[str, Any
content={"success": success, "commits": {name: value.commit for name, value in indexer.index.items()}},
media_type=MediaType.JSON,
status_code=status_codes.HTTP_202_ACCEPTED,
)
) # pyright: ignore[reportReturnType] # variance issues with `dict`


@post(
Expand Down

0 comments on commit 79bd6fe

Please sign in to comment.