Access python dicts using path strings (mainly just doing this to l2submodule)
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

18 Zeilen
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")