Skip to content
Snippets Groups Projects
Commit 33e39a24 authored by Bob Lantz's avatar Bob Lantz
Browse files

Fix some pylint messages.

parent 538a856c
No related branches found
No related tags found
No related merge requests found
...@@ -10,10 +10,9 @@ ...@@ -10,10 +10,9 @@
""" """
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'): ...@@ -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 )
......
...@@ -55,7 +55,7 @@ def cleanup(): ...@@ -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 )
......
...@@ -60,18 +60,16 @@ class Singleton( type ): ...@@ -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 ):
......
...@@ -759,7 +759,7 @@ def __init__( self, name, dpid=None, opts='', listenPort=None, **params): ...@@ -759,7 +759,7 @@ def __init__( self, name, dpid=None, opts='', listenPort=None, **params):
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 @@ def sendCmd( self, *cmd, **kwargs ): ...@@ -787,7 +787,7 @@ def sendCmd( self, *cmd, **kwargs ):
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"
......
...@@ -54,7 +54,7 @@ def makeTerm( node, title='Node', term='xterm', display=None ): ...@@ -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 ]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment