@@ -209,16 +209,19 @@ def addSwitch( self, name, cls=None, **params ):
209209 def addController ( self , name = 'c0' , controller = None , ** params ):
210210 """Add controller.
211211 controller: Controller class"""
212- #Get controller class
212+ # Get controller class
213213 if not controller :
214214 controller = self .controller
215- #Construct new controller if one is not given
215+ # Construct new controller if one is not given
216216 if isinstance (name , Controller ):
217217 controller_new = name
218+ # Pylint thinks controller is a str()
219+ # pylint: disable=E1103
218220 name = controller_new .name
221+ # pylint: enable=E1103
219222 else :
220223 controller_new = controller ( name , ** params )
221- #Add new controller to net
224+ # Add new controller to net
222225 if controller_new : # allow controller-less setups
223226 self .controllers .append ( controller_new )
224227 self .nameToNode [ name ] = controller_new
@@ -249,7 +252,8 @@ def __iter__( self ):
249252
250253 def __len__ ( self ):
251254 "returns number of nodes in net"
252- return len ( self .hosts ) + len ( self .switches ) + len ( self .controllers )
255+ return ( len ( self .hosts ) + len ( self .switches ) +
256+ len ( self .controllers ) )
253257
254258 def __contains__ ( self , item ):
255259 "returns True if net contains named node"
0 commit comments