15
15
from sourmash .manifest import CollectionManifest
16
16
17
17
18
- class RevIndex (RustObject ): # , Index):
18
+ class RevIndex (RustObject ): # , Index):
19
19
__dealloc_func__ = lib .revindex_free
20
20
manifest = None
21
21
is_database = True
@@ -75,15 +75,17 @@ def signatures(self):
75
75
76
76
def signatures_with_location (self ):
77
77
for ss in self .signatures ():
78
- yield ss , self .location # @CTB
78
+ yield ss , self .location # @CTB
79
79
80
80
def __len__ (self ):
81
81
self ._init_inner ()
82
82
return self ._methodcall (lib .revindex_len )
83
83
84
84
def insert (self , sig ):
85
85
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
+ )
87
89
self ._check_init ()
88
90
self ._signatures .append (sig )
89
91
@@ -103,7 +105,8 @@ def select(
103
105
abund = None ,
104
106
containment = None ,
105
107
picklist = None ,
106
- ** kwargs ):
108
+ ** kwargs ,
109
+ ):
107
110
_check_select_parameters (
108
111
ksize = ksize ,
109
112
moltype = moltype ,
@@ -178,7 +181,9 @@ def search(self, query, *args, **kwargs):
178
181
for i in range (size ):
179
182
match = SearchResult ._from_objptr (results_ptr [i ])
180
183
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
+ )
182
187
183
188
return results
184
189
@@ -200,8 +205,7 @@ def best_containment(self, query_ss, *, threshold_bp=0, **kwargs):
200
205
if not query_mh :
201
206
raise ValueError ("empty query" )
202
207
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 )
205
209
206
210
if results :
207
211
results .sort (key = lambda x : - x .score )
@@ -362,7 +366,7 @@ def select(
362
366
raise ValueError (f"revindex ksize is { my_ksize } , not { ksize } " )
363
367
if scaled is not None and scaled < my_scaled :
364
368
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
366
370
raise ValueError (f"revindex moltype is { my_moltype } , not { moltype } " )
367
371
368
372
if picklist is not None :
0 commit comments