reliure.utils

reliure.utils.deprecated(new_fct_name, logger=None)

Decorator to notify that a fct is deprecated

reliure.utils.engine_schema(engine, out_names=None, filename=None, format='pdf')

Build a graphviz schema of a reliure Engine.

It depends on graphviz.

Parameters:
  • engine (Engine) – reliure engine to graph
  • out_names – list of block output to consider as engine output (all by default)
  • filename – output filename, create the file if given
  • formal – output file formal (pdf, svg, png, ...)
>>> from reliure.engine import Engine
>>> egn = Engine("preproc", "proc1", "proc2")
>>> egn.preproc.setup(in_name="input", out_name="data")
>>> egn.proc1.setup(in_name="data", out_name="gold_data")
>>> egn.proc2.setup(in_name="input", out_name="silver_data")
>>> # you can create
>>> schema = engine_schema(egn, filename='docs/img/engine_schema', format='png')

it create the following image :

../_static/engine_schema.png

You can specify which block output will be consider as engine output:

>>> schema = engine_schema(egn, ["gold_data", "silver_data"], filename='docs/img/engine_schema_simple', format='png')
../_static/engine_schema_simple.png

Note that it is also possible to draw a pdf;

>>> schema = engine_schema(egn, ["gold_data", "silver_data"], filename='docs/img/engine_schema_simple', format='pdf')
reliure.utils.parse_bool(value)

Convert a string to a boolean

>>> parse_bool(None)
False
>>> parse_bool("true")
True
>>> parse_bool("TRUE")
True
>>> parse_bool("yes")
True
>>> parse_bool("1")
True
>>> parse_bool("false")
False
>>> parse_bool("sqdf")
False
>>> parse_bool(False)
False
>>> parse_bool(True)
True