(cls, fileobj: BinaryIO, file_hash_info: dict = None)
| 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 |
no test coverage detected