Skip to content

Commit

Permalink
run isort
Browse files Browse the repository at this point in the history
  • Loading branch information
erikbern committed Apr 7, 2023
1 parent 8b0475b commit a9f29bb
Show file tree
Hide file tree
Showing 53 changed files with 131 additions and 77 deletions.
1 change: 1 addition & 0 deletions ann_benchmarks/algorithms/annoy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import annoy

from .base import BaseANN


Expand Down
1 change: 1 addition & 0 deletions ann_benchmarks/algorithms/balltree.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sklearn.neighbors
import sklearn.preprocessing

from .base import BaseANN


Expand Down
1 change: 1 addition & 0 deletions ann_benchmarks/algorithms/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from multiprocessing.pool import ThreadPool

import psutil


Expand Down
2 changes: 2 additions & 0 deletions ann_benchmarks/algorithms/bruteforce.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import numpy
import sklearn.neighbors

from ann_benchmarks.distance import metrics as pd

from .base import BaseANN


Expand Down
1 change: 1 addition & 0 deletions ann_benchmarks/algorithms/ckdtree.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from scipy.spatial import cKDTree

from .base import BaseANN


Expand Down
2 changes: 1 addition & 1 deletion ann_benchmarks/algorithms/datasketch.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np
from datasketch import MinHash, MinHashLSHForest

from datasketch import MinHashLSHForest, MinHash
from .base import BaseANN


Expand Down
2 changes: 1 addition & 1 deletion ann_benchmarks/algorithms/definitions.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import collections
import importlib
import yaml
from enum import Enum
from itertools import product

import yaml

Definition = collections.namedtuple(
"Definition", ["algorithm", "constructor", "module", "docker_tag", "arguments", "query_argument_groups", "disabled"]
Expand Down
6 changes: 4 additions & 2 deletions ann_benchmarks/algorithms/diskann.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import os
import vamanapy as vp
import numpy as np
import struct
import time

import numpy as np
import vamanapy as vp

from .base import BaseANN


Expand Down
1 change: 1 addition & 0 deletions ann_benchmarks/algorithms/dolphinnpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import numpy
from dolphinn import Dolphinn
from utils import findmean, isotropize

from .base import BaseANN


Expand Down
1 change: 1 addition & 0 deletions ann_benchmarks/algorithms/dummy_algo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np

from .base import BaseANN


Expand Down
8 changes: 3 additions & 5 deletions ann_benchmarks/algorithms/elastiknn.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,17 @@
To install a local copy of the client, run `pip install --upgrade -e /path/to/elastiknn/client-python/`
To monitor the Elasticsearch JVM using Visualvm, add `ports={ "8097": 8097 }` to the `containers.run` call in runner.py.
"""
import logging
from time import perf_counter, sleep
from urllib.error import URLError
from urllib.request import Request, urlopen

import numpy as np
from elastiknn.api import Vec
from elastiknn.models import ElastiknnModel

from .base import BaseANN

from urllib.request import Request, urlopen
from time import sleep, perf_counter

import logging

# Mute the elasticsearch logger.
# By default, it writes an INFO statement for every request.
logging.getLogger("elasticsearch").setLevel(logging.WARN)
Expand Down
3 changes: 2 additions & 1 deletion ann_benchmarks/algorithms/faiss.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import sys

sys.path.append("install/lib-faiss") # noqa
import faiss
import numpy
import sklearn.preprocessing
import faiss

from .base import BaseANN


Expand Down
3 changes: 2 additions & 1 deletion ann_benchmarks/algorithms/faiss_gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

# Assumes local installation of FAISS
sys.path.append("faiss") # noqa
import numpy
import faiss
import numpy

from .base import BaseANN

# Implementation based on
Expand Down
1 change: 1 addition & 0 deletions ann_benchmarks/algorithms/faiss_hnsw.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import faiss
import numpy as np

from .faiss import Faiss


Expand Down
3 changes: 2 additions & 1 deletion ann_benchmarks/algorithms/flann.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import pyflann
import numpy
import pyflann
import sklearn.preprocessing

from .base import BaseANN


Expand Down
1 change: 1 addition & 0 deletions ann_benchmarks/algorithms/hnswlib.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import hnswlib
import numpy as np

from .base import BaseANN


Expand Down
1 change: 1 addition & 0 deletions ann_benchmarks/algorithms/kdtree.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sklearn.neighbors
import sklearn.preprocessing

from .base import BaseANN


Expand Down
2 changes: 2 additions & 0 deletions ann_benchmarks/algorithms/kgraph.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os

import numpy
import pykgraph

from ..constants import INDEX_DIR
from .base import BaseANN

Expand Down
1 change: 1 addition & 0 deletions ann_benchmarks/algorithms/lshf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import sklearn.neighbors
import sklearn.preprocessing

from .base import BaseANN


Expand Down
16 changes: 9 additions & 7 deletions ann_benchmarks/algorithms/luceneknn.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@
ann-benchmarks interface for Apache Lucene.
"""

import sklearn.preprocessing
import numpy as np

import lucene
from lucene import JArray
import numpy as np
import sklearn.preprocessing
from java.nio.file import Paths
from org.apache.lucene.store import FSDirectory
from org.apache.lucene.search import KnnVectorQuery, IndexSearcher
from org.apache.lucene.index import IndexWriter, IndexWriterConfig, VectorSimilarityFunction, DirectoryReader
from lucene import JArray
from org.apache.lucene.codecs.lucene94 import Lucene94HnswVectorsFormat
from org.apache.lucene.document import Document, KnnVectorField, StoredField
from org.apache.lucene.index import (DirectoryReader, IndexWriter,
IndexWriterConfig,
VectorSimilarityFunction)
from org.apache.lucene.search import IndexSearcher, KnnVectorQuery
from org.apache.lucene.store import FSDirectory
from org.apache.pylucene.codecs import PyLucene94Codec

from .base import BaseANN


Expand Down
1 change: 1 addition & 0 deletions ann_benchmarks/algorithms/milvus.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy
import pyknowhere

from .base import BaseANN


Expand Down
3 changes: 2 additions & 1 deletion ann_benchmarks/algorithms/mrpt.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import mrpt
import numpy
import sklearn.preprocessing
import mrpt

from .base import BaseANN


Expand Down
1 change: 1 addition & 0 deletions ann_benchmarks/algorithms/n2.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import n2

from .base import BaseANN


Expand Down
3 changes: 2 additions & 1 deletion ann_benchmarks/algorithms/nearpy.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import nearpy
from nearpy.filters import NearestFilter
import sklearn.preprocessing
from nearpy.filters import NearestFilter

from .base import BaseANN


Expand Down
2 changes: 2 additions & 0 deletions ann_benchmarks/algorithms/nmslib.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import os

import nmslib
import numpy as np
import scipy.sparse

from ..constants import INDEX_DIR
from .base import BaseANN

Expand Down
4 changes: 3 additions & 1 deletion ann_benchmarks/algorithms/onng_ngt.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import os
import ngtpy
import subprocess
import time

import ngtpy

from .base import BaseANN


Expand Down
4 changes: 1 addition & 3 deletions ann_benchmarks/algorithms/opensearchknn.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,11 @@

from elasticsearch import Elasticsearch
from elasticsearch.helpers import bulk
from tqdm import tqdm

from .base import BaseANN

from .elasticsearch import es_wait

from tqdm import tqdm

# Configure the logger.
logging.getLogger("elasticsearch").setLevel(logging.WARN)

Expand Down
4 changes: 3 additions & 1 deletion ann_benchmarks/algorithms/panng_ngt.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import os
import ngtpy
import subprocess
import time

import ngtpy

from .base import BaseANN


Expand Down
2 changes: 1 addition & 1 deletion ann_benchmarks/algorithms/pgvector.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import subprocess
import sys

import psycopg
import pgvector.psycopg
import psycopg

from .base import BaseANN

Expand Down
4 changes: 2 additions & 2 deletions ann_benchmarks/algorithms/puffinn.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import numpy
import numpy as np

import puffinn

from .base import BaseANN
import numpy


class Puffinn(BaseANN):
Expand Down
5 changes: 3 additions & 2 deletions ann_benchmarks/algorithms/pynndescent.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import pynndescent
from .base import BaseANN
import numpy as np
import pynndescent
import scipy.sparse

from .base import BaseANN


class PyNNDescent(BaseANN):
def __init__(self, metric, index_param_dict, n_search_trees=1):
Expand Down
12 changes: 8 additions & 4 deletions ann_benchmarks/algorithms/qdrant.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
from .base import BaseANN
from qdrant_client import QdrantClient
from qdrant_client.http.models import Distance, VectorParams, SearchRequest, SearchParams, CollectionStatus
import numpy as np
from time import sleep

import numpy as np
from qdrant_client import QdrantClient
from qdrant_client.http.models import (CollectionStatus, Distance,
SearchParams, SearchRequest,
VectorParams)

from .base import BaseANN


class Qdrant(BaseANN):

Expand Down
4 changes: 3 additions & 1 deletion ann_benchmarks/algorithms/qg_ngt.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import os
import ngtpy
import subprocess
import time

import ngtpy

from .base import BaseANN


Expand Down
8 changes: 5 additions & 3 deletions ann_benchmarks/algorithms/qsg_ngt.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import os
import ngtpy
import subprocess
import struct
from sklearn import preprocessing
import subprocess
import time

import ngtpy
from sklearn import preprocessing

from .base import BaseANN


Expand Down
3 changes: 2 additions & 1 deletion ann_benchmarks/algorithms/rpforest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import rpforest
import numpy
import rpforest

from .base import BaseANN


Expand Down
1 change: 1 addition & 0 deletions ann_benchmarks/algorithms/scann.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy as np
import scann

from .base import BaseANN


Expand Down
1 change: 1 addition & 0 deletions ann_benchmarks/algorithms/sptag.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import SPTAG

from .base import BaseANN


Expand Down
8 changes: 5 additions & 3 deletions ann_benchmarks/algorithms/subprocess.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
from os.path import basename
import shlex
import subprocess
from os.path import basename
from types import MethodType

import psutil
import subprocess
from ..data import bit_unparse_entry, int_unparse_entry, float_unparse_entry

from ..data import bit_unparse_entry, float_unparse_entry, int_unparse_entry
from .base import BaseANN


Expand Down
Loading

0 comments on commit a9f29bb

Please sign in to comment.