capsul.engine module¶
Main module¶
capsul.engine.database_json submodule¶
capsul.engine.database_populse submodule¶
capsul.engine.database submodule¶
- class capsul.engine.database.DatabaseEngine[source]¶
A
DatabaseEngine
is the base class for all engines allowing to store, retrieve and search metadata associated with a key that can be either a string or a path (i.e. a file or directory name).To instantiate a
DatabaseEngine
one must use the factory To date, two concreteDatabaseEngine
implementations exist:capsul.engine.database_json.JSONDBEngine
capsul.engine.database_populse.PopulseDBEngine
- check_path(path, named_directory=None)[source]¶
Find a pair (named_directory, path) given a path and eventually a named_directory.
If named_directory is not given, path must be absolute or a ValueError is raised. Then, either the corresponding named directory is found or ‘absolute’ is used.
If name_directory is given, the path must be relative (unless named_directory == ‘absolute’) or begin with the path of the named directory.
- named_directories()[source]¶
List the names of all named directories. This method may return any iterable value (list, generator, etc.)
- set_json_value(name, json_value)[source]¶
Store a json value and associate it with a key given in “name”. The value can be retrieved with method json_value().
@param name: unique key used to identify and retrieve the value @type name: C{string} @param json_value: a value to store in the database @type name: any JSON compatible value
- set_named_directory(name, path)[source]¶
Associate an absolute path to a generic name. This allow to always use a location independent name for a directory such as ‘spm_template’ and to customize the real absolute path in the configuration. These named directories are used when setting/retrieving path metadata with set_path_metadata() and path_metadata().