This announcement is for a pre-release that I would like people to comment on structure, naming, etc. (Code review maybe not yet. :-)

Before you say "It's all been done before." I suggest you take a closer look and I think you may conclude that what I've revised over 7 years is now interesting.

---
Thesaurus is a mapping data type with key recursion and attribute aliasing. It is a subclass of dict() and compatible as a dictionary replacement baring where key path recursion may take place.

ThesaurusExtended is a subclass of Thesaurus providing additional usability methods.

ThesaurusCfg is a subclass of ThesaurusExtended providing a configuration file parser and per key data coercion methods.

The Thesaurus family works with Python 2.6+ to 3.8+.


A simple example of ThesaurusCfg
--
cfgs = '''
prog.version(static_int)    = 123
opt.verbose (str_to_bool)   = yes
hi                          = Hello
'''
from thesauruscfg import thescfg
cfg = thescfg()
>>> cfg.parse(cfgs)
{'prog': {'version': 123}, 'opt': {'verbose': True}, 'hi': 'Hello'}
>>> cfg.opt.verbose
True

import json
>>> print(json.dumps(cfg, indent=4, separators=(',', ': ')))
{
    "prog": {
        "version": 123
    },
    "opt": {
        "verbose": true
    },
    "hi": "Hello"
}

browse:
  https://git.cinege.com/thesaurus/
or
  git clone https://git.cinege.com/thesaurus/
---

Dave
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to