Access python dicts using path strings (mainly just doing this to l2submodule)
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

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