Skip to content

Commit 1f25b89

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 69477b2 commit 1f25b89

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

src/sourmash/commands.py

+1
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,7 @@ def gather(args):
946946
# @CTB foo revindex
947947
from sourmash.index.revindex import RevIndex
948948
from sourmash.index import ZipFileLinearIndex
949+
949950
xx = []
950951
for db in databases:
951952
if isinstance(db, ZipFileLinearIndex):

src/sourmash/index/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def counter_gather(self, query, threshold_bp, **kwargs):
311311
with query.update() as prefetch_query:
312312
prefetch_query.minhash = prefetch_query.minhash.flatten()
313313

314-
if 1: # @CTB
314+
if 1: # @CTB
315315
# find all matches and construct a CounterGather object.
316316
counter = CounterGather(prefetch_query)
317317
for result in self.prefetch(prefetch_query, threshold_bp, **kwargs):
@@ -321,6 +321,7 @@ def counter_gather(self, query, threshold_bp, **kwargs):
321321
return counter
322322
else:
323323
from .revindex import RevIndex
324+
324325
revindex = RevIndex(template=prefetch_query.minhash)
325326

326327
for result in self.prefetch(prefetch_query, threshold_bp, **kwargs):

src/sourmash/index/revindex.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from sourmash.manifest import CollectionManifest
1616

1717

18-
class RevIndex(RustObject): #, Index):
18+
class RevIndex(RustObject): # , Index):
1919
__dealloc_func__ = lib.revindex_free
2020
manifest = None
2121
is_database = True
@@ -75,15 +75,17 @@ def signatures(self):
7575

7676
def signatures_with_location(self):
7777
for ss in self.signatures():
78-
yield ss, self.location # @CTB
78+
yield ss, self.location # @CTB
7979

8080
def __len__(self):
8181
self._init_inner()
8282
return self._methodcall(lib.revindex_len)
8383

8484
def insert(self, sig):
8585
if sig.minhash.scaled > self._scaled:
86-
raise Exception(f"insert scaled {sig.minhash.scaled} is higher than template scaled {self._scaled}")
86+
raise Exception(
87+
f"insert scaled {sig.minhash.scaled} is higher than template scaled {self._scaled}"
88+
)
8789
self._check_init()
8890
self._signatures.append(sig)
8991

@@ -103,7 +105,8 @@ def select(
103105
abund=None,
104106
containment=None,
105107
picklist=None,
106-
**kwargs):
108+
**kwargs,
109+
):
107110
_check_select_parameters(
108111
ksize=ksize,
109112
moltype=moltype,
@@ -178,7 +181,9 @@ def search(self, query, *args, **kwargs):
178181
for i in range(size):
179182
match = SearchResult._from_objptr(results_ptr[i])
180183
if match.score >= threshold:
181-
results.append(IndexSearchResult(match.score, match.signature, match.location))
184+
results.append(
185+
IndexSearchResult(match.score, match.signature, match.location)
186+
)
182187

183188
return results
184189

@@ -200,8 +205,7 @@ def best_containment(self, query_ss, *, threshold_bp=0, **kwargs):
200205
if not query_mh:
201206
raise ValueError("empty query")
202207
threshold = threshold_bp / query_mh.scaled / len(query_mh)
203-
results = self.search(query_ss, threshold=threshold,
204-
do_containment=True)
208+
results = self.search(query_ss, threshold=threshold, do_containment=True)
205209

206210
if results:
207211
results.sort(key=lambda x: -x.score)
@@ -362,7 +366,7 @@ def select(
362366
raise ValueError(f"revindex ksize is {my_ksize}, not {ksize}")
363367
if scaled is not None and scaled < my_scaled:
364368
raise ValueError(f"revindex scaled is {my_scaled}, not {scaled}")
365-
if 0 and moltype is not None and moltype != my_moltype: # @CTB
369+
if 0 and moltype is not None and moltype != my_moltype: # @CTB
366370
raise ValueError(f"revindex moltype is {my_moltype}, not {moltype}")
367371

368372
if picklist is not None:

tests/test_revindex.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
##
1818

1919

20-
class JaccardSearchBestOnly_ButIgnore(JaccardSearch): # @CTB remove?
20+
class JaccardSearchBestOnly_ButIgnore(JaccardSearch): # @CTB remove?
2121
"A class that ignores certain results, but still does all the pruning."
2222

2323
def __init__(self, ignore_list):
@@ -44,7 +44,7 @@ def test_revindex_empty():
4444
lidx = RevIndex(template=ss2.minhash)
4545

4646
with pytest.raises(ValueError):
47-
x = list(lidx.signatures())
47+
list(lidx.signatures())
4848

4949

5050
def test_revindex_index_search():
@@ -119,7 +119,7 @@ def test_revindex_best_containment():
119119

120120

121121
def test_revindex_gather_ignore():
122-
raise pytest.skip('not implemented')
122+
raise pytest.skip("not implemented")
123123
# check that RevIndex gather ignores things properly.
124124
sig2 = utils.get_test_data("2.fa.sig")
125125
sig47 = utils.get_test_data("47.fa.sig")
@@ -157,7 +157,7 @@ def test_revindex_insert_after_init():
157157

158158
ss2 = load_one_signature_from_json(sig2, ksize=31)
159159
ss47 = load_one_signature_from_json(sig47)
160-
ss63 = load_one_signature_from_json(sig63)
160+
load_one_signature_from_json(sig63)
161161

162162
lidx = RevIndex(template=ss2.minhash)
163163
lidx.insert(ss2)

0 commit comments

Comments
 (0)