pep8: Fix E127 continuation line over-indented
There are a bunch of these remaining, but I don't think the right course is to 'fix' all of them to make pep8 happy, but instead to either change the test in pep8 to consider that a continuation line may itself be continued halfway, OR, to change the code in these lines to be more readable by removing the need for all those nested continuations. Personally, I find multiply-broken lines (aka nested continuations) really hard to read.
This commit is contained in:
@@ -19,10 +19,10 @@ class SingleSwitchTopo(Topo):
|
|||||||
for h in range(n):
|
for h in range(n):
|
||||||
# Each host gets 50%/n of system CPU
|
# Each host gets 50%/n of system CPU
|
||||||
host = self.addHost('h%s' % (h + 1),
|
host = self.addHost('h%s' % (h + 1),
|
||||||
cpu=.5 / n)
|
cpu=.5 / n)
|
||||||
# 10 Mbps, 5ms delay, 10% loss
|
# 10 Mbps, 5ms delay, 10% loss
|
||||||
self.addLink(host, switch,
|
self.addLink(host, switch,
|
||||||
bw=10, delay='5ms', loss=10, use_htb=True)
|
bw=10, delay='5ms', loss=10, use_htb=True)
|
||||||
|
|
||||||
def perfTest():
|
def perfTest():
|
||||||
"Create network and run simple performance test"
|
"Create network and run simple performance test"
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ def treePing64():
|
|||||||
"Run ping test on 64-node tree networks."
|
"Run ping test on 64-node tree networks."
|
||||||
|
|
||||||
results = {}
|
results = {}
|
||||||
switches = { # 'reference kernel': KernelSwitch,
|
switches = { # 'reference kernel': KernelSwitch,
|
||||||
'reference user': UserSwitch,
|
'reference user': UserSwitch,
|
||||||
'Open vSwitch kernel': OVSKernelSwitch }
|
'Open vSwitch kernel': OVSKernelSwitch }
|
||||||
|
|
||||||
for name in switches:
|
for name in switches:
|
||||||
print "*** Testing", name, "datapath"
|
print "*** Testing", name, "datapath"
|
||||||
|
|||||||
+4
-4
@@ -246,11 +246,11 @@ class TCIntf( Intf ):
|
|||||||
'%s ' % jitter if jitter is not None else '',
|
'%s ' % jitter if jitter is not None else '',
|
||||||
'loss %d ' % loss if loss is not None else '',
|
'loss %d ' % loss if loss is not None else '',
|
||||||
'limit %d' % max_queue_size if max_queue_size is not None
|
'limit %d' % max_queue_size if max_queue_size is not None
|
||||||
else '' )
|
else '' )
|
||||||
if netemargs:
|
if netemargs:
|
||||||
cmds = [ '%s qdisc add dev %s ' + parent +
|
cmds = [ '%s qdisc add dev %s ' + parent +
|
||||||
' handle 10: netem ' +
|
' handle 10: netem ' +
|
||||||
netemargs ]
|
netemargs ]
|
||||||
return cmds
|
return cmds
|
||||||
|
|
||||||
def tc( self, cmd, tc='tc' ):
|
def tc( self, cmd, tc='tc' ):
|
||||||
@@ -290,8 +290,8 @@ class TCIntf( Intf ):
|
|||||||
|
|
||||||
# Delay/jitter/loss/max_queue_size using netem
|
# Delay/jitter/loss/max_queue_size using netem
|
||||||
cmds += self.delayCmds( delay=delay, jitter=jitter, loss=loss,
|
cmds += self.delayCmds( delay=delay, jitter=jitter, loss=loss,
|
||||||
max_queue_size=max_queue_size,
|
max_queue_size=max_queue_size,
|
||||||
parent=parent )
|
parent=parent )
|
||||||
|
|
||||||
# Ugly but functional: display configuration info
|
# Ugly but functional: display configuration info
|
||||||
stuff = ( ( [ '%.2fMbit' % bw ] if bw is not None else [] ) +
|
stuff = ( ( [ '%.2fMbit' % bw ] if bw is not None else [] ) +
|
||||||
|
|||||||
+1
-1
@@ -423,7 +423,7 @@ class Mininet( object ):
|
|||||||
m = re.search( r, pingOutput )
|
m = re.search( r, pingOutput )
|
||||||
if m is None:
|
if m is None:
|
||||||
error( '*** Error: could not parse ping output: %s\n' %
|
error( '*** Error: could not parse ping output: %s\n' %
|
||||||
pingOutput )
|
pingOutput )
|
||||||
return (1, 0)
|
return (1, 0)
|
||||||
sent, received = int( m.group( 1 ) ), int( m.group( 2 ) )
|
sent, received = int( m.group( 1 ) ), int( m.group( 2 ) )
|
||||||
return sent, received
|
return sent, received
|
||||||
|
|||||||
+3
-3
@@ -770,7 +770,7 @@ class Switch( Node ):
|
|||||||
return Node.sendCmd( self, *cmd, **kwargs )
|
return Node.sendCmd( self, *cmd, **kwargs )
|
||||||
else:
|
else:
|
||||||
error( '*** Error: %s has execed and cannot accept commands' %
|
error( '*** Error: %s has execed and cannot accept commands' %
|
||||||
self.name )
|
self.name )
|
||||||
|
|
||||||
def __repr__( self ):
|
def __repr__( self ):
|
||||||
"More informative string representation"
|
"More informative string representation"
|
||||||
@@ -1053,7 +1053,7 @@ class NOX( Controller ):
|
|||||||
Controller.__init__( self, name,
|
Controller.__init__( self, name,
|
||||||
command=noxCoreDir + '/nox_core',
|
command=noxCoreDir + '/nox_core',
|
||||||
cargs='--libdir=/usr/local/lib -v -i ptcp:%s ' +
|
cargs='--libdir=/usr/local/lib -v -i ptcp:%s ' +
|
||||||
' '.join( noxArgs ),
|
' '.join( noxArgs ),
|
||||||
cdir=noxCoreDir,
|
cdir=noxCoreDir,
|
||||||
**kwargs )
|
**kwargs )
|
||||||
|
|
||||||
@@ -1084,4 +1084,4 @@ class RemoteController( Controller ):
|
|||||||
( self.ip, self.port ) )
|
( self.ip, self.port ) )
|
||||||
if 'Unable' in listening:
|
if 'Unable' in listening:
|
||||||
warn( "Unable to contact the remote controller"
|
warn( "Unable to contact the remote controller"
|
||||||
" at %s:%d\n" % ( self.ip, self.port ) )
|
" at %s:%d\n" % ( self.ip, self.port ) )
|
||||||
|
|||||||
+2
-2
@@ -63,7 +63,7 @@ class Topo(object):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def addLink(self, node1, node2, port1=None, port2=None,
|
def addLink(self, node1, node2, port1=None, port2=None,
|
||||||
**opts):
|
**opts):
|
||||||
"""node1, node2: nodes to link together
|
"""node1, node2: nodes to link together
|
||||||
port1, port2: ports (optional)
|
port1, port2: ports (optional)
|
||||||
opts: link options (optional)
|
opts: link options (optional)
|
||||||
@@ -205,7 +205,7 @@ class SingleSwitchReversedTopo(Topo):
|
|||||||
for h in irange(1, k):
|
for h in irange(1, k):
|
||||||
host = self.addHost('h%s' % h)
|
host = self.addHost('h%s' % h)
|
||||||
self.addLink(host, switch,
|
self.addLink(host, switch,
|
||||||
port1=0, port2=(k - h + 1))
|
port1=0, port2=(k - h + 1))
|
||||||
|
|
||||||
class LinearTopo(Topo):
|
class LinearTopo(Topo):
|
||||||
"Linear topology of k switches, with one host per switch."
|
"Linear topology of k switches, with one host per switch."
|
||||||
|
|||||||
Reference in New Issue
Block a user