snowdrop.src.misc package¶
Submodules¶
snowdrop.src.misc.display module¶
Display content of a model file.
snowdrop.src.misc.info module¶
Prints model object in pdf file format.
snowdrop.src.misc.latex module¶
- class snowdrop.src.misc.latex.Apply(variables, fun)[source]¶
Bases:
ExprVisitor
- class snowdrop.src.misc.latex.LatexVisitor(variables)[source]¶
Bases:
ExprVisitor
- class snowdrop.src.misc.latex.TimeShift(variables, shift)[source]¶
Bases:
ExprVisitor
snowdrop.src.misc.linter module¶
Set of utilities to check correctness of model file syntax.
- exception snowdrop.src.misc.linter.ModelException[source]¶
Bases:
Exception
Model exception class.
- type = 'error'¶
- snowdrop.src.misc.linter.check_all(data)[source]¶
Check correctness of model file.
- Parameters:
- param data:
Model content.
- type data:
Dictionary.
- returns:
List of exceptions if any.
- snowdrop.src.misc.linter.check_calibration(data)[source]¶
Check correctness of model calibration.
- Parameters:
- param data:
Model content.
- type data:
Dictionary.
- returns:
List of exceptions if any.
- snowdrop.src.misc.linter.check_definitions(data)[source]¶
Check correctness of model definitions.
- Parameters:
- param data:
Model content.
- type data:
Dictionary.
- returns:
List of exceptions if any.
- snowdrop.src.misc.linter.check_equations(data)[source]¶
Check correctness of model equations.
- Parameters:
- param data:
Model content.
- type data:
Dictionary.
- returns:
List of exceptions if any.
- snowdrop.src.misc.linter.check_extra_symbols(data)[source]¶
Check extra variables declaration.
- Parameters:
- param data:
Model content.
- type data:
Dictionary.
- returns:
List of exceptions if any.
- snowdrop.src.misc.linter.check_infos(data)[source]¶
Check model info.
- Parameters:
- param data:
Model info.
- type data:
Dictionary.
- returns:
List of exceptions if any.
- snowdrop.src.misc.linter.check_symbol_validity(s)[source]¶
Check symbol validity.
- Parameters:
- param s:
Symbol
- type s:
str.
- returns:
- snowdrop.src.misc.linter.check_symbols(data)[source]¶
Check model symbols validity.
- Parameters:
- param data:
Model content.
- type data:
Dictionary.
- returns:
List of exceptions if any.
- Can raise three types of exceptions:
unknown symbol
invalid symbol
already declared
- snowdrop.src.misc.linter.check_variables(data)[source]¶
Check number of endogenous variables.
- Parameters:
- param data:
Model content.
- type data:
Dictionary.
- returns:
List of exceptions if any.
- snowdrop.src.misc.linter.human_format(err)[source]¶
Highlights exceptions represntation by red color if it is an error and by yellow color if it is warning..
- Parameters:
- param err:
Error.
- type err:
ModelException.
- returns:
- snowdrop.src.misc.linter.lint(txt, source='<string>', format='human')[source]¶
Convert model file text to Python objects. Check syntax of model file for any errors.
- Parameters:
- param txt:
Model file content.
- type txt:
str.
- param source:
Source type.
- type source:
str.
- param format:
Format of exceptions display.
- type format:
str.
- returns:
Exceptions if any, otherwise a ruamel.yaml object.
snowdrop.src.misc.termcolor module¶
ANSII Color formatting for output in terminal.
- snowdrop.src.misc.termcolor.colored(text, color=None, on_color=None, attrs=None)[source]¶
Colorize text.
- Available text colors:
red, green, yellow, blue, magenta, cyan, white.
- Available text highlights:
on_red, on_green, on_yellow, on_blue, on_magenta, on_cyan, on_white.
- Available attributes:
bold, dark, underline, blink, reverse, concealed.
- Example:
colored(‘Hello, World!’, ‘red’, ‘on_grey’, [‘blue’, ‘blink’]) colored(‘Hello, World!’, ‘green’)
snowdrop.src.misc.text2latex module¶
Simple Text to Latex converter.
Note
- snowdrop.src.misc.text2latex.fill_document(doc, name, fname, paragraphs, elements)[source]¶
Add a section, a subsection and some text to the document.
- Parameters:
doc (
pylatex.document.Document
instance) – the document
- snowdrop.src.misc.text2latex.getDocElements(model)[source]¶
Get document elements.
- Args:
model : Model object.