How to use the pyhocon.ConfigTree function in pyhocon

To help you get started, we’ve selected a few pyhocon 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 chimpler / pyhocon / tests / test_config_parser.py View on Github external
def test_self_merge_ref_substitutions_object3(self):
        config1 = ConfigFactory.parse_string(
            """
            b1 : { v1: 1 }
            b = [${b1}]
            """,
            resolve=False
        )
        config2 = ConfigFactory.parse_string(
            """
            b1 : { v1: 2, v2: 3 }
            """,
            resolve=False
        )
        merged = ConfigTree.merge_configs(config1, config2)
        ConfigParser.resolve_substitutions(merged)
        assert merged.get("b1") == {"v1": 2, "v2": 3}
        b = merged.get("b")
        assert len(b) == 1
        assert b[0] == {"v1": 2, "v2": 3}
github stanfordnlp / wge / gtd / log.py View on Github external
def __init__(self, config_tree=None):
        if config_tree is None:
            config_tree = ConfigTree()

        self._config_tree = config_tree
        self._namestack = []
github stanfordnlp / wge / gtd / utils.py View on Github external
def __init__(self, config_tree=None):
        """Create a Config.

        Args:
            config_tree (ConfigTree)
        """
        if config_tree is None:
            config_tree = ConfigTree()
        self._config_tree = config_tree
github stanfordnlp / wge / gtd / utils.py View on Github external
def __getattr__(self, item):
        val = self._config_tree[item]
        if isinstance(val, ConfigTree):
            return Config(val)
        else:
            return val
github stanfordnlp / wge / gtd / utils.py View on Github external
def get(self, key, default=None):
        val = self._config_tree.get(key, default)
        if isinstance(val, ConfigTree):
            return Config(val)
        else:
            return val
github stanfordnlp / wge / gtd / log.py View on Github external
def __getitem__(self, key):
        try:
            val = self._config_tree.get(self._full_key(key))
        except ConfigMissingException:
            raise KeyError(key)

        if isinstance(val, ConfigTree):
            return Metadata(val)
        return val