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

Function _compute_hash

pavement.py:121–139  ·  view source on GitHub ↗

Hash files using given hashfunc. Parameters ---------- idirs : directory path Directory containing files to be hashed. hashfunc : hash function Function to be used to hash the files.

(idirs, hashfunc)

Source from the content-addressed store, hash-verified

119#-------------
120
121def _compute_hash(idirs, hashfunc):
122 """Hash files using given hashfunc.
123
124 Parameters
125 ----------
126 idirs : directory path
127 Directory containing files to be hashed.
128 hashfunc : hash function
129 Function to be used to hash the files.
130
131 """
132 released = paver.path.path(idirs).listdir()
133 checksums = []
134 for fpath in sorted(released):
135 with open(fpath, 'rb') as fin:
136 fhash = hashfunc(fin.read())
137 checksums.append(
138 '%s %s' % (fhash.hexdigest(), os.path.basename(fpath)))
139 return checksums
140
141
142def compute_md5(idirs):

Callers 2

compute_md5Function · 0.85
compute_sha256Function · 0.85

Calls 3

openFunction · 0.85
listdirMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected