Skip to content

Commit f8e5829

Browse files
committed
case insensitive suffix matching for robust04
1 parent 3ba65e8 commit f8e5829

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ir_datasets/formats/trec.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,11 @@ def docs_iter(self):
113113

114114
def _docs_iter(self, path):
115115
if Path(path).is_file():
116-
spath = str(path)
117-
if spath.endswith('.gz'):
116+
path_suffix = Path(path).suffix.lower()
117+
if path_suffix == '.gz':
118118
with gzip.open(path, 'rb') as f:
119119
yield from self._parser(f)
120-
elif any(spath.endswith(ext) for ext in ['.z', '.0z', '.1z', '.2z']):
120+
elif path_suffix in ['.z', '.0z', '.1z', '.2z']:
121121
# unix "compress" command encoding
122122
unlzw3 = ir_datasets.lazy_libs.unlzw3()
123123
with io.BytesIO(unlzw3.unlzw(path)) as f:

0 commit comments

Comments
 (0)