configtree.conv

Warning

Deprecated in favor of configtree.formatter

The module provides converters, which output configtree.tree.Tree objects into various formats. The converters are available via global variable map in format {'format_name': converter}. The map is filled on scaning entry points configtree.conv. So if you want to extend this module, you can define this entry point in your own package. The converter map is used by shell script defined in configtree.script to covert configuration tree into other formats.

configtree.conv.to_json(tree)

Warning

Deprecated in favor of configtree.formatter.to_json()

Convert configtree.tree.Tree object into JSON fromat:

>>> from configtree import Tree
>>> print(to_json(Tree({'a.b.c': 1})))
{
    "a.b.c": 1
}
configtree.conv.to_rare_json(tree)

Warning

Deprecated in favor of configtree.formatter.to_json()

Convert configtree.tree.Tree object into JSON fromat:

>>> from configtree import Tree
>>> print(to_rare_json(Tree({'a.b.c': 1})))
{
    "a": {
        "b": {
            "c": 1
        }
    }
}
configtree.conv.to_shell(tree)

Warning

Deprecated in favor of configtree.formatter.to_shell()

Convert configtree.tree.Tree object into shell script fromat:

>>> from configtree import Tree
>>> print(to_shell(Tree({'a.b.c': 1})))
A_B_C='1'