From 4f49c1a981a2074d9c071853fb4b9425eab450b4 Mon Sep 17 00:00:00 2001 From: Sujit Nirmal Date: Mon, 19 Oct 2026 20:40:41 +0000 Subject: [PATCH] [hnswlib] Fix Index.get_items return types --- stubs/hnswlib/hnswlib.pyi | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/stubs/hnswlib/hnswlib.pyi b/stubs/hnswlib/hnswlib.pyi index 4a84d55d99f8..cb52fd7fbee7 100644 --- a/stubs/hnswlib/hnswlib.pyi +++ b/stubs/hnswlib/hnswlib.pyi @@ -25,13 +25,15 @@ class Index: def get_ids_list(self) -> list[int]: ... @overload - def get_items(self, ids: ArrayLike | None = ..., return_type: Literal["list"] = ...) -> list[float]: ... + def get_items(self, ids: ArrayLike | None = None, return_type: Literal["numpy"] = "numpy") -> NDArray[np.float32]: ... @overload - def get_items(self, ids: ArrayLike | None = ..., return_type: Literal["numpy"] = ...) -> NDArray[np.float32]: ... + def get_items(self, ids: ArrayLike | None, return_type: Literal["list"]) -> list[list[float]]: ... + @overload + def get_items(self, ids: ArrayLike | None = None, *, return_type: Literal["list"]) -> list[list[float]]: ... @overload def get_items( self, ids: ArrayLike | None = None, return_type: Literal["numpy", "list"] = "numpy" - ) -> NDArray[np.float32] | list[float]: ... + ) -> NDArray[np.float32] | list[list[float]]: ... def get_max_elements(self) -> int: ... def index_file_size(self) -> int: ...