jsonextended.parsers.keypairs module

class jsonextended.parsers.keypairs.KeyPair_Parser[source]

Bases: object

Examples

>>> from pprint import pprint
>>> from jsonextended.utils import MockPath
>>> fileobj = MockPath(is_file=True,
... content='''# comment line
... key1 val1
... key2 val2
... key3 val3'''
... )
>>> with fileobj.open() as f:
...     data = KeyPair_Parser().read_file(f)
>>> pprint(data)
{'key1': 'val1', 'key2': 'val2', 'key3': 'val3'}
file_regex = '*.keypair'
plugin_descript = "read *.keypair, where each line should be; '<key> <pair>'"
plugin_name = 'keypair'
read_file(file_obj, **kwargs)[source]