class documentation
Wrapper for file-like object that remembers the SHA1 of its data.
| Method | __enter__ |
Enter context manager. |
| Method | __exit__ |
Exit context manager and close file. |
| Method | __init__ |
Initialize SHA1Reader. |
| Method | __iter__ |
Return iterator for reading file lines. |
| Method | __next__ |
Get next line from file. |
| Method | check |
Check if the SHA1 matches the expected value. |
| Method | close |
Close the underlying file. |
| Method | fileno |
Return file descriptor number. |
| Method | flush |
Flush the file buffer. |
| Method | isatty |
Check if file is a terminal. |
| Method | read |
Read bytes and update SHA1. |
| Method | readable |
Check if file is readable. |
| Method | readline |
Read a line from the file. |
| Method | readlines |
Read all lines from the 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 read-only file. |
| Method | writable |
Check if file is writable. |
| Method | write |
Write data to the file (not supported). |
| Method | writelines |
Write multiple lines to the file (not supported). |
| Instance Variable | f |
Undocumented |
| Instance Variable | sha1 |
Undocumented |
def __exit__(self, type:
type | None, value: BaseException | None, traceback: TracebackType | None):
¶
Exit context manager and close file.
Check if the SHA1 matches the expected value.
| Parameters | |
allowbool | Allow empty SHA1 hash |
| Raises | |
ChecksumMismatch | If SHA1 doesn't match |