Add __str__ method to digraph for diagnostic purposes.
authorChris Larson <clarson@kergoth.com>
Tue, 2 Sep 2003 17:55:01 +0000 (17:55 +0000)
committerChris Larson <clarson@kergoth.com>
Tue, 2 Sep 2003 17:55:01 +0000 (17:55 +0000)
bin/oe/__init__.py

index 12fc73e..be24cef 100644 (file)
@@ -1049,7 +1049,13 @@ class digraph:
                self.dict={}
                #okeys = keys, in order they were added (to optimize firstzero() ordering)
                self.okeys=[]
-       
+
+       def __str__(self):
+               str = ""
+               for key in self.okeys:
+                       str += "%s:\t%s\n" % (key, self.dict[key][1])
+               return str
+
        def addnode(self,mykey,myparent):
                if not self.dict.has_key(mykey):
                        self.okeys.append(mykey)