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

Function check_disk_space

ci/util/pio_package_daemon.py:243–268  ·  view source on GitHub ↗

Check if sufficient disk space is available. Args: path: Path to check disk space for required_mb: Required space in MB (default: 1GB) Returns: (has_space, error_message)

(path: Path, required_mb: int = 1000)

Source from the content-addressed store, hash-verified

241
242
243def check_disk_space(path: Path, required_mb: int = 1000) -> tuple[bool, str]:
244 """Check if sufficient disk space is available.
245
246 Args:
247 path: Path to check disk space for
248 required_mb: Required space in MB (default: 1GB)
249
250 Returns:
251 (has_space, error_message)
252 """
253 try:
254 stat = shutil.disk_usage(path)
255 available_mb = stat.free / (1024 * 1024)
256
257 if available_mb < required_mb:
258 return (
259 False,
260 f"Insufficient disk space: {available_mb:.1f}MB available, {required_mb}MB required",
261 )
262
263 return True, ""
264 except KeyboardInterrupt as ki:
265 handle_keyboard_interrupt(ki)
266 raise
267 except Exception as e:
268 return False, f"Failed to check disk space: {e}"
269
270
271def is_network_error(error_output: str) -> bool:

Callers 1

process_package_requestFunction · 0.85

Calls 1

Tested by

no test coverage detected