Skip to content

Commit

Permalink
narrowing pt.java.required
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmacavaney committed Sep 24, 2024
1 parent 3104cd0 commit 803f5ef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pyterrier/terrier/_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import pyterrier as pt


@pt.java.required
class TerrierIndex(pt.Artifact):
"""A Terrier index."""

Expand Down Expand Up @@ -67,14 +66,15 @@ def bm25(
def __repr__(self):
return f'TerrierIndex({self.path!r})'

@pt.java.required
def index_ref(self):
"""Returns the internal Java index reference object for this index."""
if self._index_ref is None:
self._index_ref = pt.IndexRef.of(os.path.realpath(self.path))
self._index_ref = pt.terrier.J.IndexRef.of(os.path.realpath(self.path))
return self._index_ref

def index_obj(self):
"""Returns the internal Java index object for this index."""
if self._index_obj is None:
self._index_obj = pt.IndexFactory.of(self.index_ref())
self._index_obj = pt.terrier.IndexFactory.of(self.index_ref())
return self._index_obj

0 comments on commit 803f5ef

Please sign in to comment.