Welcome to pymlconf’s documentation!¶
Jump To:¶
API Reference¶
- class pymlconf.Meld(data=None, file=None, root=None)¶
Replacement for default yaml mapping.
This class has the ability to merge with other mappings such as py:class:dict and it’s subclasses. so any configuration node can be merged with other.
- Parameters:
data –
yaml string, list of 2-tuples or dict.file – file object or filename to load.
root – enclose the
dataargument in another key specified by this argument.
Added in version 4.1:
rootparameter.The API is so simple:
Create configuration instance with default value and load a file to overwrite:
m = Meld(''' foo: bar: BAR baz: BAZ ''', file='qux.yml')
Merge/meld other mappings in:
m |= dict(thud='THUD', corge=10)
Load a file by name:
m.load('foo.yml')
Load a file-like object :
with open('foo.yml') as f: m.load(f)
Dump a Meld object:
print(m.dump())
- load(file)¶
- dump(**kw)¶