devforfu
commited on
Commit
·
7b1ae8d
1
Parent(s):
347efcc
A util to list files in a folder
Browse files- realfake/utils.py +4 -0
realfake/utils.py
CHANGED
@@ -120,3 +120,7 @@ def find_latest_checkpoint(dirname: Path) -> Path:
|
|
120 |
return None
|
121 |
latest = max(checkpoints, key=lambda path: path.stat().st_mtime)
|
122 |
return latest
|
|
|
|
|
|
|
|
|
|
120 |
return None
|
121 |
latest = max(checkpoints, key=lambda path: path.stat().st_mtime)
|
122 |
return latest
|
123 |
+
|
124 |
+
|
125 |
+
def list_files(dirname: Path, exts: list[str]) -> list:
|
126 |
+
return [fn for fn in Path(dirname).iterdir() for ext in exts if fn.match(f"*.{ext}")]
|