Commit 2da93c80 authored by Vincent Pelletier's avatar Vincent Pelletier

Trivial optimisations & cleanups.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1987 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 7bb627e8
......@@ -117,11 +117,8 @@ class PartitionTable(object):
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 @@ class PartitionTable(object):
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 []
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment