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

Method from_fileobj

modelscope/utils/repo_utils.py:437–445  ·  view source on GitHub ↗
(cls, fileobj: BinaryIO, file_hash_info: dict = None)

Source from the content-addressed store, hash-verified

435
436 @classmethod
437 def from_fileobj(cls, fileobj: BinaryIO, file_hash_info: dict = None):
438 file_hash_info: dict = file_hash_info or compute_file_hash(fileobj)
439 fileobj.seek(0, os.SEEK_SET)
440 sample = fileobj.read(512)
441 fileobj.seek(0, os.SEEK_SET)
442 return cls(
443 sha256=file_hash_info['file_hash'],
444 size=file_hash_info['file_size'],
445 sample=sample)
446
447
448@dataclass

Callers 1

__post_init__Method · 0.80

Calls 3

compute_file_hashFunction · 0.90
seekMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected