project: Convert parser access to use the mapping protocol
Use the more dict-like access [1] instead of the API that's specific
to ConfigParser. This is likely to be more familiar to future
developers, and reduces the cognitive load of dealing with another
API.
The only place I couldn't drop the old API was in load_config, where I
kept parser.sections() [2] because using parser.keys() was giving me:
AttributeError: 'Project' object has no attribute '_load_DEFAULT_conf'
The:
try:
section = parser['...']
except KeyError:
section = {}
blocks are also more awkward than a dicts:
section = parser.get('...', {})
but we can't use that API because it's clobbered by
ConfigParser.get(section, option, ...) [3]. Maybe someday they'll
support:
section = parser.get('...', default={})
(or with 'fallback' instead of 'default').
[1]: https://docs.python.org/3/library/configparser.html#mapping-protocol-access
[2]: https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.sections
[3]: https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.get