spinn_storage_handlers.abstract_classes package

Module contents

class spinn_storage_handlers.abstract_classes.AbstractContextManager

Bases: object

Closeable class that supports being used as a simple context manager.

close()

How to actually close the underlying resources.

class spinn_storage_handlers.abstract_classes.AbstractDataReader

Bases: object

Abstract reader used to read data from somewhere.

read(n_bytes=None)

Read some bytes of data from the underlying storage. Will block until some bytes are available, but might not return the full n_bytes. The size of the returned array indicates how many bytes were read.

Parameters:n_bytes (int) – The number of bytes to read; if unspecified, read all remaining bytes
Returns:The data that was read
Return type:bytearray
Raises:IOError – If an error occurs reading from the underlying storage
tell()

Returns the position of the file cursor.

Returns:Position of the file cursor
Return type:int
class spinn_storage_handlers.abstract_classes.AbstractDataWriter

Bases: object

Abstract writer used to write data somewhere.

write(data)

Write some bytes of data to the underlying storage. Does not return until all the bytes have been written.

Parameters:data (bytearray or bytes) – The data to write
Returns:Nothing is returned
Return type:None
Raises:IOError – If an error occurs writing to the underlying storage