LoaderAbstract#

class LoaderAbstract(params=None, **kwargs)#

Bases: Generic[T_Source, T_Data], Module

Abstract class of Loader plugin.

The Loader is tasked with opening the data into Python. It may run post-processing if defined by the user.

Parameters:

params (t.Any | None)

__weakref__#

list of weak references to the object

get_data(*, source=None, ignore_postprocess=False, load_kwargs=None, **kwargs)#

Load data and run post-processing.

The actual loading is done by load_data_concrete() that can be overwritten by subclasses.

Tries to run the method postprocess of the parent dataset. If it raises NotImplementedError, postprocess will be ignored.

Parameters:
  • source (T_Source | Sequence[T_Source] | None) – Source location of the data to load. If left to None, get_source() is used.

  • ignore_postprocess (bool) – If True, do not apply postprocessing. Default is False.

  • load_kwargs (Mapping[str, Any] | None) – Arguments passed to function loading data.

  • kwargs – Arguments passed to the postprocessing function.

Return type:

T_Data

load_data_concrete(source, **kwargs)#

Load the data from datafiles.

This method should be implemented in subclasses to account for different format, libraries, etc.

Not implemented:

implement in a plugin subclass.

Parameters:

source (T_Source | Sequence[T_Source])

Return type:

Any

postprocess(data)#

Run operation after loading data.

Not implemented:

implement (if necessary) on your DataManager subclass.

Parameters:

data (T_Data)

Return type:

T_Data