Mercurial > hgrepos > Python > libs > ConfigMix
changeset 125:c11dd36279d9
More documentation for the configmix.py module
| author | Franz Glasner <f.glasner@feldmann-mg.com> |
|---|---|
| date | Wed, 04 Apr 2018 10:56:54 +0200 |
| parents | be6cdc9cb79c |
| children | 93964bac7ef6 |
| files | configmix/py.py |
| diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/configmix/py.py Wed Apr 04 10:12:04 2018 +0200 +++ b/configmix/py.py Wed Apr 04 10:56:54 2018 +0200 @@ -25,6 +25,18 @@ def load(filename, extract=None): + """Load Python-style configuration files. + + Files are loaded and **executed** with :func:`exec` using an empty + dict as global and local context.# + + :param filename: the path to the configuration file + :param extract: an optional list of variable names (keys) to extract + into the resulting configuration dictionary + :returns: the configuration as dictionary + :rtype: collections.OrderedDict or ordereddict.OrderedDict or dict + + """ if extract is not None: if not isinstance(extract, (type([]), type(tuple()), type(set()), )): raise TypeError("`extract' must be a sequence")
