Mercurial > hgrepos > Python > libs > ConfigMix
view configmix/toml.py @ 428:090a25f36a3d
FIX: Allow jailed configurations to use correctly use base configurations that use a different "default" marker object.
Jailed configurations assumed that their "default" marker object is
identical to the "default" marker object in the unjailed base
configuration. This is not always true, especially if
"_JailedConfiguration.rebind()" is used.
Removed the explicit "default" keyword argument and passed the complete
keywords argument dictionary to the base instead. This triggers correct
default handling in the base.
| author | Franz Glasner <f.glasner@feldmann-mg.com> |
|---|---|
| date | Thu, 09 Dec 2021 13:02:17 +0100 |
| parents | eed16a1ec8f3 |
| children | f454889e41fa |
line wrap: on
line source
# -*- coding: utf-8 -*- # :- # :Copyright: (c) 2015-2020, Franz Glasner. All rights reserved. # :License: BSD-3-Clause. See LICENSE.txt for details. # :- """Read TOML style configuration files. """ from __future__ import division, absolute_import, print_function __all__ = ["load"] import io try: from collections import OrderedDict as DictImpl except ImportError: try: from ordereddict import OrderedDict as DictImpl except ImportError: DictImpl = dict import toml from .compat import u2fs def load(filename, encoding="utf-8"): """Load a single TOML file with name `filename` and encoding `encoding`. .. note:: The TOML standard requires that all TOML files are UTF-8 encoded. """ with io.open(u2fs(filename), mode="rt", encoding=encoding) as tfp: return toml.loads(tfp.read(), _dict=DictImpl)
