From b3cde0ee162b8f0cb67da981311c8f9c16050a62 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Sun, 6 Jun 2010 18:13:21 +0200 Subject: First step of testing the pool - tasks have been separated into a new module including own tests, their design improved to prepare them for some specifics that would be needed for multiprocessing support --- lib/git/async/graph.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'lib/git/async/graph.py') diff --git a/lib/git/async/graph.py b/lib/git/async/graph.py index b4d6aa00..d817eeb4 100644 --- a/lib/git/async/graph.py +++ b/lib/git/async/graph.py @@ -1,14 +1,20 @@ """Simplistic implementation of a graph""" class Node(object): - """A quick and dirty to the point implementation of a simple, and slow ascyclic graph. - Its not designed to support big graphs, and sports only the functionality - we need""" - __slots__ = ('in_nodes', 'out_nodes') + """A Node in the graph. They know their neighbours, and have an id which should + resolve into a string""" + __slots__ = ('in_nodes', 'out_nodes', 'id') - def __init__(self): + def __init__(self, id=None): + self.id = id self.in_nodes = list() self.out_nodes = list() + + def __str__(self): + return str(self.id) + + def __repr__(self): + return "%s(%s)" % (type(self).__name__, self.id) class Graph(object): -- cgit v1.2.1