ploteries.base_handlers

Classes

DataHandler()

Handler()

Base class for :class:`~ploteries.figure_handler.FigureHandler`s and :class:`DataHandler`s

class ploteries.base_handlers.Handler

Base class for :class:`~ploteries.figure_handler.FigureHandler`s and :class:`DataHandler`s

abstract classmethod from_def_record(data_store, data_def_record)

Initializes a data handler object from a raw (encoded) record from the data store’s data_defs table.

classmethod from_name(data_store, name, connection=None)

Loads the handler starting with the handler name.

abstract property data_store

Contains a DataStore object.

abstract property decoded_data_def

Contains the Row retrieved from the data_defs table, with decoded parameters.

abstract classmethod get_defs_table(data_store)

Returns the defs table (e..g., data_defs or figure_defs)

classmethod decode_params(params)

In-place decoding of the the params field of the data_defs record.

encode_params(**extra_params)

Produces the params field to place in the data_defs record.

classmethod load_decode_def(data_store, name, connection=None, check=True) bool | Row

Loads and decodes the definition from the the data defs table, if it exists, returning the decoded data def row if successful.

Returns False if no data def is found in the table, or the data def row if it is found.

write_def(connection=None, mode='insert', extra_params={})

Adds an entry to the data defs table and returns True if successful. If an entry already exists, returns False.

class ploteries.base_handlers.DataHandler
classmethod get_defs_table(data_store)

Returns the defs table (e..g., data_defs or figure_defs)

abstract encode_record_bytes(record_data) bytes

Encodes the record’s data to bytes to be added to the 'bytes' field of the data_records table.

abstract decode_record_bytes(record_bytes: bytes)

Decodes the record’s 'bytes' field to produce the record’s data.

add_data(index, record_data, connection=None)

Add new data row.

load_data(*criterion, single_record=False, connection=None)

By default, loads all the records owned by this handler.

Parameters:

criterion – Passed as extra args to a where clause to further restrict the number of records

abstract merge_records_data(records_data)

Merges the list of decoded record bytes to create the 'data' field of the dictionary output by the load function.

__len__(connection=None)

Returns the number of records in the array (i.e., the first dimension of the array). The shape of the entire stored array is hence (len(self), *self.recdims).