Extracts the commit hash from a resolved filename toward a cache file.
(resolved_file: str | None, commit_hash: str | None = None)
| 202 | |
| 203 | |
| 204 | def extract_commit_hash(resolved_file: str | None, commit_hash: str | None = None): |
| 205 | """ |
| 206 | Extracts the commit hash from a resolved filename toward a cache file. |
| 207 | """ |
| 208 | if resolved_file is None or commit_hash is not None: |
| 209 | return commit_hash |
| 210 | resolved_file = str(Path(resolved_file).as_posix()) |
| 211 | search = re.search(r"snapshots/([^/]+)/", resolved_file) |
| 212 | if search is None: |
| 213 | return None |
| 214 | commit_hash = search.groups()[0] |
| 215 | return commit_hash if REGEX_COMMIT_HASH.match(commit_hash) else None |
| 216 | |
| 217 | |
| 218 | def _add_variant(weights_name: str, variant: str | None = None) -> str: |
no outgoing calls
no test coverage detected
searching dependent graphs…