Skip to content

Commit bfacb3c

Browse files
committed
expand get_file_type function
1 parent a52a50a commit bfacb3c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

util/fof_utils.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,15 @@ def get_file_type(filename: str) -> FileType:
448448

449449
if "fof" in name:
450450
return FileType.FOF
451-
if "csv" in name:
451+
if "csv" in name or "stats" in name:
452452
return FileType.STATS
453+
454+
try:
455+
with open(filename, "r") as f:
456+
first_line = f.readline()
457+
if "," in first_line or ";" in first_line:
458+
return FileType.STATS
459+
except Exception:
460+
pass
453461

454462
raise ValueError(f"Unknown file type for '{filename}'")

0 commit comments

Comments
 (0)