confini

Parse and merge multiple ini files in python3
git clone git://git.defalsify.org/python-confini.git
Log | Files | Refs | README | LICENSE

commit 91e5da36959712f9f1de3fda4ca5474d80eb1756
parent caa553684604fd79d3e7372ea8e44a3a91fac5d4
Author: nolash <dev@holbrook.no>
Date:   Mon, 12 Jul 2021 09:31:48 +0200

Separate schema dir arg from override dirs (preserves original signature)

Diffstat:
Mconfini/config.py | 8++++----
Mtests/test_censor.py | 2+-
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/confini/config.py b/confini/config.py @@ -22,11 +22,11 @@ class Config: parser = configparser.ConfigParser(strict=True) default_censor_string = '***' - def __init__(self, config_dirs, env_prefix=None): - self.dirs = [] - for d in config_dirs: + def __init__(self, schema_dir, env_prefix=None, override_dirs=[]): + self.dirs = [schema_dir] + for d in override_dirs: if not os.path.isdir(d): - raise OSError('{} is not a directory'.format(config_dirs)) + raise OSError('{} is not a directory'.format(override_dirs)) self.dirs.append(os.path.realpath(d)) self.required = {} self.censored = {} diff --git a/tests/test_censor.py b/tests/test_censor.py @@ -17,7 +17,7 @@ class TestCensor(unittest.TestCase): def test_censor(self): inidir = os.path.join(self.wd, 'files/translate') - c = Config([inidir]) + c = Config(inidir) c.process() c.censor('foo', 'bar') v = c.apply_censor('BAR_FOO')