corelay.io

IO-related module for Processor data

class corelay.io.DataStorageBase(**kwargs)[source]

Bases: Plugboard

Implements a key, value storage object.

at(**kwargs)[source]

Return a copy of the instance where kwargs become the attributes of the class. I.e. a specific self.data_key is set so that self.write(data) automatically writes the data to correct key.

close()[source]

Close opened io file object.

abstract exists()[source]

Return True if data exists.

abstract keys()[source]

Return keys of the io file object.

abstract read(data_in=None, meta=None)[source]

Should implement read functionality.

abstract write(data_out, data_in=None, meta=None)[source]

Should implement write functionality.

class corelay.io.HDF5Storage(path, mode='r', **kwargs)[source]

Bases: DataStorageBase

HDF5 storage that stores data under different keys.

exists()[source]

Returns True if key exists in self.io.

keys()[source]

Return keys of the storage.

read(data_in=None, meta=None)[source]
Return type

data for a given key

write(data_out, data_in=None, meta=None)[source]
Parameters

data_out (np.ndarray, dict) – Data being stored. Dictionaries are pickled and stored as strings.

exception corelay.io.NoDataSource(message='No Data Source available.')[source]

Bases: Exception

Raise when no data source available.

exception corelay.io.NoDataTarget[source]

Bases: Exception

Raise when no target source available.

class corelay.io.NoStorage(**kwargs)[source]

Bases: DataStorageBase

Stub class when no Storage is used.

exists()[source]

Return True if data exists.

keys()[source]

Return keys of the io file object.

read(data_in=None, meta=None)[source]

Should implement read functionality.

write(data_out, data_in=None, meta=None)[source]

Should implement write functionality.

class corelay.io.PickleStorage(path, mode='r', **kwargs)[source]

Bases: DataStorageBase

Experimental pickle storage that uses pickle to store data.

exists()[source]

Return True if key exists in self.keys().

keys()[source]

Return keys from self.data. Need to load the complete pickle at first read.

read(data_in=None, meta=None)[source]

Return data for a given key. Need to load the complete pickle at first read. After the data is cached.

Return type

data for a given key

write(data_out, data_in=None, meta=None)[source]

Write and pickle the data as: {“data”: data, “key”: key}

Parameters

data_out (np.ndarray, dict) – Data being stored.

class corelay.io.Storable[source]

Bases: object

Abstract class to check for write/ read attributes via isinstance

Modules

corelay.io.hashing

Persistent, non-cryptographic hashing of python objects.

corelay.io.storage

'io module contains classes to load and dump different files like hdf5, etc.