class datalad.support.configparserinc.SafeConfigParserWithIncludes(defaults=None, dict_type=<class 'collections.OrderedDict'>, allow_no_value=False)[source]

Bases: ConfigParser.SafeConfigParser

Class adds functionality to SafeConfigParser to handle included other configuration files (or may be urls, whatever in the future)

File should have section [includes] and only 2 options implemented are ‘files_before’ and ‘files_after’ where files are listed 1 per line.

Example:

[INCLUDES]
before = 1.conf
3.conf

after = 1.conf


It is a simple implementation, so just basic care is taken about recursion. Includes preserve right order, ie new files are inserted to the list of read configs before original, and their includes correspondingly so the list should follow the leaves of the tree.

I wasn’t sure what would be the right way to implement generic (aka c++ template) so we could base at any *configparser class… so I will leave it for the future

SECTION_NAME = 'INCLUDES'
static getIncludes(seen=[])[source]

Given 1 config resource returns list of included files (recursively) with the original one as well Simple loops are taken care about

read(filenames)[source]