diff options
author | Casey Dahlin <cdahlin@redhat.com> | 2008-12-23 00:32:08 -0500 |
---|---|---|
committer | Casey Dahlin <cdahlin@redhat.com> | 2008-12-23 00:32:08 -0500 |
commit | f5b2fc6b601036b529e5c18d860e92c5ba467277 (patch) | |
tree | 07ac1d46c772b1b175592d03345e136000092466 /statemachine.py | |
parent | c331b82b6256ba132b6d34935892d05697a68317 (diff) | |
download | upstate-f5b2fc6b601036b529e5c18d860e92c5ba467277.tar.gz upstate-f5b2fc6b601036b529e5c18d860e92c5ba467277.tar.xz upstate-f5b2fc6b601036b529e5c18d860e92c5ba467277.zip |
Split giant assert_state into two methods
Diffstat (limited to 'statemachine.py')
-rw-r--r-- | statemachine.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/statemachine.py b/statemachine.py index 9c943e1..5cdbadf 100644 --- a/statemachine.py +++ b/statemachine.py @@ -33,6 +33,17 @@ class StateMachine: if found == None: self.add_hold(cat) return True + to_add = self.cat_cross(found) + for x in to_add: + self.add_hold(x) + return True + + def cat_cross(self, found): + """ + Given a list of sets, where each set contains Category objects, return a + set of all categories that can be made by intersecting one element from + each set. + """ to_add = set() for tup in setcross.cross(*found): orig = tup @@ -45,9 +56,7 @@ class StateMachine: if len(tup) == 0 or tup[0] == None: continue to_add.add(tup[0]) - for x in to_add: - self.add_hold(x) - return True + return to_add def intersect_list(self, cats1, cats2): """ |