From 2485d57f662df251fb1c8c940a2faccc2ad637d5 Mon Sep 17 00:00:00 2001
From: Bob Lantz <rlantz@cs.stanford.edu>
Date: Wed, 22 May 2013 15:40:12 -0700
Subject: [PATCH] Edits to pass code check and make style consistent.

---
 mininet/link.py |  4 ++--
 mininet/topo.py | 31 ++++++++++++++++++-------------
 2 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/mininet/link.py b/mininet/link.py
index 2f90d4e7..24028aca 100644
--- a/mininet/link.py
+++ b/mininet/link.py
@@ -290,8 +290,8 @@ def config( self, bw=None, delay=None, jitter=None, loss=None,
         cmds += bwcmds
 
         # Delay/jitter/loss/max_queue_size using netem
-        delaycmds, parent = self.delayCmds( delay=delay, jitter=jitter, loss=loss,
-                                max_queue_size=max_queue_size,
+        delaycmds, parent = self.delayCmds( delay=delay, jitter=jitter,
+                                loss=loss, max_queue_size=max_queue_size,
                                 parent=parent )
         cmds += delaycmds
 
diff --git a/mininet/topo.py b/mininet/topo.py
index 3ff0e8ef..cae1c04a 100644
--- a/mininet/topo.py
+++ b/mininet/topo.py
@@ -13,28 +13,33 @@
 
 from mininet.util import irange, natural, naturalSeq
 
-class Graph(object):
-    "Utility class to track nodes and edges "
+class Graph( object ):
+    "Utility class to track nodes and edges - replaces networkx.Graph"
 
-    def __init__(self):
+    def __init__( self ):
         self.data = {}
 
-    def add_node(self,node):
+    def add_node( self, node ):
+        "Add node to graph"
         if node not in self.data.keys():
-            self.data[node] = []
+            self.data[ node ] = []
 
-    def add_edge(self,src,dest):
-        self.add_node(src)
-        self.add_node(dest)
-        self.data[src].append(dest)
+    def add_edge( self, src, dest ):
+        "Add edge to graph"
+        self.add_node( src )
+        self.add_node( dest )
+        self.data[ src ].append( dest )
 
-    def nodes(self):
+    def nodes( self ):
+        "Return list of graph nodes"
         return self.data.keys()
 
-    def edges(self):
+    def edges( self ):
+        "Iterator: return graph edges"
         for src in self.data.keys():
-            for dest in self.data[src]:
-                yield (src,dest)
+            for dest in self.data[ src ]:
+                yield ( src, dest )
+
 
 class Topo(object):
     "Data center network representation for structured multi-trees."
-- 
GitLab