MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / verifyChecksum

Function verifyChecksum

samples/python/downloader.py:158–179  ·  view source on GitHub ↗

Verify the checksum of the files described by the YAML. Return false of any of the file doesn't existed or checksum is different with the YAML.

(data_dir, yaml_path)

Source from the content-addressed store, hash-verified

156
157
158def verifyChecksum(data_dir, yaml_path):
159 """Verify the checksum of the files described by the YAML.
160
161 Return false of any of the file doesn't existed or checksum is different with the YAML.
162 """
163 sample_data = _loadYAML(yaml_path)
164 logger.info("Verifying data files and their MD5 for %s", sample_data.sample)
165
166 allGood = True
167 for f in sample_data.files:
168 fpath = os.path.join(data_dir, f.path)
169 if os.path.exists(fpath):
170 if _checkMD5(fpath, f.checksum):
171 logger.info("MD5 match for local copy %s", fpath)
172 else:
173 logger.error("Local file %s has a different checksum!", fpath)
174 allGood = False
175 else:
176 allGood = False
177 logger.error("Data file %s doesn't have a local copy", f.path)
178
179 return allGood
180
181
182def main():

Callers 1

mainFunction · 0.85

Calls 4

_loadYAMLFunction · 0.85
_checkMD5Function · 0.85
infoMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected