MCPcopy Create free account
hub / github.com/numpy/numpy / process

Function process

tools/cythonize.py:146–164  ·  view source on GitHub ↗
(path, fromfile, tofile, processor_function, hash_db)

Source from the content-addressed store, hash-verified

144 return (from_hash, to_hash)
145
146def process(path, fromfile, tofile, processor_function, hash_db):
147 fullfrompath = os.path.join(path, fromfile)
148 fulltopath = os.path.join(path, tofile)
149 current_hash = get_hash(fullfrompath, fulltopath)
150 if current_hash == hash_db.get(normpath(fullfrompath), None):
151 print(f'{fullfrompath} has not changed')
152 return
153
154 orig_cwd = os.getcwd()
155 try:
156 os.chdir(path)
157 print(f'Processing {fullfrompath}')
158 processor_function(fromfile, tofile)
159 finally:
160 os.chdir(orig_cwd)
161 # changed target file, recompute hash
162 current_hash = get_hash(fullfrompath, fulltopath)
163 # store hash in db
164 hash_db[normpath(fullfrompath)] = current_hash
165
166
167def find_process_files(root_dir):

Callers 4

find_process_filesFunction · 0.85
testProcess1DMethod · 0.85
testProcess3DMethod · 0.85

Calls 5

get_hashFunction · 0.85
normpathFunction · 0.85
printFunction · 0.85
joinMethod · 0.45
getMethod · 0.45

Tested by 3

testProcess1DMethod · 0.68
testProcess3DMethod · 0.68