(path: str, hash: str, quiet: bool = False)
| 153 | |
| 154 | |
| 155 | def _assert_filehash(path: str, hash: str, quiet: bool = False) -> None: |
| 156 | if ":" not in hash: |
| 157 | raise ValueError( |
| 158 | f"Invalid hash: {hash}. " |
| 159 | "Hash must be in the format of {algorithm}:{hash_value}." |
| 160 | ) |
| 161 | algorithm = hash.split(":")[0] |
| 162 | |
| 163 | hash_actual = _compute_filehash(path=path, algorithm=algorithm) |
| 164 | |
| 165 | if hash_actual != hash: |
| 166 | raise AssertionError( |
| 167 | f"File hash doesn't match:\nactual: {hash_actual}\nexpected: {hash}" |
| 168 | ) |
searching dependent graphs…