Create a breadcrumb for a completed download with metadata. Args: cache_dir: Base cache directory url: URL that was downloaded status: Download status (default: "complete") **metadata: Additional metadata to include in breadcrumb Returns: True i
(
cache_dir: Path,
url: str,
status: str = "complete",
**metadata: Any,
)
| 113 | |
| 114 | |
| 115 | def create_download_breadcrumb( |
| 116 | cache_dir: Path, |
| 117 | url: str, |
| 118 | status: str = "complete", |
| 119 | **metadata: Any, |
| 120 | ) -> bool: |
| 121 | """ |
| 122 | Create a breadcrumb for a completed download with metadata. |
| 123 | |
| 124 | Args: |
| 125 | cache_dir: Base cache directory |
| 126 | url: URL that was downloaded |
| 127 | status: Download status (default: "complete") |
| 128 | **metadata: Additional metadata to include in breadcrumb |
| 129 | |
| 130 | Returns: |
| 131 | True if breadcrumb was created successfully |
| 132 | """ |
| 133 | breadcrumb_path = get_breadcrumb_path(cache_dir, url) |
| 134 | |
| 135 | data = { |
| 136 | "status": status, |
| 137 | "url": url, |
| 138 | "timestamp": datetime.now().isoformat(), |
| 139 | **metadata, |
| 140 | } |
| 141 | |
| 142 | return write_breadcrumb(breadcrumb_path, data) |
| 143 | |
| 144 | |
| 145 | def update_breadcrumb_status( |
no test coverage detected