diff options
author | Casey Dahlin <cdahlin@redhat.com> | 2008-12-29 03:57:13 -0500 |
---|---|---|
committer | Casey Dahlin <cdahlin@redhat.com> | 2008-12-29 04:08:57 -0500 |
commit | c9bc71a609f5f0a07167c52679c4951443031851 (patch) | |
tree | 5df8c44da17e1b495083ea65408d449010450e2c | |
parent | 3eb56b98ef3063d913398bea7d8776f880998391 (diff) | |
download | upstate-c9bc71a609f5f0a07167c52679c4951443031851.tar.gz upstate-c9bc71a609f5f0a07167c52679c4951443031851.tar.xz upstate-c9bc71a609f5f0a07167c52679c4951443031851.zip |
Change Category#equiv to Category#superset_of
-rw-r--r-- | category.py | 9 | ||||
-rw-r--r-- | statemachine.py | 4 |
2 files changed, 5 insertions, 8 deletions
diff --git a/category.py b/category.py index c718002..81f26c8 100644 --- a/category.py +++ b/category.py @@ -21,17 +21,14 @@ class Category: self.args = args self.name = name - def equiv(self, other): + def superset_of(self, other): """ - A Category is equivalent to another Category if: - - The other category mandates the same or more arguments - - The intersection of the two is nonempty - Its an odd relationship, brought about to match expected user behavior + Determine if this category is a superset of `other`. """ if self.name != other.name: return False for key, value in self.args.iteritems(): if not other.args.has_key(key): return False - if not other.args[key].intersect(value).nonempty(): return False + if not other.args[key].intersect(value) == other.args[key]: return False return True def subtract(self, other): diff --git a/statemachine.py b/statemachine.py index b8657fa..57d6af5 100644 --- a/statemachine.py +++ b/statemachine.py @@ -89,7 +89,7 @@ class StateMachine: """ retval = [] for cat in self.up: - if dependencies.equiv(cat): + if dependencies.superset_of(cat) and val > 0: retval.append(dependents.fill(cat.args)) return set(retval) | dependents.inverse_set() @@ -99,7 +99,7 @@ class StateMachine: """ retval = [] for (x, y) in self.deps: - if x.equiv(cat): + if x.superset_of(cat): un = cat.intersect(x) retval.append((un, y.fill(un.args))) return retval |