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

Method _compute_md5

ci/fingerprint/core.py:123–144  ·  view source on GitHub ↗

Compute MD5 hash of file content. Args: file_path: Path to file to hash Returns: MD5 hash as hexadecimal string Raises: IOError: If file cannot be read

(self, file_path: Path)

Source from the content-addressed store, hash-verified

121 json.dump(data, f, indent=2)
122
123 def _compute_md5(self, file_path: Path) -> str:
124 """
125 Compute MD5 hash of file content.
126
127 Args:
128 file_path: Path to file to hash
129
130 Returns:
131 MD5 hash as hexadecimal string
132
133 Raises:
134 IOError: If file cannot be read
135 """
136 try:
137 hasher = hashlib.md5()
138 with open(file_path, "rb") as f:
139 # Read in chunks to handle large files efficiently
140 for chunk in iter(lambda: f.read(8192), b""):
141 hasher.update(chunk)
142 return hasher.hexdigest()
143 except IOError as e:
144 raise IOError(f"Cannot read file {file_path}: {e}") from e
145
146 def has_changed(self, src_path: Path, previous_modtime: float) -> bool:
147 """

Callers 1

has_changedMethod · 0.95

Calls 2

readMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected