How to use the confuse.Configuration function in confuse

To help you get started, we’ve selected a few confuse examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github beetbox / confuse / test / test_cli.py View on Github external
def setUp(self):
        self.config = confuse.Configuration('test', read=False)
github beetbox / confuse / test / test_paths.py View on Github external
def test_search_package(self):
        config = confuse.Configuration('myapp', __name__, read=False)
        config._add_default_source()

        for source in config.sources:
            if source.default:
                default_source = source
                break
        else:
            self.fail("no default source")

        self.assertEqual(
            default_source.filename,
            os.path.join(os.path.dirname(__file__), 'config_default.yaml')
        )
        self.assertTrue(source.default)
github beetbox / confuse / test / test_dump.py View on Github external
def test_dump_short_list(self):
        config = confuse.Configuration('myapp', read=False)
        config.add({'foo': ['bar', 'baz']})
        yaml = config.dump().strip()
        self.assertEqual(yaml, 'foo: [bar, baz]')
github beetbox / confuse / test / test_dump.py View on Github external
def test_dump_unredacted(self):
        config = confuse.Configuration('myapp', read=False)
        config.add({'foo': 'bar'})
        config['foo'].redact = True
        yaml = config.dump(redact=False).strip()
        self.assertEqual(yaml, 'foo: bar')
github beetbox / confuse / test / test_dump.py View on Github external
def test_dump_null(self):
        config = confuse.Configuration('myapp', read=False)
        config.add({'foo': None})
        yaml = config.dump().strip()
        self.assertEqual(yaml, 'foo:')
github beetbox / confuse / test / test_dump.py View on Github external
def test_dump_sans_defaults(self):
        config = confuse.Configuration('myapp', read=False)
        config.add({'foo': 'bar'})
        config.sources[0].default = True
        config.add({'baz': 'qux'})

        yaml = config.dump().strip()
        self.assertEqual(yaml, "foo: bar\nbaz: qux")

        yaml = config.dump(full=False).strip()
        self.assertEqual(yaml, "baz: qux")
github beetbox / confuse / test / test_dump.py View on Github external
def test_dump_redacted_sans_defaults(self):
        config = confuse.Configuration('myapp', read=False)
        config.add({'foo': 'bar'})
        config.sources[0].default = True
        config.add({'baz': 'qux'})
        config['baz'].redact = True

        yaml = config.dump(redact=True, full=False).strip()
        self.assertEqual(yaml, "baz: REDACTED")
github beetbox / confuse / test / test_dump.py View on Github external
def test_dump_redacted(self):
        config = confuse.Configuration('myapp', read=False)
        config.add({'foo': 'bar'})
        config['foo'].redact = True
        yaml = config.dump(redact=True).strip()
        self.assertEqual(yaml, 'foo: REDACTED')
github pandas-profiling / pandas-profiling / pandas_profiling / config.py View on Github external
def __init__(self):
        """The config constructor should be called only once."""
        if self.config is None:
            self.config = confuse.Configuration("PandasProfiling", __name__)
            self.config.set_file(str(get_config_default()))