MCPcopy Index your code
hub / github.com/python/cpython / main

Function main

Tools/msi/generate_md5.py:5–22  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3import sys
4
5def main():
6 filenames, hashes, sizes = [], [], []
7
8 for file in sys.argv[1:]:
9 if not os.path.isfile(file):
10 continue
11
12 with open(file, 'rb') as f:
13 data = f.read()
14 md5 = hashlib.md5()
15 md5.update(data)
16 filenames.append(os.path.split(file)[1])
17 hashes.append(md5.hexdigest())
18 sizes.append(str(len(data)))
19
20 print('{:40s} {:<32s} {:<9s}'.format('File', 'MD5', 'Size'))
21 for f, h, s in zip(filenames, hashes, sizes):
22 print('{:40s} {:>32s} {:>9s}'.format(f, h, s))
23
24
25

Callers 1

generate_md5.pyFile · 0.70

Calls 9

strFunction · 0.85
hexdigestMethod · 0.80
openFunction · 0.50
isfileMethod · 0.45
readMethod · 0.45
updateMethod · 0.45
appendMethod · 0.45
splitMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…