MCPcopy Index your code
hub / github.com/modelscope/modelscope / compute_checksum

Function compute_checksum

modelscope/utils/plugins.py:530–539  ·  view source on GitHub ↗
(target, algorithm='sha256', blocksize=2**13)

Source from the content-addressed store, hash-verified

528 return filename, headers
529
530 def compute_checksum(target, algorithm='sha256', blocksize=2**13):
531 hashtype = getattr(hashlib, algorithm)
532 hash_ = hashtype()
533 logger.debug('computing checksum', target=target, algorithm=algorithm)
534 with open(target, 'rb') as f:
535 for chunk in iter(lambda: f.read(blocksize), b''):
536 hash_.update(chunk)
537 result = hash_.hexdigest()
538 logger.debug('computed checksum', result=result)
539 return result
540
541 def _get_pip_version():
542 # try to get pip version without actually importing pip

Callers 1

getFunction · 0.85

Calls 2

readMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…