mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
add stubs for "annoy" (#5319)
This change adds type stubs for the "annoy" package: https://github.com/spotify/annoy
This commit is contained in:
committed by
GitHub
parent
dbaf4c6390
commit
30154447e7
2
stubs/annoy/METADATA.toml
Normal file
2
stubs/annoy/METADATA.toml
Normal file
@@ -0,0 +1,2 @@
|
||||
version = "1.17"
|
||||
requires = []
|
||||
41
stubs/annoy/annoy/__init__.pyi
Normal file
41
stubs/annoy/annoy/__init__.pyi
Normal file
@@ -0,0 +1,41 @@
|
||||
from typing import Sequence, overload
|
||||
from typing_extensions import Literal
|
||||
|
||||
class AnnoyIndex:
|
||||
f: int
|
||||
def __init__(self, f: int, metric: Literal["angular", "euclidean", "manhattan", "hamming", "dot"]) -> None: ...
|
||||
def load(self, fn: str, prefault: bool = ...) -> Literal[True]: ...
|
||||
def save(self, fn: str, prefault: bool = ...) -> Literal[True]: ...
|
||||
@overload
|
||||
def get_nns_by_item(self, i: int, n: int, search_k: int = ..., include_distances: Literal[False] = ...) -> list[int]: ...
|
||||
@overload
|
||||
def get_nns_by_item(
|
||||
self, i: int, n: int, search_k: int, include_distances: Literal[True]
|
||||
) -> tuple[list[int], list[float]]: ...
|
||||
@overload
|
||||
def get_nns_by_item(
|
||||
self, i: int, n: int, search_k: int = ..., *, include_distances: Literal[True]
|
||||
) -> tuple[list[int], list[float]]: ...
|
||||
@overload
|
||||
def get_nns_by_vector(
|
||||
self, vector: Sequence[float], n: int, search_k: int = ..., include_distances: Literal[False] = ...
|
||||
) -> list[int]: ...
|
||||
@overload
|
||||
def get_nns_by_vector(
|
||||
self, vector: Sequence[float], n: int, search_k: int, include_distances: Literal[True]
|
||||
) -> tuple[list[int], list[float]]: ...
|
||||
@overload
|
||||
def get_nns_by_vector(
|
||||
self, vector: Sequence[float], n: int, search_k: int = ..., *, include_distances: Literal[True]
|
||||
) -> tuple[list[int], list[float]]: ...
|
||||
def get_item_vector(self, __i: int) -> list[float]: ...
|
||||
def add_item(self, i: int, vector: Sequence[float]) -> None: ...
|
||||
def on_disk_build(self, fn: str) -> Literal[True]: ...
|
||||
def build(self, n_trees: int, n_jobs: int = ...) -> Literal[True]: ...
|
||||
def unbuild(self) -> Literal[True]: ...
|
||||
def unload(self) -> Literal[True]: ...
|
||||
def get_distance(self, __i: int, __j: int) -> float: ...
|
||||
def get_n_items(self) -> int: ...
|
||||
def get_n_trees(self) -> int: ...
|
||||
def verbose(self, __v: bool) -> Literal[True]: ...
|
||||
def set_seed(self, __s: int) -> None: ...
|
||||
Reference in New Issue
Block a user