How to use the pyhocon.ConfigParser.resolve_substitutions 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
"""
            x : { v1: 1 }
            b1 : {v2: 2 }
            b = [${b1}]
            """,
            resolve=False
        )
        config2 = ConfigFactory.parse_string(
            """
            b2 : ${x} {v2: 3}
            b += [${b2}]
            """,
            resolve=False
        )
        merged = ConfigTree.merge_configs(config1, config2)
        ConfigParser.resolve_substitutions(merged)
        b = merged.get("b")
        assert len(b) == 2
        assert b[0] == {'v2': 2}
        assert b[1] == {'v1': 1, 'v2': 3}
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)
        resolved = ConfigParser.resolve_substitutions(merged)
        assert resolved.get("b1") == {"v1": 2, "v2": 3}
        b = resolved.get("b")
        assert len(b) == 1
        assert b[0] == {"v1": 2, "v2": 3}