Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /Lampx83_LakeFlow /frontend /streamlit /utils /fs_utils.py
| from pathlib import Path | |
| from typing import List, Tuple | |
| def list_dir(path: Path) -> Tuple[List[Path], List[Path]]: | |
| dirs, files = [], [] | |
| for p in sorted(path.iterdir()): | |
| if p.name.startswith("."): | |
| continue | |
| if p.is_dir(): | |
| dirs.append(p) | |
| elif p.is_file(): | |
| files.append(p) | |
| return dirs, files | |
| def list_dir_safe(path: Path) -> Tuple[List[Path], List[Tuple[Path, int]]]: | |
| """ | |
| Like list_dir but returns (dirs, [(file_path, size)]). | |
| Used for cache since size needed for display, avoids re-calling stat(). | |
| """ | |
| dirs, files = [], [] | |
| for p in sorted(path.iterdir()): | |
| if p.name.startswith("."): | |
| continue | |
| if p.is_dir(): | |
| dirs.append(p) | |
| elif p.is_file(): | |
| try: | |
| files.append((p, p.stat().st_size)) | |
| except OSError: | |
| files.append((p, 0)) | |
| return dirs, files | |
Xet Storage Details
- Size:
- 945 Bytes
- Xet hash:
- 68b18f83141f62259215ee36a7da02d1fde03a28eb161f50f7df0377f4cfd7a1
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.