Access python dicts using path strings (mainly just doing this to l2submodule)
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

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