MCPcopy
hub / github.com/mne-tools/mne-python / _replace_md5

Function _replace_md5

mne/utils/numerics.py:1129–1137  ·  view source on GitHub ↗

Replace a file based on MD5sum.

(fname)

Source from the content-addressed store, hash-verified

1127
1128
1129def _replace_md5(fname):
1130 """Replace a file based on MD5sum."""
1131 # adapted from sphinx-gallery
1132 assert fname.endswith(".new")
1133 fname_old = fname[:-4]
1134 if os.path.isfile(fname_old) and hashfunc(fname) == hashfunc(fname_old):
1135 os.remove(fname)
1136 else:
1137 shutil.move(fname, fname_old)

Callers 3

generate_commands_rstFunction · 0.90
generate_contrib_avatarsFunction · 0.90
test_replace_md5Function · 0.90

Calls 2

hashfuncFunction · 0.85
removeMethod · 0.45

Tested by 1

test_replace_md5Function · 0.72