|
3 | 3 | # This source code is licensed under the MIT license found in the |
4 | 4 | # LICENSE file in the root directory of this source tree. |
5 | 5 |
|
6 | | -import faiss |
7 | | -import unittest |
8 | | -import numpy as np |
9 | | -import platform |
10 | 6 | import os |
11 | | -import random |
| 7 | +import platform |
12 | 8 | import shutil |
13 | 9 | import tempfile |
| 10 | +import unittest |
| 11 | +from contextlib import contextmanager |
14 | 12 |
|
15 | | -from faiss.contrib import datasets |
16 | | -from faiss.contrib import inspect_tools |
17 | | -from faiss.contrib import evaluation |
18 | | -from faiss.contrib import ivf_tools |
19 | | -from faiss.contrib import clustering |
20 | | -from faiss.contrib import big_batch_search |
21 | | -from faiss.contrib.ondisk import merge_ondisk |
| 13 | +import faiss |
| 14 | +import numpy as np |
22 | 15 |
|
23 | 16 | from common_faiss_tests import get_dataset_2 |
24 | | -from faiss.contrib.exhaustive_search import \ |
25 | | - knn_ground_truth, knn, range_ground_truth, \ |
26 | | - range_search_max_results, exponential_query_iterator |
27 | | -from contextlib import contextmanager |
| 17 | + |
| 18 | +from faiss.contrib import ( |
| 19 | + big_batch_search, |
| 20 | + clustering, |
| 21 | + datasets, |
| 22 | + evaluation, |
| 23 | + inspect_tools, |
| 24 | + ivf_tools, |
| 25 | +) |
| 26 | +from faiss.contrib.exhaustive_search import ( |
| 27 | + exponential_query_iterator, |
| 28 | + knn, |
| 29 | + knn_ground_truth, |
| 30 | + range_ground_truth, |
| 31 | + range_search_max_results, |
| 32 | +) |
| 33 | +from faiss.contrib.ondisk import merge_ondisk |
28 | 34 |
|
29 | 35 |
|
30 | 36 | class TestComputeGT(unittest.TestCase): |
@@ -664,7 +670,10 @@ def test_sort(self): |
664 | 670 | np.testing.assert_equal(Inew, Iref) |
665 | 671 |
|
666 | 672 | def test_hnsw_permute(self): |
667 | | - """ make sure HNSW permutation works (useful when used as coarse quantizer) """ |
| 673 | + """ |
| 674 | + make sure HNSW permutation works |
| 675 | + (useful when used as coarse quantizer) |
| 676 | + """ |
668 | 677 | ds = datasets.SyntheticDataset(32, 0, 1000, 50) |
669 | 678 | index = faiss.index_factory(ds.d, "HNSW32,Flat") |
670 | 679 | index.add(ds.get_database()) |
@@ -692,8 +701,10 @@ def test_code_set(self): |
692 | 701 | np.sort(codes[inserted], axis=None)) |
693 | 702 |
|
694 | 703 |
|
695 | | -@unittest.skipIf(platform.system() == 'Windows', |
696 | | - 'OnDiskInvertedLists is unsupported on Windows.') |
| 704 | +@unittest.skipIf( |
| 705 | + platform.system() == 'Windows', |
| 706 | + 'OnDiskInvertedLists is unsupported on Windows.' |
| 707 | +) |
697 | 708 | class TestMerge(unittest.TestCase): |
698 | 709 | @contextmanager |
699 | 710 | def temp_directory(self): |
|
0 commit comments