(file_path, with_template=False)
| 619 | |
| 620 | |
| 621 | def _load_index(file_path, with_template=False): |
| 622 | with open(file_path, 'rb') as f: |
| 623 | bytes_index = f.read() |
| 624 | if with_template: |
| 625 | bytes_index = bytes_index.decode().replace(TEMPLATE_PATH, |
| 626 | MODELSCOPE_PATH.as_posix()) |
| 627 | wrapped_index = json.loads(bytes_index) |
| 628 | # convert str key to tuple key |
| 629 | wrapped_index[INDEX_KEY] = { |
| 630 | ast.literal_eval(k): v |
| 631 | for k, v in wrapped_index[INDEX_KEY].items() |
| 632 | } |
| 633 | return wrapped_index |
| 634 | |
| 635 | |
| 636 | def _update_index(index, files_mtime): |
no test coverage detected
searching dependent graphs…