# -*- encoding: utf-8 -*-

import json
import os
import shutil
import tempfile
from collections import OrderedDict
from datetime import timedelta

from pyparsing import ParseBaseException, ParseException, ParseSyntaxException
import mock
import pytest
from pyhocon import (ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree)
from pyhocon.exceptions import (ConfigException, ConfigMissingException,
                                ConfigWrongTypeException)

try:
    from dateutil.relativedelta import relativedelta as period
except Exception:
    from datetime import timedelta as period


class TestConfigParser(object):
    def test_parse_simple_value(self):
        config = ConfigFactory.parse_string(
            """t = {
                c = 5
                "d" = true
                e.y = {
                    f: 7
                    g: "hey dude!"
                    h: hey man
                    i = \"\"\"
                        "first line"
                        "second" line
                        \"\"\"
                }
                j = [1, 2, 3]
                u = 192.168.1.3/32
                g = null
            }
            """
        )

        assert config.get_string('t.c') == '5'
        assert config.get_int('t.c') == 5
        assert config.get_float('t.c') == 5.0
        assert config.get('t.e.y.f') == 7
        assert config.get('t.e.y.g') == 'hey dude!'
        assert config.get('t.e.y.h') == 'hey man'
        assert [v.strip() for v in config.get('t.e.y.i').split('\n')] == ['', '"first line"', '"second" line', '']
        assert config.get_bool('t.d') is True
        assert config.get_int('t.e.y.f') == 7
        assert config.get('t.j') == [1, 2, 3]
        assert config.get('t.u') == '192.168.1.3/32'
        assert config.get_int('t.g') is None
        assert config.get_float('t.g') is None
        assert config.get_string('t.g') is None
        assert config.get_bool('t.g') is None
        assert config.get_list('t.g') is None
        assert config.get_config('t.g') is None

    @pytest.mark.parametrize('forbidden_char', ['+', '`', '^', '?', '!', '@', '*', '&'])
    def test_fail_parse_forbidden_characters(self, forbidden_char):
        with pytest.raises(ParseBaseException):
            ConfigFactory.parse_string('a: hey man{}'.format(forbidden_char))

    @pytest.mark.parametrize('forbidden_char', ['$', '"'])
    def test_fail_parse_forbidden_characters_in_context(self, forbidden_char):
        with pytest.raises(ParseException):
            ConfigFactory.parse_string('a: hey man{}'.format(forbidden_char))

    @pytest.mark.parametrize('forbidden_char', ['+', '`', '^', '?', '!', '@', '*', '&'])
    def test_parse_forbidden_characters_quoted(self, forbidden_char):
        value = "hey man{}".format(forbidden_char)
        config = ConfigFactory.parse_string('a: "{}"'.format(value))
        assert config.get_string("a") == value

    def test_parse_with_enclosing_brace(self):
        config = ConfigFactory.parse_string(
            """
            {
                a: {
                    b: 5
                }
            }
            """
        )

        assert config.get_string('a.b') == '5'

    @pytest.mark.parametrize('data_set', [
        ('a: 1 minutes', period(minutes=1)),
        ('a: 1minutes', period(minutes=1)),
        ('a: 2 minute', period(minutes=2)),
        ('a: 3 m', period(minutes=3)),
        ('a: 3m', period(minutes=3)),
        ('a: 3 min', '3 min'),

        ('a: 4 seconds', period(seconds=4)),
        ('a: 5 second', period(seconds=5)),
        ('a: 6 s', period(seconds=6)),
        ('a: 6 sec', '6 sec'),

        ('a: 7 hours', period(hours=7)),
        ('a: 8 hour', period(hours=8)),
        ('a: 9 h', period(hours=9)),

        ('a: 10 weeks', period(weeks=10)),
        ('a: 11 week', period(weeks=11)),
        ('a: 12 w', period(weeks=12)),

        ('a: 10 days', period(days=10)),
        ('a: 11 day', period(days=11)),
        ('a: 12 d', period(days=12)),

        ('a: 110 microseconds', period(microseconds=110)),
        ('a: 111 microsecond', period(microseconds=111)),
        ('a: 112 micros', period(microseconds=112)),
        ('a: 113 micro', period(microseconds=113)),
        ('a: 114 us', period(microseconds=114)),

        ('a: 110 milliseconds', timedelta(milliseconds=110)),
        ('a: 111 millisecond', timedelta(milliseconds=111)),
        ('a: 112 millis', timedelta(milliseconds=112)),
        ('a: 113 milli', timedelta(milliseconds=113)),
        ('a: 114 ms', timedelta(milliseconds=114)),

        ('a: 110 nanoseconds', period(microseconds=0)),
        ('a: 11000 nanoseconds', period(microseconds=11)),
        ('a: 1110000 nanosecond', period(microseconds=1110)),
        ('a: 1120000 nanos', period(microseconds=1120)),
        ('a: 1130000 nano', period(microseconds=1130)),
        ('a: 1140000 ns', period(microseconds=1140)),
    ])
    def test_parse_string_with_duration(self, data_set):
        config = ConfigFactory.parse_string(data_set[0])

        assert config['a'] == data_set[1]

    def test_parse_string_with_duration_with_long_unit_name(self):
        config = ConfigFactory.parse_string(
            """
            a: foo
            b: 10 weeks
            c: bar
            """
        )
        assert config['b'] == period(weeks=10)

    def test_parse_with_list_mixed_types_with_durations_and_trailing_comma(self):
        config = ConfigFactory.parse_string(
            """
            a: foo
            b: [a, 1, 10 weeks, 5 minutes,]
            c: bar
            """
        )
        assert config['b'] == ['a', 1, period(weeks=10), period(minutes=5)]

    def test_parse_with_enclosing_square_bracket(self):
        config = ConfigFactory.parse_string("[1, 2, 3]")
        assert config == [1, 2, 3]

    def test_quoted_key_with_dots(self):
        config = ConfigFactory.parse_string(
            """
            "a.b.c.d": 3
            t {
              "d": {
                "c": 5
              }
            }
            k {
                "b.f.d": 7
            }
            """
        )
        assert config['"a.b.c.d"'] == 3
        assert config['t.d.c'] == 5
        assert config['k."b.f.d"'] == 7

    def test_dotted_notation_merge(self):
        config = ConfigFactory.parse_string(
            """
            a {
                b = foo
                c = bar
            }
            a.c = ${a.b}" "${a.b}
            a.d = baz
            """
        )
        assert config['a.b'] == "foo"
        assert config['a.c'] == "foo foo"
        assert config['a.d'] == "baz"

    def test_comma_to_separate_expr(self):
        config = ConfigFactory.parse_string(
            """
            a=1,
            b="abc",
            c=the man,
            d=woof,
            a-b-c-d=test,
            a b c d=test2,
            "a b c d e"=test3
            """
        )
        assert config.get('a') == 1
        assert config.get('b') == 'abc'
        assert config.get('c') == 'the man'
        assert config.get('d') == 'woof'
        assert config.get('a-b-c-d') == 'test'
        assert config.get('a b c d') == 'test2'
        assert config.get('a b c d e') == 'test3'

    def test_dict_merge(self):
        config = ConfigFactory.parse_string(
            """
            a {
                    d {
                            g.h.j.u: 5
                            g {
                                    h.d: 4
                            }
                            g.h.k: f d
                    }

                    h.i.m = 7
                    h.i {
                            d: 5
                    }

                    h.i {
                            e:65
                    }
            }
            """)

        expected_result = {
            "a": {
                "d": {
                    "g": {
                        "h": {
                            "j": {
                                "u": 5
                            },
                            "d": 4,
                            "k": "f d"
                        }
                    }
                },
                "h": {
                    "i": {
                        "m": 7,
                        "d": 5,
                        "e": 65
                    }
                }
            }
        }
        assert expected_result == config

    def test_parse_with_comments(self):
        config = ConfigFactory.parse_string(
            """
            // comment 1
            # comment 2
            {
                c = test   // comment 0
                g = 6 test   # comment 0
                # comment 3
                a: { # comment 4
                    b: test,                # comment 5
                } # comment 6
                t = [1, # comment 7
                     2, # comment 8
                     3, # comment 9
                ]
            } # comment 10
            // comment 11
            // comment 12
            """
        )

        assert config.get('c') == 'test'
        assert config.get('g') == '6 test'
        assert config.get('a.b') == 'test'
        assert config.get_string('a.b') == 'test'
        assert config.get('t') == [1, 2, 3]

    def test_missing_config(self):
        config = ConfigFactory.parse_string(
            """
            a = 5
            """
        )
        # b is not set so show raise an exception
        with pytest.raises(ConfigMissingException):
            config.get('b')

    def test_parse_null(self):
        config = ConfigFactory.parse_string(
            """
            a = null
            b = [null]
            """
        )
        assert config.get('a') is None
        assert config.get('b')[0] is None

    def test_parse_override(self):
        config = ConfigFactory.parse_string(
            """
            {
                a: {
                    b: {
                        c = 5
                    }
                }
                a.b {
                    c = 7
                    d = 8
                }
            }
            """
        )

        assert config.get('a.b.c') == 7
        assert config.get('a.b.d') == 8

    def test_concat_dict(self):
        config = ConfigFactory.parse_string(
            """
            a: {b: 1}
            a: {c: 2}
            b: {c: 3} {d: 4} {
                c: 5
            }
            """
        )
        assert config.get('a.b') == 1
        assert config.get('a.c') == 2
        assert config.get('b.c') == 5
        assert config.get('b.d') == 4

    def test_concat_string(self):
        config = ConfigFactory.parse_string(
            """
            a = a b c
            b = 5 b
            c = b 7
            """
        )

        assert config.get('a') == 'a b c'
        assert config.get('b') == '5 b'
        assert config.get('c') == 'b 7'

    def test_concat_list(self):
        config = ConfigFactory.parse_string(
            """
            a = [1, 2] [3, 4] [
              5,
              6
            ]
            """
        )

        assert config.get('a') == [1, 2, 3, 4, 5, 6]
        assert config.get_list('a') == [1, 2, 3, 4, 5, 6]

    def test_bad_concat(self):
        ConfigFactory.parse_string('a = 45\n')
        with pytest.raises(ConfigWrongTypeException):
            ConfigFactory.parse_string('a = [4] "4"')
        with pytest.raises(ConfigWrongTypeException):
            ConfigFactory.parse_string('a = "4" [5]')
        with pytest.raises(ConfigWrongTypeException):
            ConfigFactory.parse_string('a = {b: 5} "4"')

    def test_string_substitutions(self):
        config1 = ConfigFactory.parse_string(
            """
            {
                a: {
                    b: {
                        c = str
                        e = "str      "
                    }
                }
                d = ${a.b.c}
                f = ${a.b.e}
            }
            """
        )

        assert config1.get('a.b.c') == 'str'
        assert config1.get('d') == 'str'
        assert config1.get('f') == 'str      '

        config2 = ConfigFactory.parse_string(
            """
            {
                a: {
                    b: {
                        c = str
                        e = "str      "
                    }
                }
                d = test  ${a.b.c}
                f = test  ${a.b.e}
            }
            """
        )

        assert config2.get('a.b.c') == 'str'
        assert config2.get('d') == 'test  str'
        assert config2.get('f') == 'test  str      '

        config3 = ConfigFactory.parse_string(
            u"""
            {
                a: {
                    b: {
                        c = str
                        e = "str      "
                    }
                }
                d = test  ${a.b.c}  me
                f = test  ${a.b.e}  me
            }
            """
        )

        assert config3.get('a.b.c') == 'str'
        assert config3.get('d') == 'test  str  me'
        assert config3.get('f') == 'test  str        me'

    def test_string_substitutions_with_no_space(self):
        config = ConfigFactory.parse_string(
            """
                app.heap_size = 128
                app.java_opts = [
                    -Xms${app.heap_size}m
                    -Xmx${app.heap_size}m
                ]
            """
        )

        assert config.get('app.java_opts') == [
            '-Xms128m',
            '-Xmx128m'
        ]

    def test_int_substitutions(self):
        config1 = ConfigFactory.parse_string(
            """
            {
                a: {
                    b: {
                        c = 5
                    }
                }
                d = ${a.b.c}
            }
            """
        )

        assert config1.get('a.b.c') == 5
        assert config1.get('d') == 5

        config2 = ConfigFactory.parse_string(
            """
            {
                a: {
                    b: {
                        c = 5
                    }
                }
                d = test ${a.b.c}
            }
            """
        )

        assert config2.get('a.b.c') == 5
        assert config2.get('d') == 'test 5'

        config3 = ConfigFactory.parse_string(
            """
            {
                a: {
                    b: {
                        c = 5
                    }
                }
                d = test ${a.b.c} me
            }
            """
        )

        assert config3.get('a.b.c') == 5
        assert config3.get('d') == 'test 5 me'

    def test_cascade_string_substitutions(self):
        config = ConfigFactory.parse_string(
            """
            {
                a: {
                    b: {
                        c = ${e}
                    }
                }
                d = test ${a.b.c} me
                e = 7
            }
            """
        )

        assert config.get('a.b.c') == 7
        assert config.get('d') == 'test 7 me'

    def test_multiple_substitutions(self):
        config = ConfigFactory.parse_string(
            """
                a = 5
                b=${a}${a}
                c=${a} ${a}
            """
        )

        assert config == {
            'a': 5,
            'b': '55',
            'c': '5 5'
        }

    def test_dict_substitutions(self):
        config = ConfigFactory.parse_string(
            """
                data-center-generic = { cluster-size = 6 }
                data-center-east = ${data-center-generic} {name = "east"}
            """
        )

        assert config.get('data-center-east.cluster-size') == 6
        assert config.get('data-center-east.name') == 'east'

        config2 = ConfigFactory.parse_string(
            """
                data-center-generic = { cluster-size = 6 }
                data-center-east = {name = "east"} ${data-center-generic}
            """
        )

        assert config2.get('data-center-east.cluster-size') == 6
        assert config2.get('data-center-east.name') == 'east'

        config3 = ConfigFactory.parse_string(
            """
                data-center-generic = { cluster-size = 6 }
                data-center-east = {name = "east"} ${data-center-generic} { cluster-size = 9, opts = "-Xmx4g" }
            """
        )

        assert config3.get('data-center-east.cluster-size') == 9
        assert config3.get('data-center-east.name') == 'east'
        assert config3.get('data-center-east.opts') == '-Xmx4g'

        config4 = ConfigFactory.parse_string(
            """
                data-center-generic = { cluster-size = 6 }
                data-center-east = {name = "east"} ${data-center-generic}
                data-center-east-prod = ${data-center-east} {tmpDir=/tmp}
            """
        )

        assert config4.get('data-center-east.cluster-size') == 6
        assert config4.get('data-center-east.name') == 'east'
        assert config4.get('data-center-east-prod.cluster-size') == 6
        assert config4.get('data-center-east-prod.tmpDir') == '/tmp'

        config5 = ConfigFactory.parse_string(
            """
                data-center-generic = { cluster-size = 6 }
                data-center-east = ${data-center-generic}
                data-center-east = { name = "east" }
            """
        )

        assert config5['data-center-east'] == {
            'name': 'east',
            'cluster-size': 6
        }

        config6 = ConfigFactory.parse_string(
            """
                data-center-generic = { cluster-size = 6 }
                data-center-east = { name = "east" }
                data-center-east = ${data-center-generic}
            """
        )
        assert config6['data-center-east'] == {
            'name': 'east',
            'cluster-size': 6
        }

    def test_dos_chars_with_unquoted_string_noeol(self):
        config = ConfigFactory.parse_string("foo = bar")
        assert config['foo'] == 'bar'

    def test_dos_chars_with_quoted_string_noeol(self):
        config = ConfigFactory.parse_string('foo = "5"')
        assert config['foo'] == '5'

    def test_dos_chars_with_triple_quoted_string_noeol(self):
        config = ConfigFactory.parse_string('foo = """5"""')
        assert config['foo'] == '5'

    def test_dos_chars_with_int_noeol(self):
        config = ConfigFactory.parse_string("foo = 5")
        assert config['foo'] == 5

    def test_dos_chars_with_float_noeol(self):
        config = ConfigFactory.parse_string("foo = 5.0")
        assert config['foo'] == 5.0

    def test_list_substitutions(self):
        config = ConfigFactory.parse_string(
            """
                common_modules = [php, python]
                host_modules = ${common_modules} [java]
            """
        )

        assert config.get('host_modules') == ['php', 'python', 'java']

        config2 = ConfigFactory.parse_string(
            """
                common_modules = [php, python]
                host_modules = [java] ${common_modules}
            """
        )

        assert config2.get('host_modules') == ['java', 'php', 'python']

        config3 = ConfigFactory.parse_string(
            """
                common_modules = [php, python]
                host_modules = [java] ${common_modules} [perl]
            """
        )

        assert config3.get('common_modules') == ['php', 'python']
        assert config3.get('host_modules') == ['java', 'php', 'python', 'perl']

        config4 = ConfigFactory.parse_string(
            """
                common_modules = [php, python]
                host_modules = [java] ${common_modules} [perl]
                full_modules = ${host_modules} [c, go]
            """
        )

        assert config4.get('common_modules') == ['php', 'python']
        assert config4.get('host_modules') == ['java', 'php', 'python', 'perl']
        assert config4.get('full_modules') == ['java', 'php', 'python', 'perl', 'c', 'go']

    def test_list_element_substitution(self):
        config = ConfigFactory.parse_string(
            """
                main_language = php
                languages = [java, ${main_language}]
            """
        )

        assert config.get('languages') == ['java', 'php']

    def test_substitution_list_with_append(self):
        config = ConfigFactory.parse_string(
            """
            application.foo = 128mm
            application.large-jvm-opts = ["-XX:+UseParNewGC"] [-Xm16g, ${application.foo}]
            application.large-jvm-opts2 = [-Xm16g, ${application.foo}] ["-XX:+UseParNewGC"]
            """)

        assert config["application.large-jvm-opts"] == [
            '-XX:+UseParNewGC',
            '-Xm16g',
            '128mm'
        ]

        assert config["application.large-jvm-opts2"] == [
            '-Xm16g',
            '128mm',
            '-XX:+UseParNewGC',
        ]

    def test_substitution_list_with_append_substitution(self):
        config = ConfigFactory.parse_string(
            """
            application.foo = 128mm
            application.default-jvm-opts = ["-XX:+UseParNewGC"]
            application.large-jvm-opts = ${application.default-jvm-opts} [-Xm16g, ${application.foo}]
            application.large-jvm-opts2 = [-Xm16g, ${application.foo}] ${application.default-jvm-opts}
            """)

        assert config["application.large-jvm-opts"] == [
            '-XX:+UseParNewGC',
            '-Xm16g',
            '128mm'
        ]

        assert config["application.large-jvm-opts2"] == [
            '-Xm16g',
            '128mm',
            '-XX:+UseParNewGC'
        ]

    def test_non_existent_substitution(self):
        with pytest.raises(ConfigSubstitutionException):
            ConfigFactory.parse_string(
                """
                    common_modules = ${non_existent}
                """
            )

        with pytest.raises(ConfigSubstitutionException):
            ConfigFactory.parse_string(
                """
                    common_modules = abc ${non_existent}
                """
            )

        with pytest.raises(ConfigSubstitutionException):
            ConfigFactory.parse_string(
                """
                    common_modules = ${non_existent} abc
                """
            )

        with pytest.raises(ConfigSubstitutionException):
            ConfigFactory.parse_string(
                """
                    common_modules = abc ${non_existent} def
                """
            )

    def test_non_compatible_substitution(self):
        with pytest.raises(ConfigWrongTypeException):
            ConfigFactory.parse_string(
                """
                    common_modules = [perl]
                    host_modules = 55 ${common_modules}
                """
            )

        with pytest.raises(ConfigWrongTypeException):
            ConfigFactory.parse_string(
                """
                    common_modules = [perl]
                    host_modules = ${common_modules} 55
                """
            )

        with pytest.raises(ConfigWrongTypeException):
            ConfigFactory.parse_string(
                """
                    common_modules = [perl]
                    host_modules = aa ${common_modules} bb
                """
            )

        with pytest.raises(ConfigWrongTypeException):
            ConfigFactory.parse_string(
                """
                    common_modules = [perl]
                    host_modules = aa ${common_modules}
                """
            )

        with pytest.raises(ConfigWrongTypeException):
            ConfigFactory.parse_string(
                """
                    common_modules = [perl]
                    host_modules = ${common_modules} aa
                """
            )

        with pytest.raises(ConfigWrongTypeException):
            ConfigFactory.parse_string(
                """
                    common_modules = [perl]
                    host_modules = aa ${common_modules} bb
                """
            )

    def test_self_ref_substitution_array(self):
        config = ConfigFactory.parse_string(
            """
            x = [1,2]
            x = ${x} [3,4]
            x = [-1, 0] ${x} [5, 6]
            x = [-3, -2] ${x}
            """
        )
        assert config.get("x") == [-3, -2, -1, 0, 1, 2, 3, 4, 5, 6]

    def test_self_append_array(self):
        config = ConfigFactory.parse_string(
            """
            x = [1,2]
            x += [3,4]
            """
        )
        assert config.get("x") == [1, 2, 3, 4]

    def test_self_append_string(self):
        '''
        Should be equivalent to
        x = abc
        x = ${?x} def
        '''
        config = ConfigFactory.parse_string(
            """
            x = abc
            x += def
            """
        )
        assert config.get("x") == "abc def"

    def test_self_append_non_existent_string(self):
        '''
        Should be equivalent to x = ${?x} def
        '''
        config = ConfigFactory.parse_string(
            """
            x += def
            """
        )
        assert config.get("x") == " def"

    def test_self_append_nonexistent_array(self):
        config = ConfigFactory.parse_string(
            """
            x += [1,2]
            """
        )
        assert config.get("x") == [1, 2]

    def test_self_append_object(self):
        config = ConfigFactory.parse_string(
            """
            x = {a: 1}
            x += {b: 2}
            """
        )
        assert config.get("x") == {'a': 1, 'b': 2}

    def test_self_append_nonexistent_object(self):
        config = ConfigFactory.parse_string(
            """
            x += {a: 1}
            """
        )
        assert config.get("x") == {'a': 1}

    def test_self_ref_substitution_array_to_dict(self):
        config = ConfigFactory.parse_string(
            """
            x = [1,2]
            x = {x: [3,4]}
            x = {y: [5,6]}
            x = {z: ${x}}
            """
        )
        assert config.get("x.x") == [3, 4]
        assert config.get("x.y") == [5, 6]
        assert config.get("x.z") == {'x': [3, 4], 'y': [5, 6]}

    def test_self_ref_substitiotion_dict_in_array(self):
        config = ConfigFactory.parse_string(
            """
            x = {x: [3,4]}
            x = [${x}, 2, 3]
            """
        )
        (one, two, three) = config.get("x")
        assert one == {'x': [3, 4]}
        assert two == 2
        assert three == 3

    def test_self_ref_substitution_dict_path(self):
        config = ConfigFactory.parse_string(
            """
            x = {y: {z: 1}}
            x = ${x.y}
            """
        )
        assert config.get("x.y") == {'z': 1}
        assert config.get("x.z") == 1
        assert set(config.get("x").keys()) == set(['y', 'z'])

    def test_self_ref_substitution_dict_path_hide(self):
        config = ConfigFactory.parse_string(
            """
            x = {y: {y: 1}}
            x = ${x.y}
            """
        )
        assert config.get("x.y") == 1
        assert set(config.get("x").keys()) == set(['y'])

    def test_self_ref_substitution_dict_recurse(self):
        with pytest.raises(ConfigSubstitutionException):
            ConfigFactory.parse_string(
                """
                x = ${x}
                """
            )

    def test_self_ref_substitution_dict_recurse2(self):
        with pytest.raises(ConfigSubstitutionException):
            ConfigFactory.parse_string(
                """
                x = ${x}
                x = ${x}
                """
            )

    def test_self_ref_substitution_dict_merge(self):
        '''
        Example from HOCON spec
        '''
        config = ConfigFactory.parse_string(
            """
            foo : { a : { c : 1 } }
            foo : ${foo.a}
            foo : { a : 2 }
            """
        )
        assert config.get('foo') == {'a': 2, 'c': 1}
        assert set(config.keys()) == set(['foo'])

    def test_self_ref_substitution_dict_otherfield(self):
        '''
        Example from HOCON spec
        '''
        config = ConfigFactory.parse_string(
            """
            bar : {
              foo : 42,
              baz : ${bar.foo}
            }
            """
        )
        assert config.get("bar") == {'foo': 42, 'baz': 42}
        assert set(config.keys()) == set(['bar'])

    def test_self_ref_substitution_dict_otherfield_merged_in(self):
        '''
        Example from HOCON spec
        '''
        config = ConfigFactory.parse_string(
            """
            bar : {
                foo : 42,
                baz : ${bar.foo}
            }
            bar : { foo : 43 }
            """
        )
        assert config.get("bar") == {'foo': 43, 'baz': 43}
        assert set(config.keys()) == set(['bar'])

    def test_self_ref_substitution_dict_otherfield_merged_in_mutual(self):
        '''
        Example from HOCON spec
        '''
        config = ConfigFactory.parse_string(
            """
            // bar.a should end up as 4
            bar : { a : ${foo.d}, b : 1 }
            bar.b = 3
            // foo.c should end up as 3
            foo : { c : ${bar.b}, d : 2 }
            foo.d = 4
            """
        )
        assert config.get("bar") == {'a': 4, 'b': 3}
        assert config.get("foo") == {'c': 3, 'd': 4}
        assert set(config.keys()) == set(['bar', 'foo'])

    def test_self_ref_substitution_string_opt_concat(self):
        '''
        Example from HOCON spec
        '''
        config = ConfigFactory.parse_string(
            """
            a = ${?a}foo
            """
        )
        assert config.get("a") == 'foo'
        assert set(config.keys()) == set(['a'])

    def test_self_ref_substitution_dict_recurse_part(self):
        with pytest.raises(ConfigSubstitutionException):
            ConfigFactory.parse_string(
                """
                x = ${x} {y: 1}
                x = ${x.y}
                """
            )

    def test_self_ref_substitution_object(self):
        config = ConfigFactory.parse_string(
            """
            x = {a: 1, b: 2}
            x = ${x} {c: 3}
            x = {z: 0} ${x}
            x = {y: -1} ${x} {d: 4}
            """
        )
        assert config.get("x") == {'a': 1, 'b': 2, 'c': 3, 'z': 0, 'y': -1, 'd': 4}

    def test_self_ref_child(self):
        config = ConfigFactory.parse_string(
            """
                a.b = 3
                a.b = ${a.b}
                a.b = ${a.b}
                a.c = [1,2]
                a.c = ${a.c}
                a.d = {foo: bar}
                a.d = ${a.d}

            """
        )
        assert config.get("a") == {'b': 3, 'c': [1, 2], 'd': {'foo': 'bar'}}

    def test_concat_multi_line_string(self):
        config = ConfigFactory.parse_string(
            """
                common_modules = perl \
                java \
                python
            """
        )

        assert [x.strip() for x in config['common_modules'].split() if x.strip(' ') != ''] == ['perl', 'java', 'python']

    def test_concat_multi_line_list(self):
        config = ConfigFactory.parse_string(
            """
                common_modules = [perl] \
                [java] \
                [python]
            """
        )

        assert config['common_modules'] == ['perl', 'java', 'python']

    def test_concat_multi_line_dict(self):
        config = ConfigFactory.parse_string(
            """
                common_modules = {a:perl} \
                {b:java} \
                {c:python}
            """
        )

        assert config['common_modules'] == {'a': 'perl', 'b': 'java', 'c': 'python'}

    def test_parse_URL_from_samples(self):
        config = ConfigFactory.parse_URL("file:samples/aws.conf")
        assert config.get('data-center-generic.cluster-size') == 6
        assert config.get('large-jvm-opts') == ['-XX:+UseParNewGC', '-Xm16g']

    def test_parse_URL_from_invalid(self):
        config = ConfigFactory.parse_URL("https://nosuchurl")
        assert config == []

    def test_include_dict_from_samples(self):
        config = ConfigFactory.parse_file("samples/animals.conf")
        assert config.get('cat.garfield.say') == 'meow'
        assert config.get('dog.mutt.hates.garfield.say') == 'meow'

    def test_include_glob_dict_from_samples(self):
        config = ConfigFactory.parse_file("samples/all_animals.conf")
        assert config.get('animals.garfield.say') == 'meow'
        assert config.get('animals.mutt.hates.garfield.say') == 'meow'

    def test_include_glob_list_from_samples(self):
        config = ConfigFactory.parse_file("samples/all_bars.conf")
        bars = config.get_list('bars')
        assert len(bars) == 10

        names = {bar['name'] for bar in bars}
        types = {bar['type'] for bar in bars if 'type' in bar}
        print(types, '(((((')
        assert 'Bloody Mary' in names
        assert 'Homer\'s favorite coffee' in names
        assert 'milk' in types

    def test_list_of_dicts(self):
        config = ConfigFactory.parse_string(
            """
            a: [
                {a: 1, b: 2},
                {a: 3, c: 4},
            ]
            """
        )
        assert config['a'] == [
            {'a': 1, 'b': 2},
            {'a': 3, 'c': 4}
        ]

    def test_list_of_lists(self):
        config = ConfigFactory.parse_string(
            """
            a: [
                [1, 2]
                [3, 4]
            ]
            """
        )
        assert config['a'] == [
            [1, 2],
            [3, 4]
        ]

    def test_list_of_dicts_with_merge(self):
        config = ConfigFactory.parse_string(
            """
            b = {f: 4}
            a: [
                ${b} {a: 1, b: 2},
                {a: 3, c: 4} ${b},
                {a: 3} ${b} {c: 6},
            ]
            """
        )
        assert config['a'] == [
            {'a': 1, 'b': 2, 'f': 4},
            {'a': 3, 'c': 4, 'f': 4},
            {'a': 3, 'c': 6, 'f': 4}
        ]

    def test_list_of_lists_with_merge(self):
        config = ConfigFactory.parse_string(
            """
            b = [5, 6]
            a: [
                ${b} [1, 2]
                [3, 4] ${b}
                [1, 2] ${b} [7, 8]
            ]
            """
        )
        assert config['a'] == [
            [5, 6, 1, 2],
            [3, 4, 5, 6],
            [1, 2, 5, 6, 7, 8]
        ]

    def test_invalid_assignment(self):
        with pytest.raises(ParseSyntaxException):
            ConfigFactory.parse_string('common_modules [perl]')

        with pytest.raises(ParseException):
            ConfigFactory.parse_string('common_modules {} {perl: 1}')

        with pytest.raises(ParseSyntaxException):
            ConfigFactory.parse_string(
                """
                a = {f: 5}
                common_modules ${a} {perl: 1}
                """)

    def test_invalid_dict(self):
        with pytest.raises(ParseSyntaxException):
            ConfigFactory.parse_string(
                """
                a = {
                    f: 5
                    g
                }
                """)

        with pytest.raises(ParseSyntaxException):
            ConfigFactory.parse_string('a = {g}')

    def test_include_file(self):
        with tempfile.NamedTemporaryFile('w') as fdin:
            fdin.write('[1, 2]')
            fdin.flush()

            config1 = ConfigFactory.parse_string(
                """
                a: [
                    include "{tmp_file}"
                ]
                """.format(tmp_file=fdin.name)
            )
            assert config1['a'] == [1, 2]

            config2 = ConfigFactory.parse_string(
                """
                a: [
                    include file("{tmp_file}")
                ]
                """.format(tmp_file=fdin.name)
            )
            assert config2['a'] == [1, 2]

            config3 = ConfigFactory.parse_string(
                """
                a: [
                    include url("file://{tmp_file}")
                ]
                """.format(tmp_file=fdin.name)
            )
            assert config3['a'] == [1, 2]

    def test_include_missing_file(self):
        config1 = ConfigFactory.parse_string(
            """
            a: [
                include "dummy.txt"
                3
                4
            ]
            """
        )
        assert config1['a'] == [3, 4]

    def test_include_required_file(self):
        config = ConfigFactory.parse_string(
            """
            a {
                include required("samples/animals.d/cat.conf")
                t = 2
            }
            """
        )
        expected = {
            'a': {
                'garfield': {
                    'say': 'meow'
                },
                't': 2
            }
        }
        assert expected == config

        config2 = ConfigFactory.parse_string(
            """
            a {
                include required(file("samples/animals.d/cat.conf"))
                t = 2
            }
            """
        )
        assert expected == config2

    def test_include_missing_required_file(self):
        with pytest.raises(IOError):
            ConfigFactory.parse_string(
                """
                a: [
                    include required("dummy.txt")
                    3
                    4
                ]
                """
            )

    def test_resolve_package_path(self):
        path = ConfigParser.resolve_package_path("pyhocon:config_parser.py")
        assert os.path.exists(path)

    def test_resolve_package_path_format(self):
        with pytest.raises(ValueError):
            ConfigParser.resolve_package_path("pyhocon/config_parser.py")

    def test_resolve_package_path_missing(self):
        with pytest.raises(ImportError):
            ConfigParser.resolve_package_path("non_existent_module:foo.py")

    def test_include_package_file(self, monkeypatch):
        temp_dir = tempfile.mkdtemp()
        try:
            module_dir = os.path.join(temp_dir, 'my_module')
            module_conf = os.path.join(module_dir, 'my.conf')
            # create the module folder and necessary files (__init__ and config)
            os.mkdir(module_dir)
            open(os.path.join(module_dir, '__init__.py'), 'a').close()
            with open(module_conf, 'w') as fdin:
                fdin.write("{c: 3}")
            # add the temp dir to sys.path so that 'my_module' can be discovered
            monkeypatch.syspath_prepend(temp_dir)
            # load the config and include the other config file from 'my_module'
            config = ConfigFactory.parse_string(
                """
                a: 1
                b: 2
                include package("my_module:my.conf")
                """
            )
            # check that the contents of both config files are available
            assert dict(config.as_plain_ordered_dict()) == {'a': 1, 'b': 2, 'c': 3}
        finally:
            shutil.rmtree(temp_dir, ignore_errors=True)

    def test_include_dict(self):
        expected_res = {
            'a': 1,
            'b': 2,
            'c': 3,
            'd': 4
        }
        with tempfile.NamedTemporaryFile('w') as fdin:
            fdin.write('{a: 1, b: 2}')
            fdin.flush()

            config1 = ConfigFactory.parse_string(
                """
                a: {{
                    include "{tmp_file}"
                    c: 3
                    d: 4
                }}
                """.format(tmp_file=fdin.name)
            )
            assert config1['a'] == expected_res

            config2 = ConfigFactory.parse_string(
                """
                a: {{
                    c: 3
                    d: 4
                    include "{tmp_file}"
                }}
                """.format(tmp_file=fdin.name)
            )
            assert config2['a'] == expected_res

            config3 = ConfigFactory.parse_string(
                """
                a: {{
                    c: 3
                    include "{tmp_file}"
                    d: 4
                }}
                """.format(tmp_file=fdin.name)
            )
            assert config3['a'] == expected_res

    def test_include_substitution(self):
        with tempfile.NamedTemporaryFile('w') as fdin:
            fdin.write('y = ${x}')
            fdin.flush()

            config = ConfigFactory.parse_string(
                """
                include "{tmp_file}"
                x = 42
                """.format(tmp_file=fdin.name)
            )
            assert config['x'] == 42
            assert config['y'] == 42

    @pytest.mark.xfail
    def test_include_substitution2(self):
        with tempfile.NamedTemporaryFile('w') as fdin:
            fdin.write('{ x : 10, y : ${x} }')
            fdin.flush()

            config = ConfigFactory.parse_string(
                """
                {
                    a : { include """ + '"' + fdin.name + """" }
                    a : { x : 42 }
                }
                """
            )
            assert config['a']['x'] == 42
            assert config['a']['y'] == 42

    def test_var_with_include_keyword(self):
        config = ConfigFactory.parse_string(
            """
            include-database=true
            """)

        assert config == {
            'include-database': True
        }

    def test_substitution_override(self):
        config = ConfigFactory.parse_string(
            """
            database {
                host = localhost
                port = 5432
                user = people
                name = peopledb
                pass = peoplepass
            }

            user=test_user
            pass=test_pass

            database {
                user = ${user}
                pass = ${pass}
            }

            """)

        assert config['database.user'] == 'test_user'
        assert config['database.pass'] == 'test_pass'

    def test_substitution_flat_override(self):
        config = ConfigFactory.parse_string(
            """
            database {
                name = peopledb
                pass = peoplepass
                name = ${?NOT_EXISTS}
                pass = ${?NOT_EXISTS}
            }
            """)

        assert config['database.name'] == 'peopledb'
        assert config['database.pass'] == 'peoplepass'

    def test_substitution_multiple_override(self):
        config = ConfigFactory.parse_string(
            """
            a: 1
            b: foo
            c: ${a} ${b}
            c: ${b} ${a}
            d: ${a} ${b}
            d: ${a} bar
            """)

        assert config['c'] == 'foo 1'
        assert config['d'] == '1 bar'

    def test_substitution_nested_override(self):
        config = ConfigFactory.parse_string(
            """
            database {
                name = peopledb
                pass = peoplepass
            }

            database {
                name = ${?user}
                pass = ${?pass}
            }

            """)

        assert config['database.name'] == 'peopledb'
        assert config['database.pass'] == 'peoplepass'

    def test_optional_with_merge(self):
        unresolved = ConfigFactory.parse_string(
            """
            foo: 42
            foo: ${?a}
            """, resolve=False)
        source = ConfigFactory.parse_string(
            """
            b: 14
            """)
        config = unresolved.with_fallback(source)
        assert config['foo'] == 42
        config = source.with_fallback(unresolved)
        assert config['foo'] == 42

    def test_fallback_with_resolve(self):
        config3 = ConfigFactory.parse_string("c=5")
        config2 = ConfigFactory.parse_string("b=${c}", resolve=False)
        config1 = ConfigFactory.parse_string("a=${b}", resolve=False) \
            .with_fallback(config2, resolve=False) \
            .with_fallback(config3)
        assert {'a': 5, 'b': 5, 'c': 5} == config1

    def test_optional_substitution(self):
        config = ConfigFactory.parse_string(
            """
            a = 45
            b = ${?c}
            d = ${?c} 4
            e = ${?a}
            g = ${?c1} ${?c2}
            h = ${?c1} ${?c2} 1
            """)

        assert 'b' not in config
        assert config['d'] == 4
        assert config['e'] == 45
        assert 'g' not in config
        assert config['h'] == 1

    def test_cascade_optional_substitution(self):
        config = ConfigFactory.parse_string(
            """
              num = 3
              retries_msg = You have ${num} retries
              retries_msg = ${?CUSTOM_MSG}
            """)
        assert config == {
            'num': 3,
            'retries_msg': 'You have 3 retries'
        }

    def test_substitution_cycle(self):
        with pytest.raises(ConfigSubstitutionException):
            ConfigFactory.parse_string(
                """
                a = ${b}
                b = ${c}
                c = ${a}
                """)

    def test_assign_number_with_eol(self):
        config = ConfigFactory.parse_string(
            """
            a =
            4

            b = # test
            # test2
            5

            c =

            6
            """
        )
        assert config['a'] == 4
        assert config['b'] == 5
        assert config['c'] == 6

    def test_assign_int(self):
        config = ConfigFactory.parse_string(
            """
            short = 12
            long = 12321321837612378126213217321
            negative = -15
            """
        )

        # on python 3 long will be an int but on python 2 long with be a long
        assert config['short'] == 12
        assert isinstance(config['short'], int)
        assert config['long'] == 12321321837612378126213217321
        assert isinstance(config['negative'], int)
        assert config['negative'] == -15

    def test_assign_float(self):
        config = ConfigFactory.parse_string(
            """
            a = 121.22
            b = -121.22
            c = .54
            d = -.54
            """
        )

        # on python 3 long will be an int but on python 2 long with be a long
        assert config['a'] == 121.22
        assert config['b'] == -121.22
        assert config['c'] == .54
        assert config['d'] == -.54

    def test_sci_real(self):
        """
        Test scientific expression of number
        """

        config = ConfigFactory.parse_string(
            """
            short = 12.12321
            long1 = 121.22E3423432
            neg_long1 = 121.22E-1
            long2 = 121.22e3423432
            neg_long2 = 121.22e-3
            """
        )

        # on python 3 long will be an int but on python 2 long with be a long
        assert config['short'] == 12.12321

        assert config['long1'] == 121.22E3423432
        assert config['neg_long1'] == 121.22E-1

        assert config['long2'] == 121.22E3423432
        assert config['neg_long2'] == 121.22E-3

    def test_assign_strings_with_eol(self):
        config = ConfigFactory.parse_string(
            """
            a =
            "a"

            b = # test
            # test2
            "b"

            c =

            "c"
            """
        )
        assert config['a'] == 'a'
        assert config['b'] == 'b'
        assert config['c'] == 'c'

    def test_assign_list_numbers_with_eol(self):
        config = ConfigFactory.parse_string(
            """
            a =
            [
            1,
            2,
            ]

            b = # test
            # test2
            [
            3,
            4,]

            c =

            [
            5,
            6
            ]
            """
        )
        assert config['a'] == [1, 2]
        assert config['b'] == [3, 4]
        assert config['c'] == [5, 6]

    def test_assign_list_strings_with_eol(self):
        config = ConfigFactory.parse_string(
            """
            a =
            [
            "a",
            "b",
            ]

            b = # test
            # test2
            [
            "c",
            "d",]

            c =

            [
            "e",
            "f"
            ]
            """
        )
        assert config['a'] == ['a', 'b']
        assert config['b'] == ['c', 'd']
        assert config['c'] == ['e', 'f']

    def test_assign_dict_strings_with_equal_sign_with_eol(self):
        config = ConfigFactory.parse_string(
            """
            a =
            {
            a: 1,
            b: 2,
            }

            b = # test
            # test2
            {
            c: 3,
            d: 4,}

            c =

            {
            e: 5,
            f: 6
            }
            """
        )
        assert config['a'] == {'a': 1, 'b': 2}
        assert config['b'] == {'c': 3, 'd': 4}
        assert config['c'] == {'e': 5, 'f': 6}

    def test_assign_dict_strings_no_equal_sign_with_eol(self):
        config = ConfigFactory.parse_string(
            """
            a
            {
            a: 1,
            b: 2,
            }

            b # test
            # test2
            {
            c: 3,
            d: 4,}

            c

            {
            e: 5,
            f: 6
            }
            """
        )
        assert config['a'] == {'a': 1, 'b': 2}
        assert config['b'] == {'c': 3, 'd': 4}
        assert config['c'] == {'e': 5, 'f': 6}

    def test_substitutions_overwrite(self):
        config1 = ConfigFactory.parse_string(
            """
            a = 123
            a = ${?test}
            a = 5
            """
        )

        assert config1['a'] == 5

        config2 = ConfigFactory.parse_string(
            """
            {
              database {
                host = "localhost"
                port = 8000
                url = ${database.host}":"${database.port}
              }

              database {
                host = ${?DB_HOST}
              }

              database {
                host = "other.host.net"
                port = 433
              }
            }
            """
        )

        assert config2['database']['host'] == 'other.host.net'
        assert config2['database']['port'] == 433
        assert config2['database']['url'] == 'other.host.net:433'

    def test_fallback_substitutions_overwrite(self):
        config1 = ConfigFactory.parse_string(
            """
            a = {
                b: 1
                c: 2
            }
            """
        )

        config2 = ConfigFactory.parse_string(
            """
            a.b = 4
            a.d = 3
            """
        )

        config3 = config1.with_fallback(config2)

        assert config3['a'] == {
            'b': 1,
            'c': 2,
            'd': 3
        }

        config4 = ConfigFactory.parse_string(
            """
            name: foo
            """
        )

        config5 = ConfigFactory.parse_string(
            u"""
            longName: "long "${?name}
            """,
            resolve=False
        )

        config6 = config4.with_fallback(config5)
        assert config6 == {
            'longName': 'long foo',
            'name': 'foo'
        }

    def test_fallback_substitutions_overwrite_file(self):
        config1 = ConfigFactory.parse_string(
            """
            {
                data-center-generic = { cluster-size: 8 }
                misc = "mist"
            }
            """
        )

        # use unicode path here for regression testing https://github.com/chimpler/pyhocon/issues/44
        config2 = config1.with_fallback(u'samples/aws.conf')
        assert config2 == {
            'data-center-generic': {'cluster-size': 8},
            'data-center-east': {'cluster-size': 8, 'name': 'east'},
            'misc': 'mist',
            'default-jvm-opts': ['-XX:+UseParNewGC'],
            'large-jvm-opts': ['-XX:+UseParNewGC', '-Xm16g']
        }

    def test_fallback_self_ref_substitutions_append(self):
        config1 = ConfigFactory.parse_string(
            """
            list = [ 1, 2, 3 ]
            """
        )
        config2 = ConfigFactory.parse_string(
            """
            list = ${list} [ 4, 5, 6 ]
            """,
            resolve=False
        )
        config2 = config2.with_fallback(config1)
        assert config2.get("list") == [1, 2, 3, 4, 5, 6]

    def test_fallback_self_ref_substitutions_append_plus_equals(self):
        config1 = ConfigFactory.parse_string(
            """
            list = [ 1, 2, 3 ]
            """
        )
        config2 = ConfigFactory.parse_string(
            """
            list += [ 4, 5, 6 ]
            """,
            resolve=False
        )
        config2 = config2.with_fallback(config1)
        assert config2.get("list") == [1, 2, 3, 4, 5, 6]

    def test_self_merge_ref_substitutions_object(self):
        config1 = ConfigFactory.parse_string(
            """
            a : { }
            b : 1
            c : ${a} { d : [ ${b} ] }
            """,
            resolve=False
        )
        config2 = ConfigFactory.parse_string(
            """
            e : ${a} {
            }
            """,
            resolve=False
        )
        merged = ConfigTree.merge_configs(config1, config2)
        ConfigParser.resolve_substitutions(merged)
        assert merged.get("c.d") == [1]

    def test_self_merge_ref_substitutions_object2(self):
        config1 = ConfigFactory.parse_string(
            """
            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}

    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}

    def test_fallback_self_ref_substitutions_merge(self):
        config1 = ConfigFactory.parse_string(
            """
            dict = { x: 1 }
            """
        )
        config2 = ConfigFactory.parse_string(
            """
            dict = ${dict} { y: 2 }
            """,
            resolve=False
        )
        config2 = config2.with_fallback(config1)
        assert config2.get("dict") == {'x': 1, 'y': 2}

    def test_fallback_self_ref_substitutions_concat_string(self):
        config1 = ConfigFactory.parse_string(
            """
            string = abc
            """
        )
        config2 = ConfigFactory.parse_string(
            """
            string = ${string}def
            """,
            resolve=False
        )
        result = config2.with_fallback(config1)
        assert result.get("string") == 'abcdef'

        # test no mutation on config1
        assert result is not config1
        # test no mutation on config2
        assert "abc" not in str(config2)

    def test_fallback_non_root(self):
        root = ConfigFactory.parse_string(
            """
            a = 1
            mid.b = 1
            """
        )

        config = root.get_config("mid").with_fallback(root)
        assert config['a'] == 1 and config['b'] == 1

    def test_object_field_substitution(self):
        config = ConfigFactory.parse_string(
            """
            A = ${Test}

            Test {
                field1 = 1
                field2 = ${Test.field1}"2"
                field3 = ${Test.field2}"3"
            }
            """
        )

        assert config.get_string("A.field1") == "1"
        assert config.get_string("A.field2") == "12"
        assert config.get_string("A.field3") == "123"
        assert config.get_string("Test.field1") == "1"
        assert config.get_string("Test.field2") == "12"
        assert config.get_string("Test.field3") == "123"

    def test_one_line_quote_escape(self):
        config = ConfigFactory.parse_string(
            """
            test_no_quotes: abc\\n\\n
            test_quotes: "abc\\n\\n"
            """
        )

        assert config == {
            'test_no_quotes': 'abc\n\n',
            'test_quotes': 'abc\n\n'
        }

    def test_multi_line_escape(self):
        config = ConfigFactory.parse_string(
            """
with-escaped-backslash: \"\"\"
\\\\
\"\"\"

with-newline-escape-sequence: \"\"\"
\\n
\"\"\"

with-escaped-newline-escape-sequence: \"\"\"
\\\\n
\"\"\"
            """
        )

        assert config['with-escaped-backslash'] == '\n\\\\\n'
        assert config['with-newline-escape-sequence'] == '\n\\n\n'
        assert config['with-escaped-newline-escape-sequence'] == '\n\\\\n\n'

    def test_multiline_with_backslash(self):
        config = ConfigFactory.parse_string(
            """
            test = line1 \
line2
test2 = test
            """)

        assert config == {
            'test': 'line1 line2',
            'test2': 'test'
        }

    def test_from_dict_with_dict(self):
        d = {
            'banana': 3,
            'apple': 4,
            'pear': 1,
            'orange': 2,
        }
        config = ConfigFactory.from_dict(d)
        assert config == d

    def test_from_dict_with_ordered_dict(self):
        d = OrderedDict()
        d['banana'] = 3
        d['apple'] = 4
        d['pear'] = 1
        d['orange'] = 2
        config = ConfigFactory.from_dict(d)
        assert config == d

    def test_from_dict_with_nested_dict(self):
        d = OrderedDict()
        d['banana'] = 3
        d['apple'] = 4
        d['pear'] = 1
        d['tree'] = {
            'a': 'abc\ntest\n',
            'b': [1, 2, 3]
        }
        config = ConfigFactory.from_dict(d)
        assert config == d

    def test_object_concat(self):
        config = ConfigFactory.parse_string(
            """o1 = {
                foo : {
                    a : 1
                    b : 2
                }
            }
            o2 = {
                foo : {
                    b : 3
                    c : 4
                }
            }
            o3 = ${o1} ${o2}
            """
        )

        assert config.get_int('o1.foo.b') == 2
        assert config.get_int('o2.foo.b') == 3
        assert config.get_int('o3.foo.b') == 3
        assert config.get_int('o1.foo.c', default=42) == 42
        assert config.get_int('o3.foo.a') == 1
        assert config.get_int('o3.foo.c') == 4

    def test_issue_75(self):
        config = ConfigFactory.parse_string(
            """base : {
              bar: ["a"]
            }

            sub : ${base} {
              baz: ${base.bar} ["b"]
            }

            sub2: ${sub}
            """
        )

        assert config.get_list('base.bar') == ["a"]
        assert config.get_list('sub.baz') == ["a", "b"]
        assert config.get_list('sub2.baz') == ["a", "b"]

    def test_plain_ordered_dict(self):
        config = ConfigFactory.parse_string(
            """
            e : ${a} {
            }
            """,
            resolve=False
        )
        with pytest.raises(ConfigException):
            config.as_plain_ordered_dict()

    def test_quoted_strings_with_ws(self):
        config = ConfigFactory.parse_string(
            """
            no_trailing_ws = "foo"  "bar  "
            trailing_ws = "foo"  "bar  "{ws}
            trailing_ws_with_comment = "foo"  "bar  "{ws}// comment
            """.format(ws='   '))

        assert config == {
            'no_trailing_ws': "foo  bar  ",
            'trailing_ws': "foo  bar  ",
            'trailing_ws_with_comment': "foo  bar  "
        }

    def test_unquoted_strings_with_ws(self):
        config = ConfigFactory.parse_string(
            """
            a = foo  bar
            """)

        assert config == {
            'a': 'foo  bar'
        }

    def test_quoted_unquoted_strings_with_ws(self):
        config = ConfigFactory.parse_string(
            """
            a = foo  "bar"   dummy
            """)

        assert config == {
            'a': 'foo  bar   dummy'
        }

    def test_quoted_unquoted_strings_with_ws_substitutions(self):
        config = ConfigFactory.parse_string(
            """
            x = 5
            b = test
            a = foo  "bar"  ${b} dummy
            c = foo          ${x}        bv
            d = foo          ${x}        43
            """)

        assert config == {
            'x': 5,
            'b': 'test',
            'a': 'foo  bar  test dummy',
            'c': 'foo          5        bv',
            'd': 'foo          5        43'
        }

    def test_complex_substitutions(self):
        config = ConfigFactory.parse_string(
            """
            a: 1
            b: ${c} {
              pa: [${a}]
              pb: ${b.pa}
            }
            c: { }
            d: { pc: ${b.pa} }
            e: ${b}
            """, resolve=True)

        assert config == {
            'a': 1,
            'b': {'pa': [1], 'pb': [1]},
            'c': {},
            'd': {'pc': [1]},
            'e': {'pa': [1], 'pb': [1]}
        }

    def test_assign_next_line(self):
        config = ConfigFactory.parse_string(
            """
            a = // abc
            abc

            c =
            5
            """)

        assert config == {
            'a': 'abc',
            'c': 5
        }

    @mock.patch.dict(os.environ, STRING_VAR='value_from_environment')
    def test_string_from_environment(self):
        config = ConfigFactory.parse_string(
            """
            string_from_env = ${STRING_VAR}
            """)
        assert config == {
            'string_from_env': 'value_from_environment'
        }

    @mock.patch.dict(os.environ, STRING_VAR='value_from_environment')
    def test_string_from_environment_self_ref(self):
        config = ConfigFactory.parse_string(
            """
            STRING_VAR = ${STRING_VAR}
            """)
        assert config == {
            'STRING_VAR': 'value_from_environment'
        }

    @mock.patch.dict(os.environ, STRING_VAR='value_from_environment')
    def test_string_from_environment_self_ref_optional(self):
        config = ConfigFactory.parse_string(
            """
            STRING_VAR = ${?STRING_VAR}
            """)
        assert config == {
            'STRING_VAR': 'value_from_environment'
        }

    @mock.patch.dict(os.environ, TRUE_OR_FALSE='false')
    def test_bool_from_environment(self):
        config = ConfigFactory.parse_string(
            """
            bool_from_env = ${TRUE_OR_FALSE}
            """)
        assert config == {
            'bool_from_env': 'false'
        }
        assert config.get_bool('bool_from_env') is False

    @mock.patch.dict(os.environ, INT_VAR='5')
    def test_int_from_environment(self):
        config = ConfigFactory.parse_string(
            """
            int_from_env = ${INT_VAR}
            """)
        assert config == {
            'int_from_env': '5'
        }
        assert config.get_int('int_from_env') == 5

    def test_unicode_dict_key(self):
        input_string = u"""
www.sample.com {
    us {
        name = "first domain"
    }
}
www.example-ö.com {
    us {
        name = "second domain"
    }
}
        """

        config = ConfigFactory.parse_string(input_string)

        assert config.get_string(u'www.sample.com.us.name') == 'first domain'
        assert config.get_string(u'www.example-ö.com.us.name') == 'second domain'
        with pytest.raises(ConfigWrongTypeException):
            config.put(u'www.example-ö', 'append_failure', append=True)
        with pytest.raises(ConfigMissingException):
            config.get_string(u'missing_unicode_key_ö')
        with pytest.raises(ConfigException):
            config.get_bool(u'www.example-ö.com.us.name')
        with pytest.raises(ConfigException):
            config.get_list(u'www.example-ö.com.us.name')
        with pytest.raises(ConfigException):
            config.get_config(u'www.example-ö.com.us.name')
        with pytest.raises(ConfigWrongTypeException):
            config.get_string(u'www.example-ö.com.us.name.missing')

    def test_with_comment_on_last_line(self):
        # Adress issue #102
        config_tree = ConfigFactory.parse_string("""
        foo: "1"
        bar: "2"
        # DO NOT CHANGE ANY OF THE ABOVE SETTINGS!""")
        assert config_tree == {
            'foo': '1',
            'bar': '2'
        }

    def test_triple_quotes_same_line(self):
        config_tree = ConfigFactory.parse_string('a:["""foo"""", "bar"]')
        assert config_tree == {
            'a': ['foo"', "bar"]
        }

    def test_pop(self):
        config_tree = ConfigFactory.parse_string('a:{b: 3, d: 6}')
        assert 3 == config_tree.pop('a.b', 5)
        assert 5 == config_tree.pop('a.c', 5)
        expected = {
            'a': {'d': 6}
        }
        assert expected == config_tree

    def test_merge_overriden(self):
        # Adress issue #110
        # ConfigValues must merge with its .overriden_value
        # if both are ConfigTree
        config_tree = ConfigFactory.parse_string("""
        foo: ${bar}
        foo: ${baz}
        bar:  {r: 1, s: 2}
        baz:  {s: 3, t: 4}
        """)
        assert 'r' in config_tree['foo'] and 't' in config_tree['foo'] and config_tree['foo']['s'] == 3

    def test_attr_syntax(self):
        config = ConfigFactory.parse_string(
            """
            a: 1
            b: {
              pb: 5
            }
            """)
        assert 5 == config.b.pb

    def test_escape_quote(self):
        config = ConfigFactory.parse_string(
            """
            quoted: "abc\\"test"
            unquoted: abc\\"test
            """)
        assert 'abc"test' == config['quoted']
        assert 'abc"test' == config['unquoted']

    def test_escape_quote_complex(self):
        config = ConfigFactory.parse_string(
            """
            value: "{\\"critical\\":\\"0.00\\",\\"warning\\":\\"99.99\\"}"
            """
        )

        assert '{"critical":"0.00","warning":"99.99"}' == config['value']

    def test_keys_with_slash(self):
        config = ConfigFactory.parse_string(
            """
            /abc/cde1: abc
            "/abc/cde2": "cde"
            /abc/cde3: "fgh"
            """)
        assert 'abc' == config['/abc/cde1']
        assert 'cde' == config['/abc/cde2']
        assert 'fgh' == config['/abc/cde3']

    def test_mutation_values(self):
        config = ConfigFactory.parse_string(
            """
            common : {
            }

            b1 = []

            var = "wrong"

            compilerCommon : ${common} {
                VAR : ${var}
            }

            substrate-suite: {
                VAR  : "right"
            }
            b1 = [
              ${compilerCommon} ${substrate-suite}
              ${compilerCommon} ${substrate-suite}
            ]

            b2 = [
              ${compilerCommon} ${substrate-suite}
              ${compilerCommon} ${substrate-suite}
            ]
            """)

        assert config.get("b1")[1]['VAR'] == 'right'
        assert config.get("b2")[1]['VAR'] == 'right'

    def test_escape_sequences_json_equivalence(self):
        """
        Quoted strings are in the same format as JSON strings,
        See: https://github.com/lightbend/config/blob/master/HOCON.md#unchanged-from-json
        """
        source = r"""
        {
            "plain-backslash": "\\",
            "tab": "\t",
            "no-tab": "\\t",
            "newline": "\n",
            "no-newline": "\\n",
            "cr": "\r",
            "no-cr": "\\r",
            "windows": "c:\\temp"
        }
        """
        expected = {
            'plain-backslash': '\\',
            'tab': '\t',
            'no-tab': '\\t',
            'newline': '\n',
            'no-newline': '\\n',
            'cr': '\r',
            'no-cr': '\\r',
            'windows': 'c:\\temp',
        }
        config = ConfigFactory.parse_string(source)
        assert config == expected
        assert config == json.loads(source)


try:
    from dateutil.relativedelta import relativedelta

    @pytest.mark.parametrize('data_set', [
        ('a: 1 months', relativedelta(months=1)),
        ('a: 1months', relativedelta(months=1)),
        ('a: 2 month', relativedelta(months=2)),
        ('a: 3 mo', relativedelta(months=3)),
        ('a: 3mo', relativedelta(months=3)),
        ('a: 3 mon', '3 mon'),

        ('a: 1 years', relativedelta(years=1)),
        ('a: 1years', relativedelta(years=1)),
        ('a: 2 year', relativedelta(years=2)),
        ('a: 3 y', relativedelta(years=3)),
        ('a: 3y', relativedelta(years=3)),

    ])
    def test_parse_string_with_duration_optional_units(data_set):
        config = ConfigFactory.parse_string(data_set[0])

        assert config['a'] == data_set[1]
except Exception:
    pass

[((63, 5, 63, 88), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ({(63, 29, 63, 45): '"""forbidden_char"""', (63, 47, 63, 87): "['+', '`', '^', '?', '!', '@', '*', '&']"}, {}), "('forbidden_char', ['+', '`', '^', '?', '!', '@',\n    '*', '&'])", False, 'import pytest\n'), ((68, 5, 68, 58), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ({(68, 29, 68, 45): '"""forbidden_char"""', (68, 47, 68, 57): '[\'$\', \'"\']'}, {}), '(\'forbidden_char\', [\'$\', \'"\'])', False, 'import pytest\n'), ((73, 5, 73, 88), 'pytest.mark.parametrize', 'pytest.mark.parametrize', ({(73, 29, 73, 45): '"""forbidden_char"""', (73, 47, 73, 87): "['+', '`', '^', '?', '!', '@', '*', '&']"}, {}), "('forbidden_char', ['+', '`', '^', '?', '!', '@',\n    '*', '&'])", False, 'import pytest\n'), ((2215, 5, 2215, 69), 'mock.patch.dict', 'mock.patch.dict', (), '', False, 'import mock\n'), ((2225, 5, 2225, 69), 'mock.patch.dict', 'mock.patch.dict', (), '', False, 'import mock\n'), ((2235, 5, 2235, 69), 'mock.patch.dict', 'mock.patch.dict', (), '', False, 'import mock\n'), ((2245, 5, 2245, 55), 'mock.patch.dict', 'mock.patch.dict', (), '', False, 'import mock\n'), ((2256, 5, 2256, 45), 'mock.patch.dict', 'mock.patch.dict', (), '', False, 'import mock\n'), ((25, 17, 43, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(26, 12, 42, 15): '"""t = {\n                c = 5\n                "d" = true\n                e.y = {\n                    f: 7\n                    g: "hey dude!"\n                    h: hey man\n                    i = ""\\"\n                        "first line"\n                        "second" line\n                        ""\\"\n                }\n                j = [1, 2, 3]\n                u = 192.168.1.3/32\n                g = null\n            }\n            """'}, {}), '(\n    """t = {\n                c = 5\n                "d" = true\n                e.y = {\n                    f: 7\n                    g: "hey dude!"\n                    h: hey man\n                    i = ""\\"\n                        "first line"\n                        "second" line\n                        ""\\"\n                }\n                j = [1, 2, 3]\n                u = 192.168.1.3/32\n                g = null\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((80, 17, 88, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(81, 12, 87, 15): '"""\n            {\n                a: {\n                    b: 5\n                }\n            }\n            """'}, {}), '(\n    """\n            {\n                a: {\n                    b: 5\n                }\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((137, 17, 137, 56), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(137, 44, 137, 55): 'data_set[0]'}, {}), '(data_set[0])', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((142, 17, 148, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(143, 12, 147, 15): '"""\n            a: foo\n            b: 10 weeks\n            c: bar\n            """'}, {}), '(\n    """\n            a: foo\n            b: 10 weeks\n            c: bar\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((152, 17, 158, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(153, 12, 157, 15): '"""\n            a: foo\n            b: [a, 1, 10 weeks, 5 minutes,]\n            c: bar\n            """'}, {}), '(\n    """\n            a: foo\n            b: [a, 1, 10 weeks, 5 minutes,]\n            c: bar\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((162, 17, 162, 56), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(162, 44, 162, 55): '"""[1, 2, 3]"""'}, {}), "('[1, 2, 3]')", False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((166, 17, 178, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(167, 12, 177, 15): '"""\n            "a.b.c.d": 3\n            t {\n              "d": {\n                "c": 5\n              }\n            }\n            k {\n                "b.f.d": 7\n            }\n            """'}, {}), '(\n    """\n            "a.b.c.d": 3\n            t {\n              "d": {\n                "c": 5\n              }\n            }\n            k {\n                "b.f.d": 7\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((184, 17, 193, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(185, 12, 192, 15): '"""\n            a {\n                b = foo\n                c = bar\n            }\n            a.c = ${a.b}" "${a.b}\n            a.d = baz\n            """'}, {}), '(\n    """\n            a {\n                b = foo\n                c = bar\n            }\n            a.c = ${a.b}" "${a.b}\n            a.d = baz\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((199, 17, 209, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(200, 12, 208, 15): '"""\n            a=1,\n            b="abc",\n            c=the man,\n            d=woof,\n            a-b-c-d=test,\n            a b c d=test2,\n            "a b c d e"=test3\n            """'}, {}), '(\n    """\n            a=1,\n            b="abc",\n            c=the man,\n            d=woof,\n            a-b-c-d=test,\n            a b c d=test2,\n            "a b c d e"=test3\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((219, 17, 239, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(220, 12, 239, 15): '"""\n            a {\n                    d {\n                            g.h.j.u: 5\n                            g {\n                                    h.d: 4\n                            }\n                            g.h.k: f d\n                    }\n\n                    h.i.m = 7\n                    h.i {\n                            d: 5\n                    }\n\n                    h.i {\n                            e:65\n                    }\n            }\n            """'}, {}), '(\n    """\n            a {\n                    d {\n                            g.h.j.u: 5\n                            g {\n                                    h.d: 4\n                            }\n                            g.h.k: f d\n                    }\n\n                    h.i.m = 7\n                    h.i {\n                            d: 5\n                    }\n\n                    h.i {\n                            e:65\n                    }\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((266, 17, 285, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(267, 12, 284, 15): '"""\n            // comment 1\n            # comment 2\n            {\n                c = test   // comment 0\n                g = 6 test   # comment 0\n                # comment 3\n                a: { # comment 4\n                    b: test,                # comment 5\n                } # comment 6\n                t = [1, # comment 7\n                     2, # comment 8\n                     3, # comment 9\n                ]\n            } # comment 10\n            // comment 11\n            // comment 12\n            """'}, {}), '(\n    """\n            // comment 1\n            # comment 2\n            {\n                c = test   // comment 0\n                g = 6 test   # comment 0\n                # comment 3\n                a: { # comment 4\n                    b: test,                # comment 5\n                } # comment 6\n                t = [1, # comment 7\n                     2, # comment 8\n                     3, # comment 9\n                ]\n            } # comment 10\n            // comment 11\n            // comment 12\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((294, 17, 298, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(295, 12, 297, 15): '"""\n            a = 5\n            """'}, {}), '("""\n            a = 5\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((304, 17, 309, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(305, 12, 308, 15): '"""\n            a = null\n            b = [null]\n            """'}, {}), '(\n    """\n            a = null\n            b = [null]\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((314, 17, 328, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(315, 12, 327, 15): '"""\n            {\n                a: {\n                    b: {\n                        c = 5\n                    }\n                }\n                a.b {\n                    c = 7\n                    d = 8\n                }\n            }\n            """'}, {}), '(\n    """\n            {\n                a: {\n                    b: {\n                        c = 5\n                    }\n                }\n                a.b {\n                    c = 7\n                    d = 8\n                }\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((334, 17, 342, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(335, 12, 341, 15): '"""\n            a: {b: 1}\n            a: {c: 2}\n            b: {c: 3} {d: 4} {\n                c: 5\n            }\n            """'}, {}), '(\n    """\n            a: {b: 1}\n            a: {c: 2}\n            b: {c: 3} {d: 4} {\n                c: 5\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((349, 17, 355, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(350, 12, 354, 15): '"""\n            a = a b c\n            b = 5 b\n            c = b 7\n            """'}, {}), '(\n    """\n            a = a b c\n            b = 5 b\n            c = b 7\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((362, 17, 369, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(363, 12, 368, 15): '"""\n            a = [1, 2] [3, 4] [\n              5,\n              6\n            ]\n            """'}, {}), '(\n    """\n            a = [1, 2] [3, 4] [\n              5,\n              6\n            ]\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((375, 8, 375, 46), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(375, 35, 375, 45): '"""a = 45\n"""'}, {}), "('a = 45\\n')", False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((384, 18, 397, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(385, 12, 396, 15): '"""\n            {\n                a: {\n                    b: {\n                        c = str\n                        e = "str      "\n                    }\n                }\n                d = ${a.b.c}\n                f = ${a.b.e}\n            }\n            """'}, {}), '(\n    """\n            {\n                a: {\n                    b: {\n                        c = str\n                        e = "str      "\n                    }\n                }\n                d = ${a.b.c}\n                f = ${a.b.e}\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((403, 18, 416, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(404, 12, 415, 15): '"""\n            {\n                a: {\n                    b: {\n                        c = str\n                        e = "str      "\n                    }\n                }\n                d = test  ${a.b.c}\n                f = test  ${a.b.e}\n            }\n            """'}, {}), '(\n    """\n            {\n                a: {\n                    b: {\n                        c = str\n                        e = "str      "\n                    }\n                }\n                d = test  ${a.b.c}\n                f = test  ${a.b.e}\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((422, 18, 435, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(423, 12, 434, 15): 'u"""\n            {\n                a: {\n                    b: {\n                        c = str\n                        e = "str      "\n                    }\n                }\n                d = test  ${a.b.c}  me\n                f = test  ${a.b.e}  me\n            }\n            """'}, {}), '(\n    u"""\n            {\n                a: {\n                    b: {\n                        c = str\n                        e = "str      "\n                    }\n                }\n                d = test  ${a.b.c}  me\n                f = test  ${a.b.e}  me\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((442, 17, 450, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(443, 12, 449, 15): '"""\n                app.heap_size = 128\n                app.java_opts = [\n                    -Xms${app.heap_size}m\n                    -Xmx${app.heap_size}m\n                ]\n            """'}, {}), '(\n    """\n                app.heap_size = 128\n                app.java_opts = [\n                    -Xms${app.heap_size}m\n                    -Xmx${app.heap_size}m\n                ]\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((458, 18, 469, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(459, 12, 468, 15): '"""\n            {\n                a: {\n                    b: {\n                        c = 5\n                    }\n                }\n                d = ${a.b.c}\n            }\n            """'}, {}), '(\n    """\n            {\n                a: {\n                    b: {\n                        c = 5\n                    }\n                }\n                d = ${a.b.c}\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((474, 18, 485, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(475, 12, 484, 15): '"""\n            {\n                a: {\n                    b: {\n                        c = 5\n                    }\n                }\n                d = test ${a.b.c}\n            }\n            """'}, {}), '(\n    """\n            {\n                a: {\n                    b: {\n                        c = 5\n                    }\n                }\n                d = test ${a.b.c}\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((490, 18, 501, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(491, 12, 500, 15): '"""\n            {\n                a: {\n                    b: {\n                        c = 5\n                    }\n                }\n                d = test ${a.b.c} me\n            }\n            """'}, {}), '(\n    """\n            {\n                a: {\n                    b: {\n                        c = 5\n                    }\n                }\n                d = test ${a.b.c} me\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((507, 17, 519, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(508, 12, 518, 15): '"""\n            {\n                a: {\n                    b: {\n                        c = ${e}\n                    }\n                }\n                d = test ${a.b.c} me\n                e = 7\n            }\n            """'}, {}), '(\n    """\n            {\n                a: {\n                    b: {\n                        c = ${e}\n                    }\n                }\n                d = test ${a.b.c} me\n                e = 7\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((525, 17, 531, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(526, 12, 530, 15): '"""\n                a = 5\n                b=${a}${a}\n                c=${a} ${a}\n            """'}, {}), '(\n    """\n                a = 5\n                b=${a}${a}\n                c=${a} ${a}\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((540, 17, 545, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(541, 12, 544, 15): '"""\n                data-center-generic = { cluster-size = 6 }\n                data-center-east = ${data-center-generic} {name = "east"}\n            """'}, {}), '(\n    """\n                data-center-generic = { cluster-size = 6 }\n                data-center-east = ${data-center-generic} {name = "east"}\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((550, 18, 555, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(551, 12, 554, 15): '"""\n                data-center-generic = { cluster-size = 6 }\n                data-center-east = {name = "east"} ${data-center-generic}\n            """'}, {}), '(\n    """\n                data-center-generic = { cluster-size = 6 }\n                data-center-east = {name = "east"} ${data-center-generic}\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((560, 18, 565, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(561, 12, 564, 15): '"""\n                data-center-generic = { cluster-size = 6 }\n                data-center-east = {name = "east"} ${data-center-generic} { cluster-size = 9, opts = "-Xmx4g" }\n            """'}, {}), '(\n    """\n                data-center-generic = { cluster-size = 6 }\n                data-center-east = {name = "east"} ${data-center-generic} { cluster-size = 9, opts = "-Xmx4g" }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((571, 18, 577, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(572, 12, 576, 15): '"""\n                data-center-generic = { cluster-size = 6 }\n                data-center-east = {name = "east"} ${data-center-generic}\n                data-center-east-prod = ${data-center-east} {tmpDir=/tmp}\n            """'}, {}), '(\n    """\n                data-center-generic = { cluster-size = 6 }\n                data-center-east = {name = "east"} ${data-center-generic}\n                data-center-east-prod = ${data-center-east} {tmpDir=/tmp}\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((584, 18, 590, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(585, 12, 589, 15): '"""\n                data-center-generic = { cluster-size = 6 }\n                data-center-east = ${data-center-generic}\n                data-center-east = { name = "east" }\n            """'}, {}), '(\n    """\n                data-center-generic = { cluster-size = 6 }\n                data-center-east = ${data-center-generic}\n                data-center-east = { name = "east" }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((597, 18, 603, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(598, 12, 602, 15): '"""\n                data-center-generic = { cluster-size = 6 }\n                data-center-east = { name = "east" }\n                data-center-east = ${data-center-generic}\n            """'}, {}), '(\n    """\n                data-center-generic = { cluster-size = 6 }\n                data-center-east = { name = "east" }\n                data-center-east = ${data-center-generic}\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((610, 17, 610, 56), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(610, 44, 610, 55): '"""foo = bar"""'}, {}), "('foo = bar')", False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((614, 17, 614, 56), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(614, 44, 614, 55): '"""foo = "5\\""""'}, {}), '(\'foo = "5"\')', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((618, 17, 618, 60), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(618, 44, 618, 59): '"""foo = ""\\"5""\\""""'}, {}), '(\'foo = """5"""\')', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((622, 17, 622, 54), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(622, 44, 622, 53): '"""foo = 5"""'}, {}), "('foo = 5')", False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((626, 17, 626, 56), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(626, 44, 626, 55): '"""foo = 5.0"""'}, {}), "('foo = 5.0')", False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((630, 17, 635, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(631, 12, 634, 15): '"""\n                common_modules = [php, python]\n                host_modules = ${common_modules} [java]\n            """'}, {}), '(\n    """\n                common_modules = [php, python]\n                host_modules = ${common_modules} [java]\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((639, 18, 644, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(640, 12, 643, 15): '"""\n                common_modules = [php, python]\n                host_modules = [java] ${common_modules}\n            """'}, {}), '(\n    """\n                common_modules = [php, python]\n                host_modules = [java] ${common_modules}\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((648, 18, 653, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(649, 12, 652, 15): '"""\n                common_modules = [php, python]\n                host_modules = [java] ${common_modules} [perl]\n            """'}, {}), '(\n    """\n                common_modules = [php, python]\n                host_modules = [java] ${common_modules} [perl]\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((658, 18, 664, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(659, 12, 663, 15): '"""\n                common_modules = [php, python]\n                host_modules = [java] ${common_modules} [perl]\n                full_modules = ${host_modules} [c, go]\n            """'}, {}), '(\n    """\n                common_modules = [php, python]\n                host_modules = [java] ${common_modules} [perl]\n                full_modules = ${host_modules} [c, go]\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((671, 17, 676, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(672, 12, 675, 15): '"""\n                main_language = php\n                languages = [java, ${main_language}]\n            """'}, {}), '(\n    """\n                main_language = php\n                languages = [java, ${main_language}]\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((681, 17, 686, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(682, 12, 686, 15): '"""\n            application.foo = 128mm\n            application.large-jvm-opts = ["-XX:+UseParNewGC"] [-Xm16g, ${application.foo}]\n            application.large-jvm-opts2 = [-Xm16g, ${application.foo}] ["-XX:+UseParNewGC"]\n            """'}, {}), '(\n    """\n            application.foo = 128mm\n            application.large-jvm-opts = ["-XX:+UseParNewGC"] [-Xm16g, ${application.foo}]\n            application.large-jvm-opts2 = [-Xm16g, ${application.foo}] ["-XX:+UseParNewGC"]\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((701, 17, 707, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(702, 12, 707, 15): '"""\n            application.foo = 128mm\n            application.default-jvm-opts = ["-XX:+UseParNewGC"]\n            application.large-jvm-opts = ${application.default-jvm-opts} [-Xm16g, ${application.foo}]\n            application.large-jvm-opts2 = [-Xm16g, ${application.foo}] ${application.default-jvm-opts}\n            """'}, {}), '(\n    """\n            application.foo = 128mm\n            application.default-jvm-opts = ["-XX:+UseParNewGC"]\n            application.large-jvm-opts = ${application.default-jvm-opts} [-Xm16g, ${application.foo}]\n            application.large-jvm-opts2 = [-Xm16g, ${application.foo}] ${application.default-jvm-opts}\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((800, 17, 807, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(801, 12, 806, 15): '"""\n            x = [1,2]\n            x = ${x} [3,4]\n            x = [-1, 0] ${x} [5, 6]\n            x = [-3, -2] ${x}\n            """'}, {}), '(\n    """\n            x = [1,2]\n            x = ${x} [3,4]\n            x = [-1, 0] ${x} [5, 6]\n            x = [-3, -2] ${x}\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((811, 17, 816, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(812, 12, 815, 15): '"""\n            x = [1,2]\n            x += [3,4]\n            """'}, {}), '(\n    """\n            x = [1,2]\n            x += [3,4]\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((825, 17, 830, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(826, 12, 829, 15): '"""\n            x = abc\n            x += def\n            """'}, {}), '(\n    """\n            x = abc\n            x += def\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((837, 17, 841, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(838, 12, 840, 15): '"""\n            x += def\n            """'}, {}), '("""\n            x += def\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((845, 17, 849, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(846, 12, 848, 15): '"""\n            x += [1,2]\n            """'}, {}), '("""\n            x += [1,2]\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((853, 17, 858, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(854, 12, 857, 15): '"""\n            x = {a: 1}\n            x += {b: 2}\n            """'}, {}), '(\n    """\n            x = {a: 1}\n            x += {b: 2}\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((862, 17, 866, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(863, 12, 865, 15): '"""\n            x += {a: 1}\n            """'}, {}), '("""\n            x += {a: 1}\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((870, 17, 877, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(871, 12, 876, 15): '"""\n            x = [1,2]\n            x = {x: [3,4]}\n            x = {y: [5,6]}\n            x = {z: ${x}}\n            """'}, {}), '(\n    """\n            x = [1,2]\n            x = {x: [3,4]}\n            x = {y: [5,6]}\n            x = {z: ${x}}\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((883, 17, 888, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(884, 12, 887, 15): '"""\n            x = {x: [3,4]}\n            x = [${x}, 2, 3]\n            """'}, {}), '(\n    """\n            x = {x: [3,4]}\n            x = [${x}, 2, 3]\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((895, 17, 900, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(896, 12, 899, 15): '"""\n            x = {y: {z: 1}}\n            x = ${x.y}\n            """'}, {}), '(\n    """\n            x = {y: {z: 1}}\n            x = ${x.y}\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((906, 17, 911, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(907, 12, 910, 15): '"""\n            x = {y: {y: 1}}\n            x = ${x.y}\n            """'}, {}), '(\n    """\n            x = {y: {y: 1}}\n            x = ${x.y}\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((936, 17, 942, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(937, 12, 941, 15): '"""\n            foo : { a : { c : 1 } }\n            foo : ${foo.a}\n            foo : { a : 2 }\n            """'}, {}), '(\n    """\n            foo : { a : { c : 1 } }\n            foo : ${foo.a}\n            foo : { a : 2 }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((950, 17, 957, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(951, 12, 956, 15): '"""\n            bar : {\n              foo : 42,\n              baz : ${bar.foo}\n            }\n            """'}, {}), '(\n    """\n            bar : {\n              foo : 42,\n              baz : ${bar.foo}\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((965, 17, 973, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(966, 12, 972, 15): '"""\n            bar : {\n                foo : 42,\n                baz : ${bar.foo}\n            }\n            bar : { foo : 43 }\n            """'}, {}), '(\n    """\n            bar : {\n                foo : 42,\n                baz : ${bar.foo}\n            }\n            bar : { foo : 43 }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((981, 17, 990, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(982, 12, 989, 15): '"""\n            // bar.a should end up as 4\n            bar : { a : ${foo.d}, b : 1 }\n            bar.b = 3\n            // foo.c should end up as 3\n            foo : { c : ${bar.b}, d : 2 }\n            foo.d = 4\n            """'}, {}), '(\n    """\n            // bar.a should end up as 4\n            bar : { a : ${foo.d}, b : 1 }\n            bar.b = 3\n            // foo.c should end up as 3\n            foo : { c : ${bar.b}, d : 2 }\n            foo.d = 4\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((999, 17, 1003, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1000, 12, 1002, 15): '"""\n            a = ${?a}foo\n            """'}, {}), '("""\n            a = ${?a}foo\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1017, 17, 1024, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1018, 12, 1023, 15): '"""\n            x = {a: 1, b: 2}\n            x = ${x} {c: 3}\n            x = {z: 0} ${x}\n            x = {y: -1} ${x} {d: 4}\n            """'}, {}), '(\n    """\n            x = {a: 1, b: 2}\n            x = ${x} {c: 3}\n            x = {z: 0} ${x}\n            x = {y: -1} ${x} {d: 4}\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1028, 17, 1039, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1029, 12, 1038, 15): '"""\n                a.b = 3\n                a.b = ${a.b}\n                a.b = ${a.b}\n                a.c = [1,2]\n                a.c = ${a.c}\n                a.d = {foo: bar}\n                a.d = ${a.d}\n\n            """'}, {}), '(\n    """\n                a.b = 3\n                a.b = ${a.b}\n                a.b = ${a.b}\n                a.c = [1,2]\n                a.c = ${a.c}\n                a.d = {foo: bar}\n                a.d = ${a.d}\n\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1043, 17, 1049, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1044, 12, 1048, 15): '"""\n                common_modules = perl                 java                 python\n            """'}, {}), '(\n    """\n                common_modules = perl                 java                 python\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1054, 17, 1060, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1055, 12, 1059, 15): '"""\n                common_modules = [perl]                 [java]                 [python]\n            """'}, {}), '(\n    """\n                common_modules = [perl]                 [java]                 [python]\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1065, 17, 1071, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1066, 12, 1070, 15): '"""\n                common_modules = {a:perl}                 {b:java}                 {c:python}\n            """'}, {}), '(\n    """\n                common_modules = {a:perl}                 {b:java}                 {c:python}\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1076, 17, 1076, 65), 'pyhocon.ConfigFactory.parse_URL', 'ConfigFactory.parse_URL', ({(1076, 41, 1076, 64): '"""file:samples/aws.conf"""'}, {}), "('file:samples/aws.conf')", False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1081, 17, 1081, 61), 'pyhocon.ConfigFactory.parse_URL', 'ConfigFactory.parse_URL', ({(1081, 41, 1081, 60): '"""https://nosuchurl"""'}, {}), "('https://nosuchurl')", False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1085, 17, 1085, 65), 'pyhocon.ConfigFactory.parse_file', 'ConfigFactory.parse_file', ({(1085, 42, 1085, 64): '"""samples/animals.conf"""'}, {}), "('samples/animals.conf')", False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1090, 17, 1090, 69), 'pyhocon.ConfigFactory.parse_file', 'ConfigFactory.parse_file', ({(1090, 42, 1090, 68): '"""samples/all_animals.conf"""'}, {}), "('samples/all_animals.conf')", False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1095, 17, 1095, 66), 'pyhocon.ConfigFactory.parse_file', 'ConfigFactory.parse_file', ({(1095, 42, 1095, 65): '"""samples/all_bars.conf"""'}, {}), "('samples/all_bars.conf')", False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1107, 17, 1114, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1108, 12, 1113, 15): '"""\n            a: [\n                {a: 1, b: 2},\n                {a: 3, c: 4},\n            ]\n            """'}, {}), '(\n    """\n            a: [\n                {a: 1, b: 2},\n                {a: 3, c: 4},\n            ]\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1121, 17, 1128, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1122, 12, 1127, 15): '"""\n            a: [\n                [1, 2]\n                [3, 4]\n            ]\n            """'}, {}), '(\n    """\n            a: [\n                [1, 2]\n                [3, 4]\n            ]\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1135, 17, 1144, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1136, 12, 1143, 15): '"""\n            b = {f: 4}\n            a: [\n                ${b} {a: 1, b: 2},\n                {a: 3, c: 4} ${b},\n                {a: 3} ${b} {c: 6},\n            ]\n            """'}, {}), '(\n    """\n            b = {f: 4}\n            a: [\n                ${b} {a: 1, b: 2},\n                {a: 3, c: 4} ${b},\n                {a: 3} ${b} {c: 6},\n            ]\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1152, 17, 1161, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1153, 12, 1160, 15): '"""\n            b = [5, 6]\n            a: [\n                ${b} [1, 2]\n                [3, 4] ${b}\n                [1, 2] ${b} [7, 8]\n            ]\n            """'}, {}), '(\n    """\n            b = [5, 6]\n            a: [\n                ${b} [1, 2]\n                [3, 4] ${b}\n                [1, 2] ${b} [7, 8]\n            ]\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1228, 18, 1236, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1229, 12, 1235, 15): '"""\n            a: [\n                include "dummy.txt"\n                3\n                4\n            ]\n            """'}, {}), '(\n    """\n            a: [\n                include "dummy.txt"\n                3\n                4\n            ]\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1240, 17, 1247, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1241, 12, 1246, 15): '"""\n            a {\n                include required("samples/animals.d/cat.conf")\n                t = 2\n            }\n            """'}, {}), '(\n    """\n            a {\n                include required("samples/animals.d/cat.conf")\n                t = 2\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1258, 18, 1265, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1259, 12, 1264, 15): '"""\n            a {\n                include required(file("samples/animals.d/cat.conf"))\n                t = 2\n            }\n            """'}, {}), '(\n    """\n            a {\n                include required(file("samples/animals.d/cat.conf"))\n                t = 2\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1281, 15, 1281, 76), 'pyhocon.ConfigParser.resolve_package_path', 'ConfigParser.resolve_package_path', ({(1281, 49, 1281, 75): '"""pyhocon:config_parser.py"""'}, {}), "('pyhocon:config_parser.py')", False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1282, 15, 1282, 35), 'os.path.exists', 'os.path.exists', ({(1282, 30, 1282, 34): 'path'}, {}), '(path)', False, 'import os\n'), ((1293, 19, 1293, 37), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ({}, {}), '()', False, 'import tempfile\n'), ((1393, 17, 1396, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1394, 12, 1396, 15): '"""\n            include-database=true\n            """'}, {}), '(\n    """\n            include-database=true\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1403, 17, 1421, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1404, 12, 1421, 15): '"""\n            database {\n                host = localhost\n                port = 5432\n                user = people\n                name = peopledb\n                pass = peoplepass\n            }\n\n            user=test_user\n            pass=test_pass\n\n            database {\n                user = ${user}\n                pass = ${pass}\n            }\n\n            """'}, {}), '(\n    """\n            database {\n                host = localhost\n                port = 5432\n                user = people\n                name = peopledb\n                pass = peoplepass\n            }\n\n            user=test_user\n            pass=test_pass\n\n            database {\n                user = ${user}\n                pass = ${pass}\n            }\n\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1427, 17, 1435, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1428, 12, 1435, 15): '"""\n            database {\n                name = peopledb\n                pass = peoplepass\n                name = ${?NOT_EXISTS}\n                pass = ${?NOT_EXISTS}\n            }\n            """'}, {}), '(\n    """\n            database {\n                name = peopledb\n                pass = peoplepass\n                name = ${?NOT_EXISTS}\n                pass = ${?NOT_EXISTS}\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1441, 17, 1449, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1442, 12, 1449, 15): '"""\n            a: 1\n            b: foo\n            c: ${a} ${b}\n            c: ${b} ${a}\n            d: ${a} ${b}\n            d: ${a} bar\n            """'}, {}), '(\n    """\n            a: 1\n            b: foo\n            c: ${a} ${b}\n            c: ${b} ${a}\n            d: ${a} ${b}\n            d: ${a} bar\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1455, 17, 1467, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1456, 12, 1467, 15): '"""\n            database {\n                name = peopledb\n                pass = peoplepass\n            }\n\n            database {\n                name = ${?user}\n                pass = ${?pass}\n            }\n\n            """'}, {}), '(\n    """\n            database {\n                name = peopledb\n                pass = peoplepass\n            }\n\n            database {\n                name = ${?user}\n                pass = ${?pass}\n            }\n\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1473, 21, 1477, 31), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', (), '', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1478, 17, 1481, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1479, 12, 1481, 15): '"""\n            b: 14\n            """'}, {}), '("""\n            b: 14\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1488, 18, 1488, 51), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1488, 45, 1488, 50): '"""c=5"""'}, {}), "('c=5')", False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1489, 18, 1489, 69), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', (), '', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1496, 17, 1504, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1497, 12, 1504, 15): '"""\n            a = 45\n            b = ${?c}\n            d = ${?c} 4\n            e = ${?a}\n            g = ${?c1} ${?c2}\n            h = ${?c1} ${?c2} 1\n            """'}, {}), '(\n    """\n            a = 45\n            b = ${?c}\n            d = ${?c} 4\n            e = ${?a}\n            g = ${?c1} ${?c2}\n            h = ${?c1} ${?c2} 1\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1513, 17, 1518, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1514, 12, 1518, 15): '"""\n              num = 3\n              retries_msg = You have ${num} retries\n              retries_msg = ${?CUSTOM_MSG}\n            """'}, {}), '(\n    """\n              num = 3\n              retries_msg = You have ${num} retries\n              retries_msg = ${?CUSTOM_MSG}\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1534, 17, 1547, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1535, 12, 1546, 15): '"""\n            a =\n            4\n\n            b = # test\n            # test2\n            5\n\n            c =\n\n            6\n            """'}, {}), '(\n    """\n            a =\n            4\n\n            b = # test\n            # test2\n            5\n\n            c =\n\n            6\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1553, 17, 1559, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1554, 12, 1558, 15): '"""\n            short = 12\n            long = 12321321837612378126213217321\n            negative = -15\n            """'}, {}), '(\n    """\n            short = 12\n            long = 12321321837612378126213217321\n            negative = -15\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1569, 17, 1576, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1570, 12, 1575, 15): '"""\n            a = 121.22\n            b = -121.22\n            c = .54\n            d = -.54\n            """'}, {}), '(\n    """\n            a = 121.22\n            b = -121.22\n            c = .54\n            d = -.54\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1589, 17, 1597, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1590, 12, 1596, 15): '"""\n            short = 12.12321\n            long1 = 121.22E3423432\n            neg_long1 = 121.22E-1\n            long2 = 121.22e3423432\n            neg_long2 = 121.22e-3\n            """'}, {}), '(\n    """\n            short = 12.12321\n            long1 = 121.22E3423432\n            neg_long1 = 121.22E-1\n            long2 = 121.22e3423432\n            neg_long2 = 121.22e-3\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1609, 17, 1622, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1610, 12, 1621, 15): '"""\n            a =\n            "a"\n\n            b = # test\n            # test2\n            "b"\n\n            c =\n\n            "c"\n            """'}, {}), '(\n    """\n            a =\n            "a"\n\n            b = # test\n            # test2\n            "b"\n\n            c =\n\n            "c"\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1628, 17, 1649, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1629, 12, 1648, 15): '"""\n            a =\n            [\n            1,\n            2,\n            ]\n\n            b = # test\n            # test2\n            [\n            3,\n            4,]\n\n            c =\n\n            [\n            5,\n            6\n            ]\n            """'}, {}), '(\n    """\n            a =\n            [\n            1,\n            2,\n            ]\n\n            b = # test\n            # test2\n            [\n            3,\n            4,]\n\n            c =\n\n            [\n            5,\n            6\n            ]\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1655, 17, 1676, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1656, 12, 1675, 15): '"""\n            a =\n            [\n            "a",\n            "b",\n            ]\n\n            b = # test\n            # test2\n            [\n            "c",\n            "d",]\n\n            c =\n\n            [\n            "e",\n            "f"\n            ]\n            """'}, {}), '(\n    """\n            a =\n            [\n            "a",\n            "b",\n            ]\n\n            b = # test\n            # test2\n            [\n            "c",\n            "d",]\n\n            c =\n\n            [\n            "e",\n            "f"\n            ]\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1682, 17, 1703, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1683, 12, 1702, 15): '"""\n            a =\n            {\n            a: 1,\n            b: 2,\n            }\n\n            b = # test\n            # test2\n            {\n            c: 3,\n            d: 4,}\n\n            c =\n\n            {\n            e: 5,\n            f: 6\n            }\n            """'}, {}), '(\n    """\n            a =\n            {\n            a: 1,\n            b: 2,\n            }\n\n            b = # test\n            # test2\n            {\n            c: 3,\n            d: 4,}\n\n            c =\n\n            {\n            e: 5,\n            f: 6\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1709, 17, 1730, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1710, 12, 1729, 15): '"""\n            a\n            {\n            a: 1,\n            b: 2,\n            }\n\n            b # test\n            # test2\n            {\n            c: 3,\n            d: 4,}\n\n            c\n\n            {\n            e: 5,\n            f: 6\n            }\n            """'}, {}), '(\n    """\n            a\n            {\n            a: 1,\n            b: 2,\n            }\n\n            b # test\n            # test2\n            {\n            c: 3,\n            d: 4,}\n\n            c\n\n            {\n            e: 5,\n            f: 6\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1736, 18, 1742, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1737, 12, 1741, 15): '"""\n            a = 123\n            a = ${?test}\n            a = 5\n            """'}, {}), '(\n    """\n            a = 123\n            a = ${?test}\n            a = 5\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1746, 18, 1765, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1747, 12, 1764, 15): '"""\n            {\n              database {\n                host = "localhost"\n                port = 8000\n                url = ${database.host}":"${database.port}\n              }\n\n              database {\n                host = ${?DB_HOST}\n              }\n\n              database {\n                host = "other.host.net"\n                port = 433\n              }\n            }\n            """'}, {}), '(\n    """\n            {\n              database {\n                host = "localhost"\n                port = 8000\n                url = ${database.host}":"${database.port}\n              }\n\n              database {\n                host = ${?DB_HOST}\n              }\n\n              database {\n                host = "other.host.net"\n                port = 433\n              }\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1772, 18, 1779, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1773, 12, 1778, 15): '"""\n            a = {\n                b: 1\n                c: 2\n            }\n            """'}, {}), '(\n    """\n            a = {\n                b: 1\n                c: 2\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1781, 18, 1786, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1782, 12, 1785, 15): '"""\n            a.b = 4\n            a.d = 3\n            """'}, {}), '(\n    """\n            a.b = 4\n            a.d = 3\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1796, 18, 1800, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1797, 12, 1799, 15): '"""\n            name: foo\n            """'}, {}), '("""\n            name: foo\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1802, 18, 1807, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', (), '', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1816, 18, 1823, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1817, 12, 1822, 15): '"""\n            {\n                data-center-generic = { cluster-size: 8 }\n                misc = "mist"\n            }\n            """'}, {}), '(\n    """\n            {\n                data-center-generic = { cluster-size: 8 }\n                misc = "mist"\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1836, 18, 1840, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1837, 12, 1839, 15): '"""\n            list = [ 1, 2, 3 ]\n            """'}, {}), '("""\n            list = [ 1, 2, 3 ]\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1841, 18, 1846, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', (), '', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1851, 18, 1855, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1852, 12, 1854, 15): '"""\n            list = [ 1, 2, 3 ]\n            """'}, {}), '("""\n            list = [ 1, 2, 3 ]\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1856, 18, 1861, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', (), '', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1866, 18, 1873, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', (), '', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1874, 18, 1880, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', (), '', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1881, 17, 1881, 59), 'pyhocon.ConfigTree.merge_configs', 'ConfigTree.merge_configs', ({(1881, 42, 1881, 49): 'config1', (1881, 51, 1881, 58): 'config2'}, {}), '(config1, config2)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1882, 8, 1882, 50), 'pyhocon.ConfigParser.resolve_substitutions', 'ConfigParser.resolve_substitutions', ({(1882, 43, 1882, 49): 'merged'}, {}), '(merged)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1886, 18, 1893, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', (), '', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1894, 18, 1900, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', (), '', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1901, 17, 1901, 59), 'pyhocon.ConfigTree.merge_configs', 'ConfigTree.merge_configs', ({(1901, 42, 1901, 49): 'config1', (1901, 51, 1901, 58): 'config2'}, {}), '(config1, config2)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1902, 8, 1902, 50), 'pyhocon.ConfigParser.resolve_substitutions', 'ConfigParser.resolve_substitutions', ({(1902, 43, 1902, 49): 'merged'}, {}), '(merged)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1909, 18, 1915, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', (), '', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1916, 18, 1921, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', (), '', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1922, 17, 1922, 59), 'pyhocon.ConfigTree.merge_configs', 'ConfigTree.merge_configs', ({(1922, 42, 1922, 49): 'config1', (1922, 51, 1922, 58): 'config2'}, {}), '(config1, config2)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1923, 8, 1923, 50), 'pyhocon.ConfigParser.resolve_substitutions', 'ConfigParser.resolve_substitutions', ({(1923, 43, 1923, 49): 'merged'}, {}), '(merged)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1930, 18, 1934, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1931, 12, 1933, 15): '"""\n            dict = { x: 1 }\n            """'}, {}), '("""\n            dict = { x: 1 }\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1935, 18, 1940, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', (), '', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1945, 18, 1949, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1946, 12, 1948, 15): '"""\n            string = abc\n            """'}, {}), '("""\n            string = abc\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1950, 18, 1955, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', (), '', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1965, 15, 1970, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1966, 12, 1969, 15): '"""\n            a = 1\n            mid.b = 1\n            """'}, {}), '(\n    """\n            a = 1\n            mid.b = 1\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1976, 17, 1986, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1977, 12, 1985, 15): '"""\n            A = ${Test}\n\n            Test {\n                field1 = 1\n                field2 = ${Test.field1}"2"\n                field3 = ${Test.field2}"3"\n            }\n            """'}, {}), '(\n    """\n            A = ${Test}\n\n            Test {\n                field1 = 1\n                field2 = ${Test.field1}"2"\n                field3 = ${Test.field2}"3"\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1996, 17, 2001, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1997, 12, 2000, 15): '"""\n            test_no_quotes: abc\\\\n\\\\n\n            test_quotes: "abc\\\\n\\\\n"\n            """'}, {}), '(\n    """\n            test_no_quotes: abc\\\\n\\\\n\n            test_quotes: "abc\\\\n\\\\n"\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2009, 17, 2023, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2010, 12, 2022, 15): '"""\nwith-escaped-backslash: ""\\"\n\\\\\\\\\n""\\"\n\nwith-newline-escape-sequence: ""\\"\n\\\\n\n""\\"\n\nwith-escaped-newline-escape-sequence: ""\\"\n\\\\\\\\n\n""\\"\n            """'}, {}), '(\n    """\nwith-escaped-backslash: ""\\"\n\\\\\\\\\n""\\"\n\nwith-newline-escape-sequence: ""\\"\n\\\\n\n""\\"\n\nwith-escaped-newline-escape-sequence: ""\\"\n\\\\\\\\n\n""\\"\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2030, 17, 2035, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2031, 12, 2035, 15): '"""\n            test = line1 line2\ntest2 = test\n            """'}, {}), '(\n    """\n            test = line1 line2\ntest2 = test\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2049, 17, 2049, 43), 'pyhocon.ConfigFactory.from_dict', 'ConfigFactory.from_dict', ({(2049, 41, 2049, 42): 'd'}, {}), '(d)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2053, 12, 2053, 25), 'collections.OrderedDict', 'OrderedDict', ({}, {}), '()', False, 'from collections import OrderedDict\n'), ((2058, 17, 2058, 43), 'pyhocon.ConfigFactory.from_dict', 'ConfigFactory.from_dict', ({(2058, 41, 2058, 42): 'd'}, {}), '(d)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2062, 12, 2062, 25), 'collections.OrderedDict', 'OrderedDict', ({}, {}), '()', False, 'from collections import OrderedDict\n'), ((2070, 17, 2070, 43), 'pyhocon.ConfigFactory.from_dict', 'ConfigFactory.from_dict', ({(2070, 41, 2070, 42): 'd'}, {}), '(d)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2074, 17, 2089, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2075, 12, 2088, 15): '"""o1 = {\n                foo : {\n                    a : 1\n                    b : 2\n                }\n            }\n            o2 = {\n                foo : {\n                    b : 3\n                    c : 4\n                }\n            }\n            o3 = ${o1} ${o2}\n            """'}, {}), '(\n    """o1 = {\n                foo : {\n                    a : 1\n                    b : 2\n                }\n            }\n            o2 = {\n                foo : {\n                    b : 3\n                    c : 4\n                }\n            }\n            o3 = ${o1} ${o2}\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2099, 17, 2110, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2100, 12, 2109, 15): '"""base : {\n              bar: ["a"]\n            }\n\n            sub : ${base} {\n              baz: ${base.bar} ["b"]\n            }\n\n            sub2: ${sub}\n            """'}, {}), '(\n    """base : {\n              bar: ["a"]\n            }\n\n            sub : ${base} {\n              baz: ${base.bar} ["b"]\n            }\n\n            sub2: ${sub}\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2117, 17, 2123, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', (), '', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2142, 17, 2145, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2143, 12, 2145, 15): '"""\n            a = foo  bar\n            """'}, {}), '("""\n            a = foo  bar\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2152, 17, 2155, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2153, 12, 2155, 15): '"""\n            a = foo  "bar"   dummy\n            """'}, {}), '(\n    """\n            a = foo  "bar"   dummy\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2162, 17, 2169, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2163, 12, 2169, 15): '"""\n            x = 5\n            b = test\n            a = foo  "bar"  ${b} dummy\n            c = foo          ${x}        bv\n            d = foo          ${x}        43\n            """'}, {}), '(\n    """\n            x = 5\n            b = test\n            a = foo  "bar"  ${b} dummy\n            c = foo          ${x}        bv\n            d = foo          ${x}        43\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2180, 17, 2190, 30), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', (), '', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2201, 17, 2208, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2202, 12, 2208, 15): '"""\n            a = // abc\n            abc\n\n            c =\n            5\n            """'}, {}), '(\n    """\n            a = // abc\n            abc\n\n            c =\n            5\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2217, 17, 2220, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2218, 12, 2220, 15): '"""\n            string_from_env = ${STRING_VAR}\n            """'}, {}), '(\n    """\n            string_from_env = ${STRING_VAR}\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2227, 17, 2230, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2228, 12, 2230, 15): '"""\n            STRING_VAR = ${STRING_VAR}\n            """'}, {}), '(\n    """\n            STRING_VAR = ${STRING_VAR}\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2237, 17, 2240, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2238, 12, 2240, 15): '"""\n            STRING_VAR = ${?STRING_VAR}\n            """'}, {}), '(\n    """\n            STRING_VAR = ${?STRING_VAR}\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2247, 17, 2250, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2248, 12, 2250, 15): '"""\n            bool_from_env = ${TRUE_OR_FALSE}\n            """'}, {}), '(\n    """\n            bool_from_env = ${TRUE_OR_FALSE}\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2258, 17, 2261, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2259, 12, 2261, 15): '"""\n            int_from_env = ${INT_VAR}\n            """'}, {}), '(\n    """\n            int_from_env = ${INT_VAR}\n            """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2281, 17, 2281, 57), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2281, 44, 2281, 56): 'input_string'}, {}), '(input_string)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2300, 22, 2303, 54), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2300, 49, 2303, 53): '"""\n        foo: "1"\n        bar: "2"\n        # DO NOT CHANGE ANY OF THE ABOVE SETTINGS!"""'}, {}), '(\n    """\n        foo: "1"\n        bar: "2"\n        # DO NOT CHANGE ANY OF THE ABOVE SETTINGS!"""\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2310, 22, 2310, 73), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2310, 49, 2310, 72): '"""a:[""\\"foo""\\"", "bar"]"""'}, {}), '(\'a:["""foo"""", "bar"]\')', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2316, 22, 2316, 66), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2316, 49, 2316, 65): '"""a:{b: 3, d: 6}"""'}, {}), "('a:{b: 3, d: 6}')", False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2328, 22, 2333, 12), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2328, 49, 2333, 11): '"""\n        foo: ${bar}\n        foo: ${baz}\n        bar:  {r: 1, s: 2}\n        baz:  {s: 3, t: 4}\n        """'}, {}), '(\n    """\n        foo: ${bar}\n        foo: ${baz}\n        bar:  {r: 1, s: 2}\n        baz:  {s: 3, t: 4}\n        """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2337, 17, 2343, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2338, 12, 2343, 15): '"""\n            a: 1\n            b: {\n              pb: 5\n            }\n            """'}, {}), '(\n    """\n            a: 1\n            b: {\n              pb: 5\n            }\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2347, 17, 2351, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2348, 12, 2351, 15): '"""\n            quoted: "abc\\\\"test"\n            unquoted: abc\\\\"test\n            """'}, {}), '(\n    """\n            quoted: "abc\\\\"test"\n            unquoted: abc\\\\"test\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2356, 17, 2360, 9), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2357, 12, 2359, 15): '"""\n            value: "{\\\\"critical\\\\":\\\\"0.00\\\\",\\\\"warning\\\\":\\\\"99.99\\\\"}"\n            """'}, {}), '(\n    """\n            value: "{\\\\"critical\\\\":\\\\"0.00\\\\",\\\\"warning\\\\":\\\\"99.99\\\\"}"\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2365, 17, 2370, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2366, 12, 2370, 15): '"""\n            /abc/cde1: abc\n            "/abc/cde2": "cde"\n            /abc/cde3: "fgh"\n            """'}, {}), '(\n    """\n            /abc/cde1: abc\n            "/abc/cde2": "cde"\n            /abc/cde3: "fgh"\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2376, 17, 2401, 16), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2377, 12, 2401, 15): '"""\n            common : {\n            }\n\n            b1 = []\n\n            var = "wrong"\n\n            compilerCommon : ${common} {\n                VAR : ${var}\n            }\n\n            substrate-suite: {\n                VAR  : "right"\n            }\n            b1 = [\n              ${compilerCommon} ${substrate-suite}\n              ${compilerCommon} ${substrate-suite}\n            ]\n\n            b2 = [\n              ${compilerCommon} ${substrate-suite}\n              ${compilerCommon} ${substrate-suite}\n            ]\n            """'}, {}), '(\n    """\n            common : {\n            }\n\n            b1 = []\n\n            var = "wrong"\n\n            compilerCommon : ${common} {\n                VAR : ${var}\n            }\n\n            substrate-suite: {\n                VAR  : "right"\n            }\n            b1 = [\n              ${compilerCommon} ${substrate-suite}\n              ${compilerCommon} ${substrate-suite}\n            ]\n\n            b2 = [\n              ${compilerCommon} ${substrate-suite}\n              ${compilerCommon} ${substrate-suite}\n            ]\n            """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2433, 17, 2433, 51), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2433, 44, 2433, 50): 'source'}, {}), '(source)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2457, 17, 2457, 56), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(2457, 44, 2457, 55): 'data_set[0]'}, {}), '(data_set[0])', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((65, 13, 65, 46), 'pytest.raises', 'pytest.raises', ({(65, 27, 65, 45): 'ParseBaseException'}, {}), '(ParseBaseException)', False, 'import pytest\n'), ((70, 13, 70, 42), 'pytest.raises', 'pytest.raises', ({(70, 27, 70, 41): 'ParseException'}, {}), '(ParseException)', False, 'import pytest\n'), ((149, 30, 149, 46), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((300, 13, 300, 50), 'pytest.raises', 'pytest.raises', ({(300, 27, 300, 49): 'ConfigMissingException'}, {}), '(ConfigMissingException)', False, 'import pytest\n'), ((376, 13, 376, 52), 'pytest.raises', 'pytest.raises', ({(376, 27, 376, 51): 'ConfigWrongTypeException'}, {}), '(ConfigWrongTypeException)', False, 'import pytest\n'), ((377, 12, 377, 53), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(377, 39, 377, 52): '"""a = [4] "4\\""""'}, {}), '(\'a = [4] "4"\')', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((378, 13, 378, 52), 'pytest.raises', 'pytest.raises', ({(378, 27, 378, 51): 'ConfigWrongTypeException'}, {}), '(ConfigWrongTypeException)', False, 'import pytest\n'), ((379, 12, 379, 53), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(379, 39, 379, 52): '"""a = "4" [5]"""'}, {}), '(\'a = "4" [5]\')', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((380, 13, 380, 52), 'pytest.raises', 'pytest.raises', ({(380, 27, 380, 51): 'ConfigWrongTypeException'}, {}), '(ConfigWrongTypeException)', False, 'import pytest\n'), ((381, 12, 381, 56), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(381, 39, 381, 55): '"""a = {b: 5} "4\\""""'}, {}), '(\'a = {b: 5} "4"\')', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((722, 13, 722, 55), 'pytest.raises', 'pytest.raises', ({(722, 27, 722, 54): 'ConfigSubstitutionException'}, {}), '(ConfigSubstitutionException)', False, 'import pytest\n'), ((723, 12, 727, 13), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(724, 16, 726, 19): '"""\n                    common_modules = ${non_existent}\n                """'}, {}), '(\n    """\n                    common_modules = ${non_existent}\n                """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((729, 13, 729, 55), 'pytest.raises', 'pytest.raises', ({(729, 27, 729, 54): 'ConfigSubstitutionException'}, {}), '(ConfigSubstitutionException)', False, 'import pytest\n'), ((730, 12, 734, 13), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(731, 16, 733, 19): '"""\n                    common_modules = abc ${non_existent}\n                """'}, {}), '(\n    """\n                    common_modules = abc ${non_existent}\n                """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((736, 13, 736, 55), 'pytest.raises', 'pytest.raises', ({(736, 27, 736, 54): 'ConfigSubstitutionException'}, {}), '(ConfigSubstitutionException)', False, 'import pytest\n'), ((737, 12, 741, 13), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(738, 16, 740, 19): '"""\n                    common_modules = ${non_existent} abc\n                """'}, {}), '(\n    """\n                    common_modules = ${non_existent} abc\n                """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((743, 13, 743, 55), 'pytest.raises', 'pytest.raises', ({(743, 27, 743, 54): 'ConfigSubstitutionException'}, {}), '(ConfigSubstitutionException)', False, 'import pytest\n'), ((744, 12, 748, 13), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(745, 16, 747, 19): '"""\n                    common_modules = abc ${non_existent} def\n                """'}, {}), '(\n    """\n                    common_modules = abc ${non_existent} def\n                """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((751, 13, 751, 52), 'pytest.raises', 'pytest.raises', ({(751, 27, 751, 51): 'ConfigWrongTypeException'}, {}), '(ConfigWrongTypeException)', False, 'import pytest\n'), ((752, 12, 757, 13), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(753, 16, 756, 19): '"""\n                    common_modules = [perl]\n                    host_modules = 55 ${common_modules}\n                """'}, {}), '(\n    """\n                    common_modules = [perl]\n                    host_modules = 55 ${common_modules}\n                """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((759, 13, 759, 52), 'pytest.raises', 'pytest.raises', ({(759, 27, 759, 51): 'ConfigWrongTypeException'}, {}), '(ConfigWrongTypeException)', False, 'import pytest\n'), ((760, 12, 765, 13), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(761, 16, 764, 19): '"""\n                    common_modules = [perl]\n                    host_modules = ${common_modules} 55\n                """'}, {}), '(\n    """\n                    common_modules = [perl]\n                    host_modules = ${common_modules} 55\n                """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((767, 13, 767, 52), 'pytest.raises', 'pytest.raises', ({(767, 27, 767, 51): 'ConfigWrongTypeException'}, {}), '(ConfigWrongTypeException)', False, 'import pytest\n'), ((768, 12, 773, 13), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(769, 16, 772, 19): '"""\n                    common_modules = [perl]\n                    host_modules = aa ${common_modules} bb\n                """'}, {}), '(\n    """\n                    common_modules = [perl]\n                    host_modules = aa ${common_modules} bb\n                """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((775, 13, 775, 52), 'pytest.raises', 'pytest.raises', ({(775, 27, 775, 51): 'ConfigWrongTypeException'}, {}), '(ConfigWrongTypeException)', False, 'import pytest\n'), ((776, 12, 781, 13), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(777, 16, 780, 19): '"""\n                    common_modules = [perl]\n                    host_modules = aa ${common_modules}\n                """'}, {}), '(\n    """\n                    common_modules = [perl]\n                    host_modules = aa ${common_modules}\n                """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((783, 13, 783, 52), 'pytest.raises', 'pytest.raises', ({(783, 27, 783, 51): 'ConfigWrongTypeException'}, {}), '(ConfigWrongTypeException)', False, 'import pytest\n'), ((784, 12, 789, 13), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(785, 16, 788, 19): '"""\n                    common_modules = [perl]\n                    host_modules = ${common_modules} aa\n                """'}, {}), '(\n    """\n                    common_modules = [perl]\n                    host_modules = ${common_modules} aa\n                """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((791, 13, 791, 52), 'pytest.raises', 'pytest.raises', ({(791, 27, 791, 51): 'ConfigWrongTypeException'}, {}), '(ConfigWrongTypeException)', False, 'import pytest\n'), ((792, 12, 797, 13), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(793, 16, 796, 19): '"""\n                    common_modules = [perl]\n                    host_modules = aa ${common_modules} bb\n                """'}, {}), '(\n    """\n                    common_modules = [perl]\n                    host_modules = aa ${common_modules} bb\n                """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((916, 13, 916, 55), 'pytest.raises', 'pytest.raises', ({(916, 27, 916, 54): 'ConfigSubstitutionException'}, {}), '(ConfigSubstitutionException)', False, 'import pytest\n'), ((917, 12, 921, 13), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(918, 16, 920, 19): '"""\n                x = ${x}\n                """'}, {}), '("""\n                x = ${x}\n                """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((924, 13, 924, 55), 'pytest.raises', 'pytest.raises', ({(924, 27, 924, 54): 'ConfigSubstitutionException'}, {}), '(ConfigSubstitutionException)', False, 'import pytest\n'), ((925, 12, 930, 13), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(926, 16, 929, 19): '"""\n                x = ${x}\n                x = ${x}\n                """'}, {}), '(\n    """\n                x = ${x}\n                x = ${x}\n                """)', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1008, 13, 1008, 55), 'pytest.raises', 'pytest.raises', ({(1008, 27, 1008, 54): 'ConfigSubstitutionException'}, {}), '(ConfigSubstitutionException)', False, 'import pytest\n'), ((1009, 12, 1014, 13), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1010, 16, 1013, 19): '"""\n                x = ${x} {y: 1}\n                x = ${x.y}\n                """'}, {}), '(\n    """\n                x = ${x} {y: 1}\n                x = ${x.y}\n                """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1169, 13, 1169, 48), 'pytest.raises', 'pytest.raises', ({(1169, 27, 1169, 47): 'ParseSyntaxException'}, {}), '(ParseSyntaxException)', False, 'import pytest\n'), ((1170, 12, 1170, 63), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1170, 39, 1170, 62): '"""common_modules [perl]"""'}, {}), "('common_modules [perl]')", False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1172, 13, 1172, 42), 'pytest.raises', 'pytest.raises', ({(1172, 27, 1172, 41): 'ParseException'}, {}), '(ParseException)', False, 'import pytest\n'), ((1173, 12, 1173, 69), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1173, 39, 1173, 68): '"""common_modules {} {perl: 1}"""'}, {}), "('common_modules {} {perl: 1}')", False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1175, 13, 1175, 48), 'pytest.raises', 'pytest.raises', ({(1175, 27, 1175, 47): 'ParseSyntaxException'}, {}), '(ParseSyntaxException)', False, 'import pytest\n'), ((1176, 12, 1180, 20), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1177, 16, 1180, 19): '"""\n                a = {f: 5}\n                common_modules ${a} {perl: 1}\n                """'}, {}), '(\n    """\n                a = {f: 5}\n                common_modules ${a} {perl: 1}\n                """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1183, 13, 1183, 48), 'pytest.raises', 'pytest.raises', ({(1183, 27, 1183, 47): 'ParseSyntaxException'}, {}), '(ParseSyntaxException)', False, 'import pytest\n'), ((1184, 12, 1190, 20), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1185, 16, 1190, 19): '"""\n                a = {\n                    f: 5\n                    g\n                }\n                """'}, {}), '(\n    """\n                a = {\n                    f: 5\n                    g\n                }\n                """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1192, 13, 1192, 48), 'pytest.raises', 'pytest.raises', ({(1192, 27, 1192, 47): 'ParseSyntaxException'}, {}), '(ParseSyntaxException)', False, 'import pytest\n'), ((1193, 12, 1193, 49), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1193, 39, 1193, 48): '"""a = {g}"""'}, {}), "('a = {g}')", False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1196, 13, 1196, 45), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ({(1196, 41, 1196, 44): '"""w"""'}, {}), "('w')", False, 'import tempfile\n'), ((1269, 13, 1269, 35), 'pytest.raises', 'pytest.raises', ({(1269, 27, 1269, 34): 'IOError'}, {}), '(IOError)', False, 'import pytest\n'), ((1270, 12, 1278, 13), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1271, 16, 1277, 19): '"""\n                a: [\n                    include required("dummy.txt")\n                    3\n                    4\n                ]\n                """'}, {}), '(\n    """\n                a: [\n                    include required("dummy.txt")\n                    3\n                    4\n                ]\n                """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1285, 13, 1285, 38), 'pytest.raises', 'pytest.raises', ({(1285, 27, 1285, 37): 'ValueError'}, {}), '(ValueError)', False, 'import pytest\n'), ((1286, 12, 1286, 73), 'pyhocon.ConfigParser.resolve_package_path', 'ConfigParser.resolve_package_path', ({(1286, 46, 1286, 72): '"""pyhocon/config_parser.py"""'}, {}), "('pyhocon/config_parser.py')", False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1289, 13, 1289, 39), 'pytest.raises', 'pytest.raises', ({(1289, 27, 1289, 38): 'ImportError'}, {}), '(ImportError)', False, 'import pytest\n'), ((1290, 12, 1290, 75), 'pyhocon.ConfigParser.resolve_package_path', 'ConfigParser.resolve_package_path', ({(1290, 46, 1290, 74): '"""non_existent_module:foo.py"""'}, {}), "('non_existent_module:foo.py')", False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1295, 25, 1295, 60), 'os.path.join', 'os.path.join', ({(1295, 38, 1295, 46): 'temp_dir', (1295, 48, 1295, 59): '"""my_module"""'}, {}), "(temp_dir, 'my_module')", False, 'import os\n'), ((1296, 26, 1296, 61), 'os.path.join', 'os.path.join', ({(1296, 39, 1296, 49): 'module_dir', (1296, 51, 1296, 60): '"""my.conf"""'}, {}), "(module_dir, 'my.conf')", False, 'import os\n'), ((1298, 12, 1298, 32), 'os.mkdir', 'os.mkdir', ({(1298, 21, 1298, 31): 'module_dir'}, {}), '(module_dir)', False, 'import os\n'), ((1305, 21, 1311, 13), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1306, 16, 1310, 19): '"""\n                a: 1\n                b: 2\n                include package("my_module:my.conf")\n                """'}, {}), '(\n    """\n                a: 1\n                b: 2\n                include package("my_module:my.conf")\n                """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1315, 12, 1315, 55), 'shutil.rmtree', 'shutil.rmtree', (), '', False, 'import shutil\n'), ((1324, 13, 1324, 45), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ({(1324, 41, 1324, 44): '"""w"""'}, {}), "('w')", False, 'import tempfile\n'), ((1362, 13, 1362, 45), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ({(1362, 41, 1362, 44): '"""w"""'}, {}), "('w')", False, 'import tempfile\n'), ((1377, 13, 1377, 45), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ({(1377, 41, 1377, 44): '"""w"""'}, {}), "('w')", False, 'import tempfile\n'), ((1381, 21, 1388, 13), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1382, 16, 1387, 19): '"""\n                {\n                    a : { include """ + \'"\' + fdin.name + """" }\n                    a : { x : 42 }\n                }\n                """'}, {}), '(\n    """\n                {\n                    a : { include """ + \'"\' +\n    fdin.name +\n    """" }\n                    a : { x : 42 }\n                }\n                """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((1525, 13, 1525, 55), 'pytest.raises', 'pytest.raises', ({(1525, 27, 1525, 54): 'ConfigSubstitutionException'}, {}), '(ConfigSubstitutionException)', False, 'import pytest\n'), ((1526, 12, 1531, 20), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', ({(1527, 16, 1531, 19): '"""\n                a = ${b}\n                b = ${c}\n                c = ${a}\n                """'}, {}), '(\n    """\n                a = ${b}\n                b = ${c}\n                c = ${a}\n                """\n    )', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n'), ((2124, 13, 2124, 43), 'pytest.raises', 'pytest.raises', ({(2124, 27, 2124, 42): 'ConfigException'}, {}), '(ConfigException)', False, 'import pytest\n'), ((2285, 13, 2285, 52), 'pytest.raises', 'pytest.raises', ({(2285, 27, 2285, 51): 'ConfigWrongTypeException'}, {}), '(ConfigWrongTypeException)', False, 'import pytest\n'), ((2287, 13, 2287, 50), 'pytest.raises', 'pytest.raises', ({(2287, 27, 2287, 49): 'ConfigMissingException'}, {}), '(ConfigMissingException)', False, 'import pytest\n'), ((2289, 13, 2289, 43), 'pytest.raises', 'pytest.raises', ({(2289, 27, 2289, 42): 'ConfigException'}, {}), '(ConfigException)', False, 'import pytest\n'), ((2291, 13, 2291, 43), 'pytest.raises', 'pytest.raises', ({(2291, 27, 2291, 42): 'ConfigException'}, {}), '(ConfigException)', False, 'import pytest\n'), ((2293, 13, 2293, 43), 'pytest.raises', 'pytest.raises', ({(2293, 27, 2293, 42): 'ConfigException'}, {}), '(ConfigException)', False, 'import pytest\n'), ((2295, 13, 2295, 52), 'pytest.raises', 'pytest.raises', ({(2295, 27, 2295, 51): 'ConfigWrongTypeException'}, {}), '(ConfigWrongTypeException)', False, 'import pytest\n'), ((2435, 25, 2435, 43), 'json.loads', 'json.loads', ({(2435, 36, 2435, 42): 'source'}, {}), '(source)', False, 'import json\n'), ((93, 25, 93, 42), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((94, 24, 94, 41), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((95, 24, 95, 41), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((96, 19, 96, 36), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((97, 18, 97, 35), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((100, 25, 100, 42), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((101, 24, 101, 41), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((102, 19, 102, 36), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((105, 23, 105, 38), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((106, 22, 106, 37), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((107, 19, 107, 34), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((109, 24, 109, 40), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((110, 23, 110, 39), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((111, 20, 111, 36), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((113, 23, 113, 38), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((114, 22, 114, 37), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((115, 20, 115, 35), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((117, 32, 117, 56), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((118, 31, 118, 55), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((119, 26, 119, 50), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((120, 25, 120, 49), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((121, 22, 121, 46), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((123, 32, 123, 59), 'datetime.timedelta', 'timedelta', (), '', False, 'from datetime import timedelta\n'), ((124, 31, 124, 58), 'datetime.timedelta', 'timedelta', (), '', False, 'from datetime import timedelta\n'), ((125, 26, 125, 53), 'datetime.timedelta', 'timedelta', (), '', False, 'from datetime import timedelta\n'), ((126, 25, 126, 52), 'datetime.timedelta', 'timedelta', (), '', False, 'from datetime import timedelta\n'), ((127, 22, 127, 49), 'datetime.timedelta', 'timedelta', (), '', False, 'from datetime import timedelta\n'), ((129, 31, 129, 53), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((130, 33, 130, 56), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((131, 34, 131, 59), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((132, 29, 132, 54), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((133, 28, 133, 53), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((134, 26, 134, 51), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((159, 39, 159, 55), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((159, 57, 159, 74), 'datetime.timedelta', 'period', (), '', True, 'from datetime import timedelta as period\n'), ((2442, 24, 2442, 47), 'dateutil.relativedelta.relativedelta', 'relativedelta', (), '', False, 'from dateutil.relativedelta import relativedelta\n'), ((2443, 23, 2443, 46), 'dateutil.relativedelta.relativedelta', 'relativedelta', (), '', False, 'from dateutil.relativedelta import relativedelta\n'), ((2444, 23, 2444, 46), 'dateutil.relativedelta.relativedelta', 'relativedelta', (), '', False, 'from dateutil.relativedelta import relativedelta\n'), ((2445, 20, 2445, 43), 'dateutil.relativedelta.relativedelta', 'relativedelta', (), '', False, 'from dateutil.relativedelta import relativedelta\n'), ((2446, 19, 2446, 42), 'dateutil.relativedelta.relativedelta', 'relativedelta', (), '', False, 'from dateutil.relativedelta import relativedelta\n'), ((2449, 23, 2449, 45), 'dateutil.relativedelta.relativedelta', 'relativedelta', (), '', False, 'from dateutil.relativedelta import relativedelta\n'), ((2450, 22, 2450, 44), 'dateutil.relativedelta.relativedelta', 'relativedelta', (), '', False, 'from dateutil.relativedelta import relativedelta\n'), ((2451, 22, 2451, 44), 'dateutil.relativedelta.relativedelta', 'relativedelta', (), '', False, 'from dateutil.relativedelta import relativedelta\n'), ((2452, 19, 2452, 41), 'dateutil.relativedelta.relativedelta', 'relativedelta', (), '', False, 'from dateutil.relativedelta import relativedelta\n'), ((2453, 18, 2453, 40), 'dateutil.relativedelta.relativedelta', 'relativedelta', (), '', False, 'from dateutil.relativedelta import relativedelta\n'), ((1299, 17, 1299, 56), 'os.path.join', 'os.path.join', ({(1299, 30, 1299, 40): 'module_dir', (1299, 42, 1299, 55): '"""__init__.py"""'}, {}), "(module_dir, '__init__.py')", False, 'import os\n'), ((1490, 18, 1490, 69), 'pyhocon.ConfigFactory.parse_string', 'ConfigFactory.parse_string', (), '', False, 'from pyhocon import ConfigFactory, ConfigParser, ConfigSubstitutionException, ConfigTree\n')]