X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=t%2Fmoe%2Fconfig.py;h=dacaf42a7a1450e45fa505c266cb7fecc1b01e1d;hb=b5ef6bb91d88949931339721484770bfecc109f4;hp=d17d1c8af7e7ccf75d236f3f120ac169230ffd3f;hpb=c904e59d4b936357c9a85dabe66a5cdb9a6491a5;p=moe.git diff --git a/t/moe/config.py b/t/moe/config.py index d17d1c8..dacaf42 100644 --- a/t/moe/config.py +++ b/t/moe/config.py @@ -94,14 +94,17 @@ class ConfigTree(object): self.variables[k].dump(prefix) for k in sorted(self.variables.keys()) ]) - def fix(self, key): - "Fix variable value. Fixing undefined variable raises `UndefinedError`." - self.lookup(key, create=True).fix() + def fix(self, keys): + "Fix value of variable or list of variables. Fixing undefined variable raises `UndefinedError`." + if isinstance(keys, types.StringTypes): + keys = [keys] + for key in keys: + self.lookup(key, create=True).fix() def parse(self, s, source=None, level=0): """Parse `s` (stream/string) into the tree, see `moe.confparser.ConfigParser` for details.""" - import moe.confparser - p = moe.confparser.ConfigParser(text, self, source=source, level=level) + import moe.config_parser + p = moe.config_parser.ConfigParser(s, self, source=source, level=level) p.parse() def parse_file(self, filename, desc=None, level=0): @@ -285,7 +288,7 @@ class ConfigVar(ConfigElem): "Handle the case when fixed, raise exc. on different evaluation" val = super(ConfigVar,self).value(depth) if self.fixed and self.fixed_val != val: - raise VariableFixedError("value of var %s was fixed to %r but evaluated to %r", self.name, self.fixed_val, val) + raise VariableFixedError("value of var %r was fixed to %r but evaluated to %r", self.name, self.fixed_val, val) return val def add_operation(self, operation):