summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/topological.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2007-11-24 01:59:29 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2007-11-24 01:59:29 +0000
commit6f604f911640d92f705fc6611bfaa3e2600c4ee1 (patch)
treecc2cfb4bc7a3ddf8451ec6d8d2480218b8e0bc4c /lib/sqlalchemy/topological.py
parent3f93103a5ef9128b7b300c51d41dea43dd843834 (diff)
downloadsqlalchemy-6f604f911640d92f705fc6611bfaa3e2600c4ee1.tar.gz
- decruftify old visitors used by orm, convert to functions that
use a common traversal function. - TranslatingDict is finally gone, thanks to column.proxy_set simpleness...hooray ! - shoved "slice" use case on RowProxy into an exception case. knocks noticeable time off of large result set operations.
Diffstat (limited to 'lib/sqlalchemy/topological.py')
-rw-r--r--lib/sqlalchemy/topological.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/sqlalchemy/topological.py b/lib/sqlalchemy/topological.py
index a47968519..ccded5d47 100644
--- a/lib/sqlalchemy/topological.py
+++ b/lib/sqlalchemy/topological.py
@@ -143,7 +143,7 @@ class QueueDependencySorter(object):
self.tuples = tuples
self.allitems = allitems
- def sort(self, allow_self_cycles=True, allow_all_cycles=False):
+ def sort(self, allow_self_cycles=True, allow_all_cycles=False, create_tree=True):
(tuples, allitems) = (self.tuples, self.allitems)
#print "\n---------------------------------\n"
#print repr([t for t in tuples])
@@ -152,7 +152,7 @@ class QueueDependencySorter(object):
nodes = {}
edges = _EdgeCollection()
- for item in allitems + [t[0] for t in tuples] + [t[1] for t in tuples]:
+ for item in list(allitems) + [t[0] for t in tuples] + [t[1] for t in tuples]:
if id(item) not in nodes:
node = _Node(item)
nodes[id(item)] = node
@@ -205,7 +205,10 @@ class QueueDependencySorter(object):
del nodes[id(node.item)]
for childnode in edges.pop_node(node):
queue.append(childnode)
- return self._create_batched_tree(output)
+ if create_tree:
+ return self._create_batched_tree(output)
+ else:
+ return [n.item for n in output]
def _create_batched_tree(self, nodes):