Add type annotations as generated by monkeytype and jw-devops/test, plus some
hand editing to satisfy both monkeytype and mypy.
Signed-off-by: Jan Lindemann <jan@janware.com>
StringTree.__getitem__() returned the node, now return its value
child instead. That's nicer and closer to the expected behaviour, as
it supports StringTree usage as a key-value store for configuration
or so. It breaks the existing API, but I think I have fixed the only
pace where it was used: jw-grammar/grammar.py.
Signed-off-by: Jan Lindemann <jan@janware.com>
Add support for adding children of type StringTree. If a StringTree
argument is passed to .add(), this should do the right thing. It
makes use of the newly added .__add_children() method and involves
quite a bit of hairy case distinctions.
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit tries to add support for the
[section]
first line
second line
syntax, i.e. non-assignments, without equal sign. Half-baked, but
still better than before. Also support some more Python 3, i.e.
dict.items() instead of iteritems()
Signed-off-by: Jan Lindemann <jan@janware.com>