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

Function download_and_untar

modelscope/utils/test_utils.py:95–110  ·  view source on GitHub ↗
(fpath, furl, dst)

Source from the content-addressed store, hash-verified

93
94
95def download_and_untar(fpath, furl, dst) -> str:
96 if not os.path.exists(fpath):
97 r = requests.get(furl)
98 with open(fpath, 'wb') as f:
99 f.write(r.content)
100
101 file_name = os.path.basename(fpath)
102 root_dir = os.path.dirname(fpath)
103 target_dir_name = os.path.splitext(os.path.splitext(file_name)[0])[0]
104 target_dir_path = os.path.join(root_dir, target_dir_name)
105
106 # untar the file
107 t = tarfile.open(fpath)
108 t.extractall(path=dst)
109
110 return target_dir_path
111
112
113def get_case_model_info():

Calls 4

openMethod · 0.80
existsMethod · 0.45
getMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…