How to use the confuse.yaml_util.load_yaml 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_paths.py View on Github external
def tearDown(self):
        confuse.yaml_util.load_yaml, os.path.isfile = self._old
github beetbox / confuse / test / test_paths.py View on Github external
def setUp(self):
        self._old = os.path.isfile, confuse.yaml_util.load_yaml
        os.path.isfile = lambda x: True
        confuse.yaml_util.load_yaml = lambda *args, **kwargs: {}
github beetbox / confuse / test / test_paths.py View on Github external
def setUp(self):
        self._old = os.path.isfile, confuse.yaml_util.load_yaml
        os.path.isfile = lambda x: True
        confuse.yaml_util.load_yaml = lambda *args, **kwargs: {}
github beetbox / confuse / confuse / core.py View on Github external
def _add_user_source(self):
        """Add the configuration options from the YAML file in the
        user's configuration directory (given by `config_dir`) if it
        exists.
        """
        filename = self.user_config_path()
        if os.path.isfile(filename):
            yaml_data = yaml_util.load_yaml(filename, loader=self.loader) \
                or {}
            self.add(ConfigSource(yaml_data, filename))
github beetbox / confuse / confuse / core.py View on Github external
def set_file(self, filename):
        """Parses the file as YAML and inserts it into the configuration
        sources with highest priority.
        """
        filename = os.path.abspath(filename)
        yaml_data = yaml_util.load_yaml(filename, loader=self.loader)
        self.set(ConfigSource(yaml_data, filename))
github beetbox / confuse / confuse / core.py View on Github external
def _add_default_source(self):
        """Add the package's default configuration settings. This looks
        for a YAML file located inside the package for the module
        `modname` if it was given.
        """
        if self.modname:
            if self._package_path:
                filename = os.path.join(self._package_path, DEFAULT_FILENAME)
                if os.path.isfile(filename):
                    yaml_data = yaml_util.load_yaml(
                        filename,
                        loader=self.loader,
                    )
                    self.add(ConfigSource(yaml_data, filename, True))