summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
878693c)
ConfigExpression.variables returns set instead of a list
- multiple occurences of one variable broke removing
operation from variable
Adapted and simplified ConfigVar.variables
def variables(self):
"Return a set of variables used in the expressions"
def variables(self):
"Return a set of variables used in the expressions"
- return set(sum([ list(op.expression.variables()) for op in self.operations ], []))
+ return set.union(*[ op.expression.variables() for op in self.operations ])
self.invalidate()
# Remove the operation
self.operations.remove(operation)
self.invalidate()
# Remove the operation
self.operations.remove(operation)
- # Remove dependencies on variables unused in other operations
+ # Remove dependencies on variables unused in other defining operations
vs = self.variables()
for v in operation.expression.variables():
if v not in vs:
vs = self.variables()
for v in operation.expression.variables():
if v not in vs:
self.exprlist[i] = unicode(e, 'ascii')
def variables(self):
self.exprlist[i] = unicode(e, 'ascii')
def variables(self):
- "Return an iterator of variables user in the expression"
- return itertools.ifilter(lambda e: isinstance(e, ConfigVar), self.exprlist)
+ "Return a set of variables used in the expression"
+ return set([e for e in self.exprlist if isinstance(e, ConfigVar)])
def __str__(self):
return self.original
def __str__(self):
return self.original