LoaderAbstract#
- class LoaderAbstract(params=None, **kwargs)#
Bases:
Generic[T_Source_contra,T_Data],ModuleAbstract class of Loader module.
The Loader is tasked with opening the data into Python. It may run post-processing if defined by the user.
- Parameters:
params (Any | None)
kwargs (Any)
- 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
postprocessof the parent interface. If it raises NotImplementedError, postprocess will be ignored.- Parameters:
source (T_Source_contra | Sequence[T_Source_contra] | 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 (Any) – Arguments passed to the postprocessing function.
- Return type:
- 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 module subclass.
- Parameters:
source (T_Source_contra | Sequence[T_Source_contra])
kwargs (Any)
- Return type: