Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions annoy/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@

from typing import Sized, overload
from typing import Sized, overload, TypeAlias
from typing_extensions import Literal, Protocol

AnnoyMetric: TypeAlias = Literal["angular", "euclidean", "manhattan", "hamming", "dot"]

class _Vector(Protocol, Sized):
def __getitem__(self, __index: int) -> float: ...

class AnnoyIndex:
f: int
def __init__(self, f: int, metric: Literal["angular", "euclidean", "manhattan", "hamming", "dot"]) -> None: ...
def __init__(self, f: int, metric: AnnoyMetric) -> None: ...
def load(self, fn: str, prefault: bool = ...) -> Literal[True]: ...
def save(self, fn: str, prefault: bool = ...) -> Literal[True]: ...
@overload
Expand Down