owmeta_core.datasource_loader module¶
DataSourceLoaders take a DataSource and retrieve the primary data (e.g., CSV files, electrode recordings) from some location (e.g., a file store, via a bittorrent tracker).
Each loader can treat the base_directory given as its own namespace and place directories in there however it wants.
- exception owmeta_core.datasource_loader.LoadFailed(data_source, loader, *args)[source]¶
Bases:
ExceptionThrown when loading fails for a .DataSourceDirLoader
- Parameters
- data_source
DataSource The
DataSourceon which loading was attempted- loader
DataSourceDirLoader The loader that attempted to load the data source
- args[0]
str Message explaining why loading failed
- args[1:]
Passed on to
Exception
- data_source
- class owmeta_core.datasource_loader.DataSourceDirLoader(base_directory=None, directory_key=None)[source]¶
Bases:
objectLoads data files for a DataSource
The loader is expected to organize files for each data source within the given base directory.
- __call__(data_source)[source]¶
Load the data source. Calls
load- Parameters
- data_source
DataSource The data source to load files for
- data_source
- Returns
strA path to the loaded resource
- Raises
LoadFailedIf
load:throws an exception
doesn’t return anything
returns a path that isn’t under
base_directoryreturns a path that doesn’t exist
- can_load(data_source)[source]¶
Returns true if the
DataSourcecan be loaded by this loader- Parameters
- data_source
DataSource The data source to load files for
- data_source
- load(data_source)[source]¶
Loads the files for the data source
- Parameters
- data_source
DataSource The data source to load files for
- data_source
- Returns
strA path to the loaded resource