class documentation
Wrapper for file-like object that computes hash of its data.
This is a generic version that works with any hash algorithm.
| Method | __enter__ |
Enter context manager. |
| Method | __exit__ |
Exit context manager and close file. |
| Method | __init__ |
Initialize HashWriter. |
| Method | __iter__ |
Return iterator. |
| Method | __next__ |
Not supported for write-only file. |
| Method | close |
Close the pack file and finalize the hash. |
| Method | fileno |
Return file descriptor number. |
| Method | flush |
Flush the file buffer. |
| Method | isatty |
Check if file is a terminal. |
| Method | offset |
Get the total number of bytes written. |
| Method | read |
Not supported for write-only file. |
| Method | readable |
Check if file is readable. |
| Method | readline |
Not supported for write-only file. |
| Method | readlines |
Not supported for write-only file. |
| Method | seek |
Seek to position in file. |
| Method | seekable |
Check if file is seekable. |
| Method | tell |
Return current file position. |
| Method | truncate |
Not supported for write-only file. |
| Method | writable |
Check if file is writable. |
| Method | write |
Write data and update hash. |
| Method | write |
Write the hash digest to the file. |
| Method | writelines |
Write multiple lines to the file. |
| Instance Variable | digest |
Undocumented |
| Instance Variable | f |
Undocumented |
| Instance Variable | hash |
Undocumented |
| Instance Variable | length |
Undocumented |
def __exit__(self, type:
type | None, value: BaseException | None, traceback: TracebackType | None):
¶
Exit context manager and close file.
Write data and update hash.
| Parameters | |
data:bytes | bytearray | memoryview | Data to write |
| Returns | |
int | Number of bytes written |