git://git.onelab.eu
/
myslice.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
portal: added wip for PI validation page
[myslice.git]
/
manifold
/
util
/
predicate.py
diff --git
a/manifold/util/predicate.py
b/manifold/util/predicate.py
index
aa09379
..
3b5ba80
100644
(file)
--- a/
manifold/util/predicate.py
+++ b/
manifold/util/predicate.py
@@
-112,6
+112,7
@@
class Predicate:
def get_tuple(self):
return (self.key, self.op, self.value)
def get_tuple(self):
return (self.key, self.op, self.value)
+
def get_str_op(self):
op_str = [s for s, op in self.operators.iteritems() if op == self.op]
return op_str[0]
def get_str_op(self):
op_str = [s for s, op in self.operators.iteritems() if op == self.op]
return op_str[0]
@@
-119,6
+120,9
@@
class Predicate:
def get_str_tuple(self):
return (self.key, self.get_str_op(), self.value,)
def get_str_tuple(self):
return (self.key, self.get_str_op(), self.value,)
+ def to_list(self):
+ return list(self.get_str_tuple())
+
def match(self, dic, ignore_missing=False):
if isinstance(self.key, tuple):
print "PREDICATE MATCH", self.key
def match(self, dic, ignore_missing=False):
if isinstance(self.key, tuple):
print "PREDICATE MATCH", self.key
@@
-223,3
+227,9
@@
class Predicate:
return set(self.value)
else:
return set([self.value])
return set(self.value)
else:
return set([self.value])
+
+ def has_empty_value(self):
+ if isinstance(self.value, (list, tuple, set, frozenset)):
+ return not any(self.value)
+ else:
+ return not self.value