dimod.serialization.fileview.FileView

class FileView(bqm, version=(1, 0))[source]

A seekable, readable view into a binary quadratic model.

Parameters:bqm (BQM) – The binary quadratic model.

Note

Currently the BQM is not locked while the file view is open, in the future this will change.

__init__(bqm, version=(1, 0))[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(bqm[, version]) Initialize self.
close() Close the file view.
fileno Returns underlying file descriptor if one exists.
flush Flush write buffers, if applicable.
isatty Return whether this is an ‘interactive’ stream.
read
readable() Return whether object was opened for reading.
readall Read until EOF, using multiple read() call.
readinto(buff) Read bytes into a pre-allocated, writable bytes-like object.
readinto1(buff) Read bytes into a pre-allocated, writable bytes-like object.
readline Read and return a line from the stream.
readlines Return a list of lines from the stream.
seek(offset[, whence]) Change the stream position to the given offset.
seekable() Return whether object supports random access.
tell Return current stream position.
truncate Truncate file to size bytes.
writable Return whether object was opened for writing.
write
writelines

Attributes

SEEK_LINEAR
SEEK_OFFSET
SEEK_QUADRATIC
closed
header The header associated with the BQM.
header_end The location (in bytes) that the header ends.
linear_end The location (in bytes) that the linear data end.
linear_start The location (in bytes) that the linear data starts.
neighborhood_starts The indices of the neighborhood starts.
offset_end
offset_start The location (in bytes) that the offset starts.
quadratic_end The location (in bytes) that the quadratic data end.
quadratic_start The location (in bytes) that the quadratic data starts.
variables_end
variables_section The variables section as bytes.
variables_start