Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /Lampx83_LakeFlow /frontend /streamlit /__init__.py
| from pathlib import Path | |
| from typing import List, Tuple | |
| def list_dir(path: Path) -> Tuple[List[Path], List[Path]]: | |
| """ | |
| List subdirectories and files in a directory. | |
| Parameters | |
| ---------- | |
| path : Path | |
| Directory to traverse | |
| Returns | |
| ------- | |
| (dirs, files) : tuple[list[Path], list[Path]] | |
| - dirs : list of directories (sorted by name) | |
| - files : list of files (sorted by name) | |
| """ | |
| if not path.exists(): | |
| raise FileNotFoundError(f"Path does not exist: {path}") | |
| if not path.is_dir(): | |
| raise NotADirectoryError(f"Path is not a directory: {path}") | |
| dirs: List[Path] = [] | |
| files: List[Path] = [] | |
| for p in path.iterdir(): | |
| # Skip hidden files / folders | |
| if p.name.startswith("."): | |
| continue | |
| if p.is_dir(): | |
| dirs.append(p) | |
| elif p.is_file(): | |
| files.append(p) | |
| # Sort for stable UI rendering | |
| dirs.sort(key=lambda x: x.name.lower()) | |
| files.sort(key=lambda x: x.name.lower()) | |
| return dirs, files | |
Xet Storage Details
- Size:
- 1.06 kB
- Xet hash:
- 8a851e1f7018619eabbcd5b5f70389dcbc1faaaa52b369602c89e9e258c7dea1
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.