Return most recent -like subdir, or `path` itself.
(path: Path)
| 30 | |
| 31 | |
| 32 | def pick_latest_subdir(path: Path) -> Path: |
| 33 | """Return most recent <timestamp>-like subdir, or `path` itself.""" |
| 34 | candidates = [p for p in path.iterdir() if p.is_dir()] |
| 35 | if not candidates: |
| 36 | return path |
| 37 | # Prefer children that look like timestamp dirs, fall back to mtime. |
| 38 | candidates.sort(key=lambda p: p.stat().st_mtime, reverse=True) |
| 39 | return candidates[0] |
| 40 | |
| 41 | |
| 42 | def resolve_output_dir(path: Path) -> Path: |
no outgoing calls
no test coverage detected