Access python dicts using path strings (mainly just doing this to l2submodule)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
446B

  1. #!/usr/bin/env python3
  2. import confthing, yaml
  3. conf = confthing.Config(yaml.safe_load(open("config-test.yaml")), defaults = {
  4. "alpha/aleph/llll": 1337
  5. }, requirements = [
  6. "alpha/bet"
  7. ], clobber_subscript = True)
  8. test = lambda n: print("\"%s\"\n\t%s\n" % (n, conf[n]))
  9. test("")
  10. test("alpha/aleph")
  11. conf["alpha/aleph"] = {"i": "now set to a string"}
  12. test("alpha/aleph/i")
  13. conf["alpha/aleph/i/one/two/three"] = 12345
  14. test("alpha/aleph/i")