MCPcopy Create free account
hub / github.com/modelscope/modelscope / from_bytes

Method from_bytes

modelscope/utils/repo_utils.py:431–434  ·  view source on GitHub ↗
(cls, data: bytes, file_hash_info: dict = None)

Source from the content-addressed store, hash-verified

429
430 @classmethod
431 def from_bytes(cls, data: bytes, file_hash_info: dict = None):
432 file_hash_info = file_hash_info or compute_file_hash(data)
433 sha = file_hash_info['file_hash']
434 return cls(size=len(data), sample=data[:512], sha256=sha)
435
436 @classmethod
437 def from_fileobj(cls, fileobj: BinaryIO, file_hash_info: dict = None):

Callers 1

__post_init__Method · 0.80

Calls 1

compute_file_hashFunction · 0.90

Tested by

no test coverage detected