fixup: useless_parenthesis

This commit is contained in:
Rémy Léone
2013-12-20 14:43:30 +01:00
parent a6a0cb4331
commit 824afb84c9
3 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ def fixNetworkManager( root, intf ):
cfile = '/etc/network/interfaces' cfile = '/etc/network/interfaces'
line = '\niface %s inet manual\n' % intf line = '\niface %s inet manual\n' % intf
config = open( cfile ).read() config = open( cfile ).read()
if ( line ) not in config: if line not in config:
print '*** Adding', line.strip(), 'to', cfile print '*** Adding', line.strip(), 'to', cfile
with open( cfile, 'a' ) as f: with open( cfile, 'a' ) as f:
f.write( line ) f.write( line )
+3 -3
View File
@@ -355,7 +355,7 @@ class Mininet( object ):
"Build mininet." "Build mininet."
if self.topo: if self.topo:
self.buildFromTopo( self.topo ) self.buildFromTopo( self.topo )
if ( self.inNamespace ): if self.inNamespace:
self.configureControlNetwork() self.configureControlNetwork()
info( '*** Configuring hosts\n' ) info( '*** Configuring hosts\n' )
self.configHosts() self.configHosts()
@@ -463,13 +463,13 @@ class Mininet( object ):
"Parse ping output and return packets sent, received." "Parse ping output and return packets sent, received."
# Check for downed link # Check for downed link
if 'connect: Network is unreachable' in pingOutput: if 'connect: Network is unreachable' in pingOutput:
return (1, 0) return 1, 0
r = r'(\d+) packets transmitted, (\d+) received' r = r'(\d+) packets transmitted, (\d+) received'
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
+1 -1
View File
@@ -168,7 +168,7 @@ class Topo(object):
''' '''
if src in self.ports and dst in self.ports[src]: if src in self.ports and dst in self.ports[src]:
assert dst in self.ports and src in self.ports[dst] assert dst in self.ports and src in self.ports[dst]
return (self.ports[src][dst], self.ports[dst][src]) return self.ports[src][dst], self.ports[dst][src]
def linkInfo( self, src, dst ): def linkInfo( self, src, dst ):
"Return link metadata" "Return link metadata"