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

Method _save

ci/util/version_lockfile.py:71–93  ·  view source on GitHub ↗

Save lockfile data to disk with locking.

(self)

Source from the content-addressed store, hash-verified

69 return self._data
70
71 def _save(self) -> bool:
72 """Save lockfile data to disk with locking."""
73 if self._data is None:
74 return False
75
76 try:
77 # Ensure parent directory exists
78 self.lockfile_path.parent.mkdir(parents=True, exist_ok=True)
79
80 # Update timestamp
81 self._data["updated_at"] = datetime.now().isoformat()
82
83 # Use write lock to prevent concurrent modifications
84 lock: FileLock = write_lock(self.lockfile_path)
85 with lock:
86 with open(self.lockfile_path, "w") as f:
87 json.dump(self._data, f, indent=2, sort_keys=True)
88
89 return True
90
91 except OSError as e:
92 logger.warning(f"Failed to save lockfile {self.lockfile_path}: {e}")
93 return False
94
95 def get_pinned_version(
96 self, package_name: str, requirement: str, package_type: str = "tool"

Callers 3

pin_versionMethod · 0.95
clear_pinsMethod · 0.95
upgrade_packageMethod · 0.95

Calls 4

write_lockFunction · 0.90
warningMethod · 0.80
nowMethod · 0.45
dumpMethod · 0.45

Tested by

no test coverage detected