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

Function custom_lock

ci/util/file_lock_rw.py:275–298  ·  view source on GitHub ↗

Create a lock with a custom lock file path. Useful when you want to lock a resource that isn't a file, or when you need a specific lock file location. Args: lock_file_path: Explicit path to the lock file timeout: Optional timeout in seconds operation: Descr

(
    lock_file_path: Path, timeout: float | None = None, operation: str = "custom"
)

Source from the content-addressed store, hash-verified

273
274
275def custom_lock(
276 lock_file_path: Path, timeout: float | None = None, operation: str = "custom"
277) -> FileLock:
278 """
279 Create a lock with a custom lock file path.
280
281 Useful when you want to lock a resource that isn't a file,
282 or when you need a specific lock file location.
283
284 Args:
285 lock_file_path: Explicit path to the lock file
286 timeout: Optional timeout in seconds
287 operation: Description of the operation
288
289 Returns:
290 FileLock context manager
291
292 Example:
293 lock_path = cache_dir / "download.lock"
294 with custom_lock(lock_path, timeout=5.0, operation="download") as lock:
295 # Perform locked operation
296 download_file(url, dest)
297 """
298 return FileLock(lock_file_path, timeout=timeout, operation=operation)
299
300
301def download_lock(artifact_dir: Path, timeout: float = 5.0) -> FileLock:

Callers 1

download_artifactMethod · 0.90

Calls 1

FileLockClass · 0.85

Tested by

no test coverage detected