genipe.reporting package¶
Module contents¶
Submodules¶
genipe.reporting.autoreport module¶
genipe.reporting.utils module¶
-
genipe.reporting.utils.colorize_time(total_seconds)[source]¶ Colorize the time.
- Parameters
total_seconds (int) – the total number of seconds
- Returns
a colorized LaTeX string representation of time
- Return type
The time is displayed as
HH:MM:SS, but insignificant zeros are grayed-out.
-
genipe.reporting.utils.config_jinja2()[source]¶ Configure the jinja2 environment for LaTeX.
Note
The configuration used is for LaTeX documents. Hence, a block command is done using
\BLOCK{}and variables using\VAR{}in the Jinja2 template.
-
genipe.reporting.utils.create_float(template, float_type, caption, label, content, placement='H')[source]¶ Creates a TeX float.
- Parameters
- Returns
a string representation of a LaTeX float
- Return type
-
genipe.reporting.utils.create_tabular(template, header, data, header_multicol=None, col_align=None)[source]¶ Creates a TeX tabular.
- Parameters
template (jinja2.Template) – the tabular template
header (list) – the header of the tabular
data (list) – the tabular data
header_multicol (list) – the number of columns for the header
col_align (list) – the column alignement
- Returns
a string representation of a LaTeX tabular
- Return type
-
genipe.reporting.utils.format_tex(text, tex_format)[source]¶ Change the TeX text format.
- Parameters
- Returns
the formatted text
- Return type
This will change the format by adding the LaTeX format command (e.g. from
textto\texttt{text}).Note
Only the following format are available:
textttemphtextbftextit
-
genipe.reporting.utils.format_time(total_seconds, written_time=False)[source]¶ Format time (either “HH:MM:SS” or “H hours, M minutes and S seconds”.
- Parameters
- Returns
a string representation of the total time
- Return type
If
written_timeisTrue, time will be displayed as “H hours, M minutes and S seconds”. Otherwise, the time will be represented as HH:MM:SS.
-
genipe.reporting.utils.sanitize_tex(original_text)[source]¶ Sanitize TeX text.
- Parameters
original_text (str) – the text to sanitize for LaTeX
Text is sanitized by following these steps:
Replaces
\\by\textbackslashEscapes certain characters (such as
$,%,_,},{,&and#) by adding a backslash (e.g. from&to\&).Replaces special characters such as
~by the LaTeX equivalent (e.g. from~to$\sim$).
-
genipe.reporting.utils.tex_inline_math(content)[source]¶ Creates an inline mathematical formula in TeX.
- Parameters
content (str) – the content of the mathematical formula
- Returns
the formatted mathematical formula
- Return type
The function only adds
$symbols before and after the content (e.g. from\pito$\pi$).
-
genipe.reporting.utils.wrap_tex(original_text)[source]¶ Wraps the text.
- Parameters
original_text (str) – the text to wrap
- Returns
a string where the original text was wrapped
- Return type
Wraps the text so that lines are no longer than 80 characters. Uses the
str.join()function on the results of thewrap()function, so that a single string is returned.