Skip to content

Commit 10b02c6

Browse files
author
Lorenzo Pacchiardi
authored
Solve #1394 (#1395)
Simple change to fix #1394 .
1 parent 0647721 commit 10b02c6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

evals/data.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,16 @@ def zstd_open(filename: str, mode: str = "rb", openhook: Any = open) -> pyzstd.Z
4343

4444
return pyzstd.ZstdFile(openhook(filename, mode), mode=mode)
4545

46-
47-
def open_by_file_pattern(filename: str, mode: str = "r", **kwargs: Any) -> Any:
46+
def open_by_file_pattern(filename: Union[str, Path], mode: str = "r", **kwargs: Any) -> Any:
4847
"""Can read/write to files on gcs/local with or without gzipping. If file
4948
is stored on gcs, streams with blobfile. Otherwise use vanilla python open. If
5049
filename endswith gz, then zip/unzip contents on the fly (note that gcs paths and
5150
gzip are compatible)"""
5251
open_fn = partial(bf.BlobFile, **kwargs)
52+
53+
if isinstance(filename, Path):
54+
filename = filename.as_posix()
55+
5356
try:
5457
if filename.endswith(".gz"):
5558
return gzip_open(filename, openhook=open_fn, mode=mode)

0 commit comments

Comments
 (0)