[Neo-report] r1987 vincent - /trunk/neo/pt.py

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Mar 31 15:49:26 CEST 2010


Author: vincent
Date: Wed Mar 31 15:49:17 2010
New Revision: 1987

Log:
Trivial optimisations & cleanups.

Modified:
    trunk/neo/pt.py

Modified: trunk/neo/pt.py
==============================================================================
--- trunk/neo/pt.py [iso-8859-1] (original)
+++ trunk/neo/pt.py [iso-8859-1] Wed Mar 31 15:49:17 2010
@@ -117,11 +117,8 @@
 
     def getNodeList(self):
         """Return all used nodes."""
-        node_list = []
-        for node, count in self.count_dict.iteritems():
-            if count > 0:
-                node_list.append(node)
-        return node_list
+        return [node for node, count in self.count_dict.iteritems() \
+                if count > 0]
 
     def getCellList(self, offset, readable=False, writable=False):
         # allow all cell states
@@ -132,10 +129,9 @@
         if readable:
             # except non writables
             state_set.remove(CellStates.OUT_OF_DATE)
-        allowed_states = tuple(state_set)
         try:
             return [cell for cell in self.partition_list[offset] \
-                    if cell is not None and cell.getState() in allowed_states]
+                    if cell is not None and cell.getState() in state_set]
         except (TypeError, KeyError):
             return []
 





More information about the Neo-report mailing list