From 93fc62037180ecbd795881566555614d3661be94 Mon Sep 17 00:00:00 2001 From: "C. Titus Brown" Date: Mon, 8 Mar 2021 18:16:36 -0800 Subject: [PATCH 1/2] fix location -> _location throughout --- src/sourmash/sbt.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sourmash/sbt.py b/src/sourmash/sbt.py index 62eb604c18..487816d294 100644 --- a/src/sourmash/sbt.py +++ b/src/sourmash/sbt.py @@ -390,7 +390,7 @@ def search(self, query, *args, **kwargs): # tree search should always/only return matches above threshold assert similarity >= threshold - results.append((similarity, leaf.data, self.location)) + results.append((similarity, leaf.data, self._location)) return results @@ -436,7 +436,7 @@ def gather(self, query, *args, **kwargs): containment = query.minhash.contained_by(leaf_mh, True) assert containment >= threshold, "containment {} not below threshold {}".format(containment, threshold) - results.append((containment, leaf.data, self.location)) + results.append((containment, leaf.data, self._location)) results.sort(key=lambda x: -x[0]) @@ -760,7 +760,7 @@ def load(cls, location, *, leaf_loader=None, storage=None, print_version_warning storage = klass(**jnodes['storage']['args']) obj = loader(jnodes, leaf_loader, dirname, storage, print_version_warning=print_version_warning, cache_size=cache_size) - obj.location = location + obj._location = location return obj @staticmethod From 7f601c15d863de29da8804925f4a3a52cd615ecb Mon Sep 17 00:00:00 2001 From: "C. Titus Brown" Date: Mon, 8 Mar 2021 18:24:02 -0800 Subject: [PATCH 2/2] add tests for _location --- tests/test_sbt.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/test_sbt.py b/tests/test_sbt.py index 25d864ea83..43f17af343 100644 --- a/tests/test_sbt.py +++ b/tests/test_sbt.py @@ -794,6 +794,8 @@ def test_sbt_protein_command_index(c): results = db2.gather(sig2) assert results[0][0] == 1.0 + assert results[0][2] == db2._location + assert results[0][2] == db_out @utils.in_thisdir @@ -840,6 +842,8 @@ def test_sbt_hp_command_index(c): results = db2.gather(sig2) assert results[0][0] == 1.0 + assert results[0][2] == db2._location + assert results[0][2] == db_out @utils.in_thisdir @@ -886,6 +890,8 @@ def test_sbt_dayhoff_command_index(c): results = db2.gather(sig2) assert results[0][0] == 1.0 + assert results[0][2] == db2._location + assert results[0][2] == db_out @utils.in_thisdir