dip.io.storage

The dip.io.storage module implements support for specific storage types.

QIODeviceStorage

class dip.io.storage.QIODeviceStorage

Base class: BaseStorage

The QIODeviceStorage class is an abstract base class for storage that is accessed via a QIODevice.

read_buffer_size = Int(16384)

The number of bytes to read at a time.

implicit_location(model)

Return the implicit storage location for a model.

Parameters:model – is the model.
Returns:None as devices typically have explicit locations.
qiodevice(location)

A storage location is converted to a QIODevice instance. This must be reimplemented by a sub-class.

Parameters:location – is the storage location.
Returns:the QIODevice.
read(model, location)

Read a model from a filesystem location.

Parameters:
  • model – is the model.
  • location – is the filesystem location where the model is read from.
Returns:

the read model. This may be the original model populated from the filesystem location, or it may be a different model (of an appropriate type) created from the filesystem location. If None is returned then it is assumed that the read was abandoned and the user informed appropriately.

write(model, location)

Write a model to a filesystem location.

Parameters:
  • model – is the model.
  • location – is the filesystem location where the model is written to.