mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
Remove annoy from pyright excludelist (#9114)
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
"stdlib/xml/dom/minidom.pyi",
|
||||
"stdlib/xml/dom/pulldom.pyi",
|
||||
"stdlib/xml/sax",
|
||||
"stubs/annoy/annoy/annoylib.pyi",
|
||||
"stubs/aws-xray-sdk",
|
||||
"stubs/babel",
|
||||
"stubs/backports.ssl_match_hostname",
|
||||
|
||||
@@ -1,44 +1,5 @@
|
||||
from _typeshed import SupportsLenAndGetItem
|
||||
from typing import overload
|
||||
from typing_extensions import Literal, TypeAlias
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
_Vector: TypeAlias = SupportsLenAndGetItem[float]
|
||||
from .annoylib import Annoy
|
||||
|
||||
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: _Vector, n: int, search_k: int = ..., include_distances: Literal[False] = ...
|
||||
) -> list[int]: ...
|
||||
@overload
|
||||
def get_nns_by_vector(
|
||||
self, vector: _Vector, n: int, search_k: int, include_distances: Literal[True]
|
||||
) -> tuple[list[int], list[float]]: ...
|
||||
@overload
|
||||
def get_nns_by_vector(
|
||||
self, vector: _Vector, 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: _Vector) -> 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: ...
|
||||
AnnoyIndex: TypeAlias = Annoy
|
||||
|
||||
@@ -1,20 +1,44 @@
|
||||
from _typeshed import Incomplete
|
||||
from _typeshed import SupportsLenAndGetItem
|
||||
from typing import overload
|
||||
from typing_extensions import Literal, TypeAlias
|
||||
|
||||
_Vector: TypeAlias = SupportsLenAndGetItem[float]
|
||||
|
||||
class Annoy:
|
||||
f: Incomplete
|
||||
def __init__(self, *args, **kwargs) -> None: ...
|
||||
def add_item(self, *args, **kwargs): ...
|
||||
def build(self, *args, **kwargs): ...
|
||||
def get_distance(self, *args, **kwargs): ...
|
||||
def get_item_vector(self, *args, **kwargs): ...
|
||||
def get_n_items(self, *args, **kwargs): ...
|
||||
def get_n_trees(self, *args, **kwargs): ...
|
||||
def get_nns_by_item(self, *args, **kwargs): ...
|
||||
def get_nns_by_vector(self, *args, **kwargs): ...
|
||||
def load(self, *args, **kwargs): ...
|
||||
def on_disk_build(self, *args, **kwargs): ...
|
||||
def save(self, *args, **kwargs): ...
|
||||
def set_seed(self, *args, **kwargs): ...
|
||||
def unbuild(self, *args, **kwargs): ...
|
||||
def unload(self, *args, **kwargs): ...
|
||||
def verbose(self, *args, **kwargs): ...
|
||||
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: _Vector, n: int, search_k: int = ..., include_distances: Literal[False] = ...
|
||||
) -> list[int]: ...
|
||||
@overload
|
||||
def get_nns_by_vector(
|
||||
self, vector: _Vector, n: int, search_k: int, include_distances: Literal[True]
|
||||
) -> tuple[list[int], list[float]]: ...
|
||||
@overload
|
||||
def get_nns_by_vector(
|
||||
self, vector: _Vector, 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: _Vector) -> 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