mloq.record
Contents
mloq.record
#
This module contains the classes that keep track of the internal state of the application when running a Command.
Module Contents#
Classes#
Keep track of the generated files. |
|
Keep track of files and directories that will be created by mloq. |
- class mloq.record.Ledger[source]#
Keep track of the generated files.
- property files#
Return the list of generated file names.
- Return type
List[Tuple[str, str]]
- register(file, description=None)[source]#
Append another generated file to the book.
- Parameters
file (Union[mloq.files.File, str, pathlib.Path]) –
description (Optional[str]) –
- Return type
None
- class mloq.record.CMDRecord(config=None, files=None, directories=None)[source]#
Keep track of files and directories that will be created by mloq.
The
CMDRecord
acts as a single source of truth for storing the files and directories generated by mloq as well as the necessary configuration to generate them.This class registers three separate data sources:
- config:
An
omegaconf.DictConfig
that contains the configuration of all the commands executed by mloq.
- files:
A dict containing the content and location of the files generated by mloq. It is indexed by
Path
objects that indicate where the file will be created, and its values are instances ofmloq.files.File
.
- directories:
List of
Path
instances pointing to the different directories that mloq will create.
This class is initialized from a configuration dictionary. The dictionary can be either an
omegaconf.DictConfig
or an empty dictionary.- Parameters
config (Optional[omegaconf.DictConfig]) –
files (Optional[Dict[pathlib.Path, mloq.files.File]]) –
directories (Optional[List[pathlib.Path]]) –
- property config#
Store the configuration parameters that govern the project’s structure.
It contains one configuration entry per each
Command
that will be run, and each entry will only be modified by theCommand
it represents. EachCommand
instance is responsible for updating its corresponding config values.- Returns
omegaconf.DictConfig
that contains the configuration of all the commands executed by mloq.- Return type
omegaconf.DictConfig
- property files#
Return the dictionary of files used by mloq to generate the project configuration.
files is a dict containing the content and location of the files generated by mloq. It is indexed by
Path
objects that indicate where the file will be created, and its values are instances ofmloq.files.File
.Each different
Command
is responsible for registering the files it generates to the files dictionary.- Return type
Dict[pathlib.Path, mloq.files.File]
- property directories#
Contain the folders that will be created by mloq for storing the project’s files.
- Return type
List[pathlib.Path]
- update_config(config)[source]#
Update the configuration attribute according to the values entered by the user.
- Parameters
config (omegaconf.DictConfig) –
- Return type
None
- register_file(file, path, description=None)[source]#
Append a new file to the ‘files’ container.
Keys are Path strings describing the location where the file will be created. Values are File objects containing the information of the file that will be generated.
- Parameters
file (mloq.files.File) –
path (Union[pathlib.Path, str]) –
description (Optional[str]) –
- Return type
None