Fix some pylint messages.

This commit is contained in:
Bob Lantz
2013-06-25 20:26:06 -07:00
parent 538a856c2f
commit 33e39a2471
5 changed files with 13 additions and 17 deletions
+1 -3
View File
@@ -10,10 +10,9 @@ Glen Gibb, February 2011
""" """
from mininet.cli import CLI from mininet.cli import CLI
from mininet.log import lg, info from mininet.log import lg
from mininet.node import Node from mininet.node import Node
from mininet.topolib import TreeNet from mininet.topolib import TreeNet
from mininet.util import quietRun
################################# #################################
def startNAT( root, inetIntf='eth0', subnet='10.0/8' ): def startNAT( root, inetIntf='eth0', subnet='10.0/8' ):
@@ -75,7 +74,6 @@ def connectToInternet( network, switch='s1', rootip='10.254', subnet='10.0/8'):
subnet: Mininet subnet""" subnet: Mininet subnet"""
switch = network.get( switch ) switch = network.get( switch )
prefixLen = subnet.split( '/' )[ 1 ] prefixLen = subnet.split( '/' )[ 1 ]
routes = [ subnet ] # host networks to route to
# Create a node in root namespace # Create a node in root namespace
root = Node( 'root', inNamespace=False ) root = Node( 'root', inNamespace=False )
+1 -1
View File
@@ -55,7 +55,7 @@ def cleanup():
sh( 'ovs-vsctl del-br ' + dp ) sh( 'ovs-vsctl del-br ' + dp )
info( "*** Removing all links of the pattern foo-ethX\n" ) info( "*** Removing all links of the pattern foo-ethX\n" )
links = sh( "ip link show | egrep -o '(\w+-eth\w+)'" ).split( '\n' ) links = sh( r"ip link show | egrep -o '(\w+-eth\w+)'" ).split( '\n' )
for link in links: for link in links:
if link != '': if link != '':
sh( "ip link del " + link ) sh( "ip link del " + link )
+8 -10
View File
@@ -60,18 +60,16 @@ class Singleton( type ):
See http://en.wikipedia.org/wiki/SingletonPattern#Python See http://en.wikipedia.org/wiki/SingletonPattern#Python
Intended to be used as a __metaclass_ param, as shown for the class Intended to be used as a __metaclass_ param, as shown for the class
below. below."""
Changed cls first args to mcs to satisfy pylint.""" def __init__( cls, name, bases, dict_ ):
super( Singleton, cls ).__init__( name, bases, dict_ )
cls.instance = None
def __init__( mcs, name, bases, dict_ ): def __call__( cls, *args, **kw ):
super( Singleton, mcs ).__init__( name, bases, dict_ ) if cls.instance is None:
mcs.instance = None cls.instance = super( Singleton, cls ).__call__( *args, **kw )
return cls.instance
def __call__( mcs, *args, **kw ):
if mcs.instance is None:
mcs.instance = super( Singleton, mcs ).__call__( *args, **kw )
return mcs.instance
class MininetLogger( Logger, object ): class MininetLogger( Logger, object ):
+2 -2
View File
@@ -759,7 +759,7 @@ class Switch( Node ):
def defaultDpid( self ): def defaultDpid( self ):
"Derive dpid from switch name, s1 -> 1" "Derive dpid from switch name, s1 -> 1"
try: try:
dpid = int( re.findall( '\d+', self.name )[ 0 ] ) dpid = int( re.findall( r'\d+', self.name )[ 0 ] )
dpid = hex( dpid )[ 2: ] dpid = hex( dpid )[ 2: ]
dpid = '0' * ( self.dpidLen - len( dpid ) ) + dpid dpid = '0' * ( self.dpidLen - len( dpid ) ) + dpid
return dpid return dpid
@@ -787,7 +787,7 @@ class Switch( Node ):
def connected( self ): def connected( self ):
"Is the switch connected to a controller? (override this method)" "Is the switch connected to a controller? (override this method)"
return False return False and self # satisfy pylint
def __repr__( self ): def __repr__( self ):
"More informative string representation" "More informative string representation"
+1 -1
View File
@@ -54,7 +54,7 @@ def makeTerm( node, title='Node', term='xterm', display=None ):
def runX11( node, cmd ): def runX11( node, cmd ):
"Run an X11 client on a node" "Run an X11 client on a node"
display, tunnel = tunnelX11( node ) _display, tunnel = tunnelX11( node )
popen = node.popen( cmd ) popen = node.popen( cmd )
return [ tunnel, popen ] return [ tunnel, popen ]