Make some tuples explicit to pass parsing in py3

This commit is contained in:
Brad Walker
2016-04-14 21:40:08 -04:00
committed by Bob Lantz
parent 70fcc45893
commit fb1f0dca2a
4 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -32,8 +32,8 @@ def multiControllerNet():
s2 = net.addSwitch( 's2' )
print( "*** Creating hosts" )
hosts1 = [ net.addHost( 'h%d' % n ) for n in 3, 4 ]
hosts2 = [ net.addHost( 'h%d' % n ) for n in 5, 6 ]
hosts1 = [ net.addHost( 'h%d' % n ) for n in ( 3, 4 ) ]
hosts2 = [ net.addHost( 'h%d' % n ) for n in ( 5, 6 ) ]
print( "*** Creating links" )
for h in hosts1:
+1 -1
View File
@@ -57,7 +57,7 @@ class NetworkTopo( Topo ):
defaultIP = '192.168.1.1/24' # IP address for r0-eth1
router = self.addNode( 'r0', cls=LinuxRouter, ip=defaultIP )
s1, s2, s3 = [ self.addSwitch( s ) for s in 's1', 's2', 's3' ]
s1, s2, s3 = [ self.addSwitch( s ) for s in ( 's1', 's2', 's3' ) ]
self.addLink( s1, router, intfName2='r0-eth1',
params2={ 'ip' : defaultIP } ) # for clarity
+1 -1
View File
@@ -52,7 +52,7 @@ def scratchNetUser( cname='controller', cargs='ptcp:' ):
info( '*** Starting controller and user datapath\n' )
controller.cmd( cname + ' ' + cargs + '&' )
switch.cmd( 'ifconfig lo 127.0.0.1' )
intfs = [ str( i ) for i in sintf1, sintf2 ]
intfs = str( sintf1 ), str( sintf2 )
switch.cmd( 'ofdatapath -i ' + ','.join( intfs ) + ' ptcp: &' )
switch.cmd( 'ofprotocol tcp:' + controller.IP() + ' tcp:localhost &' )
+5 -5
View File
@@ -160,7 +160,7 @@ def makeListCompatible( fn ):
"Generated function. Closure-ish."
if len( args ) == 1:
return fn( *args )
args = ' '.join( [ str( arg ) for arg in args ] )
args = ' '.join( map( str, args ) )
return fn( args )
# Fix newfn's name and docstring
@@ -168,9 +168,9 @@ def makeListCompatible( fn ):
setattr( newfn, '__doc__', fn.__doc__ )
return newfn
info, output, warn, error, debug = (
lg.info, lg.output, lg.warn, lg.error, lg.debug ) = [
makeListCompatible( f ) for f in
lg.info, lg.output, lg.warn, lg.error, lg.debug ]
_loggers = lg.info, lg.output, lg.warn, lg.error, lg.debug
_loggers = tuple( map( makeListCompatible, _loggers ) )
lg.info, lg.output, lg.warn, lg.error, lg.debug = _loggers
info, output, warn, error, debug = _loggers
setLogLevel = lg.setLogLevel