Skip to content

Commit 26aa756

Browse files
committed
fix flake code checks
1 parent 652dc93 commit 26aa756

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

ir_axioms/backend/pyterrier/__init__.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ def _index(self) -> Index:
8888
)
8989

9090
def __str__(self):
91-
return f'TerrierIndexContext({str(self.index_location).split("/")[-1].split(" ")[0]})'
91+
ret = str(self.index_location)
92+
ret = ret.split("/")[-1].split(" ")[0]
93+
return f'TerrierIndexContext({ret})'
9294

9395
@cached_property
9496
def _meta_index(self) -> MetaIndex:

ir_axioms/modules/similarity.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
from ir_axioms import logger
1414
from ir_axioms.utils.nltk import download_nltk_dependencies
1515

16+
import os
17+
DIR_PATH = os.path.dirname(os.path.realpath(__file__))
18+
1619

1720
@lru_cache(None)
1821
def synonym_set(
@@ -199,5 +202,5 @@ def similarity(self, term1: str, term2: str):
199202

200203

201204
class FastTextWikiNewsTermSimilarityMixin(MagnitudeTermSimilarityMixin):
202-
# wget via: https://files.webis.de/data-in-production/data-research/ir-axioms/wiki-news-300d-1M.magnitude
203-
embeddings_path: Final[str] = "/workspaces/ecir25-gpt-axioms/wiki-news-300d-1M.magnitude"
205+
# wget via: https://files.webis.de/data-in-production/data-research/ir-axioms/wiki-news-300d-1M.magnitude # noqa: E501
206+
embeddings_path: Final[str] = f"{DIR_PATH}/wiki-news-300d-1M.magnitude"

tests/unit/test_string_representations.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,23 @@ class TestStringRepresentations(unittest.TestCase):
1111
def test_string_representation_of_terrier_index_context_01(self):
1212
# Needed for caching
1313
expected = 'TerrierIndexContext(index_location)'
14-
actual = str(TerrierIndexContext('index_location'))
14+
index_location = 'index_location'
15+
actual = str(TerrierIndexContext(index_location))
1516

1617
self.assertEqual(expected, actual)
1718

1819
def test_string_representation_of_terrier_index_context_02(self):
1920
# Needed for caching
2021
expected = 'TerrierIndexContext(index_location)'
21-
actual = str(TerrierIndexContext('ignore/absolute/path/index_location'))
22+
index_location = 'ignore/absolute/path/index_location'
23+
actual = str(TerrierIndexContext(index_location))
2224

2325
self.assertEqual(expected, actual)
2426

2527
def test_string_representation_of_terrier_index_context_03(self):
2628
# Needed for caching
2729
expected = 'TerrierIndexContext(index_location)'
28-
actual = str(TerrierIndexContext('ignore/absolute/path/index_location ignore suffix'))
30+
index_location = 'ignore/absolute/path/index_location ignore suffix'
31+
actual = str(TerrierIndexContext(index_location))
2932

30-
self.assertEqual(expected, actual)
33+
self.assertEqual(expected, actual)

0 commit comments

Comments
 (0)