MCPcopy Index your code
hub / github.com/modelscope/modelscope / _load_index

Function _load_index

modelscope/utils/ast_utils.py:621–633  ·  view source on GitHub ↗
(file_path, with_template=False)

Source from the content-addressed store, hash-verified

619
620
621def _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
636def _update_index(index, files_mtime):

Callers 2

load_indexFunction · 0.85
load_from_prebuiltFunction · 0.85

Calls 4

replaceMethod · 0.80
readMethod · 0.45
decodeMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…