angelos.archive7.base¶
Base classes.
-
class
angelos.archive7.base.BaseFileObject(filename: unicode, mode: unicode = 'r')¶ Bases:
abc.ABC,io.RawIOBaseFileIO-compliant and transparent abstract file object layer.
-
close()¶ Flush and close the IO object.
This method has no effect if the file is already closed.
-
fileno()¶ Return underlying file descriptor (an int) if one exists.
An OSError is raised if the IO object does not use a file descriptor.
-
flush()¶ Flush write buffers, if applicable.
This is not implemented for read-only and non-blocking streams.
-
isatty()¶ Return true if the file is connected to a TTY device.
-
property
mode¶ File mode as string.
-
property
name¶ Name of the file a string.
-
readable()¶ Return true if file was opened in a read mode.
-
readinto(b)¶ Read bytes into a pre-allocated bytes-like object b.
Returns an int representing the number of bytes read (0 for EOF), or None if the object is set not to block and has no data to read.
-
seek(offset, whence=0)¶ Change stream position.
Change the stream position to byte offset pos. Argument pos is interpreted relative to the position indicated by whence. Values for whence are ints: * 0 – start of stream (the default); offset should be zero or positive * 1 – current stream position; offset may be negative * 2 – end of stream; offset is usually negative Some operating systems / file systems could provide additional values. Return an int indicating the new absolute position.
-
seekable()¶ Return true if file supports random-access.
-
tell()¶ Tell current IO position.
-
truncate(size=None)¶ Truncate file to size bytes.
Size defaults to the current IO position as reported by tell(). Return the new size.
-
writable()¶ If file is writable, returns True, else False.
-
write(b)¶ Write the given buffer to the IO stream.
Returns the number of bytes written, which may be less than the length of b in bytes.
-
-
exception
angelos.archive7.base.BlockError¶ Bases:
RuntimeErrorException for block error.
-
DIGEST_MISMATCH= ('Corrupt data, digest mismatch.', 51)¶
-
HEADER_REFERENCE_ERROR= ('Block header self-referencing.', 50)¶
-
-
exception
angelos.archive7.base.StreamError¶ Bases:
RuntimeErrorException for stream error.
-
NON_BLOCK_ERROR= ('Can not push a non-block on stream.', 60)¶
-
OUT_OF_BOUNDS= ('Index out of bounds.', 64)¶
-
POP_NOT_LAST_ERROR= ('Can not pop last block off of stream.', 63)¶
-
POP_READ_ERROR= ('Can only pop from the end of the stream.', 65)¶
-
POP_REAR_ERROR= ('Can only pop from the end of the stream.', 62)¶
-
PUSH_FRONT_ERROR= ('Can only push at the end of the stream.', 61)¶
-
-
exception
angelos.archive7.base.StreamManagerError¶ Bases:
RuntimeErrorException for stream manager error.
-
ALREADY_OPEN= ('Already opened', 89)¶
-
BLOCK_SEEK_ERROR= ('Failed to seek for position', 85)¶
-
CORRUPT_STREAM_IDENTIFIER= ('Corrupt internal stream identifier', 81)¶
-
FAILED_FULL_WRITE= ('Failed writing full block.', 83)¶
-
FAILED_SEEK_POSITION= ('Failed to seek for position.', 88)¶
-
INDEX_POSITION_MISMATCH= ('Index and position are not the same.', 87)¶
-
NOT_OPEN= ('Stream not known to be open.', 91)¶
-
NO_STREAM_IDENTITY= ("Identity doesn't exist", 90)¶
-
OUT_OF_BOUNDS= ('Index out of bounds.', 84)¶
-
SPECIAL_BLOCK_BOUNDARY= ('Index must be within defined boundaries.', 82)¶
-
SPECIAL_STREAM_BOUNDARY= ('Index must be within defined boundaries.', 86)¶
-
UNEVEN_ARCHIVE_LENGTH= ('Archive length uneven to block size.', 80)¶
-