MCPcopy Create free account
hub / github.com/FastLED/FastLED / check_cached_download

Function check_cached_download

ci/util/download_breadcrumb.py:185–220  ·  view source on GitHub ↗

Check if a URL has been downloaded and cached successfully. Args: cache_dir: Base cache directory url: URL to check expected_filename: If provided, also verify this file exists Returns: Path to the cached artifact directory if complete, None otherwise

(
    cache_dir: Path, url: str, expected_filename: Optional[str] = None
)

Source from the content-addressed store, hash-verified

183
184
185def check_cached_download(
186 cache_dir: Path, url: str, expected_filename: Optional[str] = None
187) -> Optional[Path]:
188 """
189 Check if a URL has been downloaded and cached successfully.
190
191 Args:
192 cache_dir: Base cache directory
193 url: URL to check
194 expected_filename: If provided, also verify this file exists
195
196 Returns:
197 Path to the cached artifact directory if complete, None otherwise
198 """
199 artifact_dir = get_cache_artifact_dir(cache_dir, url)
200 breadcrumb_path = get_breadcrumb_path(cache_dir, url)
201
202 # Check if breadcrumb indicates completion
203 if not is_download_complete(breadcrumb_path):
204 return None
205
206 # Check if artifact directory exists
207 if not artifact_dir.exists():
208 logger.warning(
209 f"Breadcrumb exists but artifact directory missing: {artifact_dir}"
210 )
211 return None
212
213 # If expected filename provided, verify it exists
214 if expected_filename:
215 expected_path = artifact_dir / expected_filename
216 if not expected_path.exists():
217 logger.warning(f"Expected file missing: {expected_path}")
218 return None
219
220 return artifact_dir

Callers 1

download_toolchainFunction · 0.90

Calls 4

get_cache_artifact_dirFunction · 0.85
get_breadcrumb_pathFunction · 0.85
is_download_completeFunction · 0.85
warningMethod · 0.80

Tested by

no test coverage detected