Buckets:
| from pathlib import Path | |
| from typing import Optional | |
| ROOT_DIR = Path(__file__).resolve().parent | |
| def get_absolute_path(path_from_root: str) -> str: | |
| absolute_path = ROOT_DIR / path_from_root | |
| return str(absolute_path.resolve()) | |
| def ensure_absolute_path(path: str) -> str: | |
| """Ensures a path is absolute. | |
| Args: | |
| path: The path to validate. | |
| Returns: | |
| Absolute path as string | |
| """ | |
| if path is None: | |
| raise ValueError("Path cannot be None") | |
| # Check if it's an S3 URL - S3 URLs are absolute by definition | |
| if path.startswith("s3://"): | |
| return path | |
| path_obj = Path(path).expanduser() | |
| if path_obj.is_absolute(): | |
| return str(path_obj.resolve()) | |
| raise ValueError(f"Path must be absolute. Got relative path: {path}") | |
Xet Storage Details
- Size:
- 793 Bytes
- Xet hash:
- d15a420aa5fcda97f73b6c907dcf8beb65bdc7fc3f5260674ae0c84ce9ffdedc
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.