reportcompiler.documents
¶
documents.py
This module is responsible for the representation and handling of document specifications.
Classes¶
DocumentSpecification
: Represents a document specification with its file structure and
-
class
reportcompiler.documents.
DocumentSpecification
(dir_path=None, repo_url=None, repo_branch='master', repo_relative_path='.', create=False)¶ Represents a document specification with its file structure and configuration.
Inheritance
-
default_docparam_key
¶ Return the default key of the document parameter that will be used if none is specified.
Returns: default document parameter key Return type: str
-
fetch_allowed_var_values
(doc_param)¶ Returns the allowed values for the document variables for the current document specification if specified in the configuration file.
Parameters: doc_param (OrderedDict) – Document variable to check, necessary when checking dependent variables Returns: Dictionary with possible values of the variables specified in the document specification configuration. Variables dependent on others missing from doc_param are returned with value None. Return type: dict
-
generate
(doc_params=None, n_doc_workers=2, n_frag_workers=2, debug=False, random_seed=None, fragments=None, log_level=10, **kwargs)¶ Generates the documents with document variables doc_params from the current document specification.
Parameters: - doc_params (OrderedDict|list) – Document variables to generate documents
- n_doc_workers (int) – Number of concurrent document-generating threads
- n_frag_workers (int) – Number of concurrent fragment-generating threads (within each document-generating thread)
- random_seed (int) – Seed to initialize any possible pseudorandom generators.
- fragments (str) – Fragment(s) to be generated. Setting this value generates the document only considering the templates from the main template to the chosen value(s) and all its children. Setting it to None is equivalent to setting it to the main template and therefore the whole document will be generated.
- log_level (int) – Log level (e.g. logging.DEBUG, logging.WARNING, logging.ERROR, …).
- kwargs (dict) – Additional arguments that will be added to the document metadata when generating the documents.
-
main_template
¶ Returns the main template filename.
Returns: main template filename Return type: str
-