Merge "Fix pep8 violations in csit/libraries/Common.py"
authorDaniel Farrell <dfarrell@redhat.com>
Mon, 16 Mar 2015 20:02:20 +0000 (20:02 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 16 Mar 2015 20:02:20 +0000 (20:02 +0000)
test/csit/libraries/Common.py

index e748caad89757c47190aa5c8d99794752da9bef1..424320c5bad4ec0055941224e22189a9f70b2dae 100644 (file)
@@ -4,12 +4,12 @@ Authors: Baohua Yang@IBM, Denghui Huang@IBM
 Updated: 2013-11-14
 """
 import collections
-import xml.etree.ElementTree as ET
 
 '''
 Common constants and functions for the robot framework.
 '''
 
+
 def collection_should_contain(collection, *members):
     """
     Fail if not every members is in the collection.
@@ -22,6 +22,7 @@ def collection_should_contain(collection, *members):
     else:
         return True
 
+
 def combine_strings(*strings):
     """
     Combines the given `strings` together and returns the result.
@@ -29,20 +30,20 @@ def combine_strings(*strings):
     """
     result = ''
     for s in strings:
-        if isinstance(s,str) or isinstance(s,unicode):
+        if isinstance(s, str) or isinstance(s, unicode):
             result += s
     if result == '':
         return None
     else:
         return result
 
-        
+
 def compare_xml(xml1, xml2):
     """
     compare the two XML files to see if they contain the same data
     but could be if different order.
     It just split the xml in to lines and just check the line is in
-    the other file 
+    the other file
     """
     for line in xml1.rstrip().split('\n'):
         if line not in xml2.rstrip().split('\n'):
@@ -54,14 +55,16 @@ def compare_xml(xml1, xml2):
 
     return True
 
+
 def num_of_nodes(depth, fanout):
-    '''returns num of switches of a mininet with tree topology 
+    '''returns num of switches of a mininet with tree topology
     with particular depth and fanout parameters
     '''
     result = 0
     for i in xrange(depth):
         result += fanout**i
-    return result    
+    return result
+
 
 def num_of_links_for_node(nodeid, leaflist, fanout):
     '''
@@ -69,7 +72,7 @@ def num_of_links_for_node(nodeid, leaflist, fanout):
     and nodeid will be represented 2 times in topology
     If the given node is not a leaf node, then there will be fanout+1 links
     for it and nodeid will be represented (fanout+1)*2 times in topology
-    
+
     p.s. root node is excluded.
     '''
     if nodeid in leaflist:
@@ -77,5 +80,4 @@ def num_of_links_for_node(nodeid, leaflist, fanout):
     return (fanout+1)
 
 if __name__ == '__main__':
-       print num_of_nodes(3,4)
-       pass
+    print(num_of_nodes(3, 4))