jsonextended.parsers.yaml module

class jsonextended.parsers.yaml.YAML_Parser[source]

Bases: object

Examples

>>> from pprint import pprint
>>> from jsonextended.utils import MockPath
>>> fileobj = MockPath(is_file=True,
... content='key1:\n  subkey1: a\n  subkey2: [1,2,3]'
... )
>>> with fileobj.open() as f:
...     data = YAML_Parser().read_file(f)
>>> pprint(dict(data["key1"]))
{'subkey1': 'a', 'subkey2': [1, 2, 3]}
file_regex = '*.yaml'
plugin_descript = 'read *.yaml files using ruamel.yaml'
plugin_name = 'yaml.ruamel'
read_file(file_obj, **kwargs)[source]