From 7d74aca4dc92382a97e2f94b06c07382cb18edbf Mon Sep 17 00:00:00 2001 From: Tomas Gavenciak Date: Sat, 29 May 2010 11:57:26 -0400 Subject: [PATCH] Fixed minor bug in conf condition eval Fixed mismatch of params of eval(cl, depth) --- t/moe/conf.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/t/moe/conf.py b/t/moe/conf.py index 538f989..9d697af 100644 --- a/t/moe/conf.py +++ b/t/moe/conf.py @@ -103,7 +103,7 @@ class ConfigElem(object): "Caching helper calling self.evaluate(), returns a value or throws an exception." check_depth(depth) if not self.cached: - self.cached_val = self.evaluate(depth+1) + self.cached_val = self.evaluate(depth=depth+1) self.cached = True if self.cached_val == None: raise ConfigError("Unable to evaluate %r."%(self.name,)) @@ -157,15 +157,15 @@ class ConfigCondition(ConfigElem): if self.parent and not self.parent.value(): return False if cl[0] in ['==','!=']: - v = cl[1].evaluate(depth+1) == cl[2].evaluate(depth+1) + v = cl[1].evaluate(depth=depth+1) == cl[2].evaluate(depth=depth+1) if cl[0] == '!=': v = not v return v - v1 = self.evaluate(cl[1], depth+1) + v1 = self.evaluate(cl=cl[1], depth=depth+1) if cl[0] == 'NOT': return not v1 if cl[0] == 'OR' and v1: return True if cl[0] == 'AND' and not v1: return False - return self.evaluate(cl[2], depth+1) + return self.evaluate(cl=cl[2], depth=depth+1) def formula_string(self, formula): "Create a string representation of a formula." if formula[0] == 'AND': @@ -260,7 +260,7 @@ class ConfigVar(ConfigElem): op = self.operations[i] # Check the guarding condition if (not op.condition) or op.condition.value(depth+1): - val.insert(0, op.expression.evaluate(depth+1)) + val.insert(0, op.expression.evaluate(depth=depth+1)) if op.operation == 'SET': return u''.join(val) return None -- 2.39.2