Revision b1ec912d mininet/topo.py

View differences:

mininet/topo.py
111 111
        self.hopts = params.pop( 'hopts', {} )
112 112
        self.sopts = params.pop( 'sopts', {} )
113 113
        self.lopts = params.pop( 'lopts', {} )
114
        self.ports = {}  # ports[src][dst][sport] is port on dst that connects to src
114
        # ports[src][dst][sport] is port on dst that connects to src
115
        self.ports = {}
115 116
        self.build( *args, **params )
116 117

  
117 118
    def build( self, *args, **params ):
......
187 188
           withKeys: return link keys
188 189
           withInfo: return link info
189 190
           returns: list of ( src, dst [,key, info ] )"""
190
        for src, dst, key, info in self.g.edges_iter( data=True, keys=True ):
191
        for _src, _dst, key, info in self.g.edges_iter( data=True, keys=True ):
191 192
            node1, node2 = info[ 'node1' ], info[ 'node2' ]
192 193
            if withKeys:
193 194
                if withInfo:
......
207 208
           withInfo: return link info
208 209
           returns: list of ( src, dst [,key, info ] )"""
209 210
        links = list( self.iterLinks( withKeys, withInfo ) )
210
        if not sorted:
211
        if not sort:
211 212
            return links
212 213
        # Ignore info when sorting
213 214
        tupleSize = 3 if withKeys else 2
......
287 288
        return sorted( items, key=natural )
288 289

  
289 290

  
291
# Our idiom defines additional parameters in build(param...)
292
# pylint: disable=arguments-differ, attribute-defined-outside-init
293

  
290 294
class SingleSwitchTopo( Topo ):
291 295
    "Single switch connected to k hosts."
292 296

  
293
    def build( self, k=2, **opts ):
297
    def build( self, k=2, **_opts ):
294 298
        "k: number of hosts"
295 299
        self.k = k
296 300
        switch = self.addSwitch( 's1' )
......
317 321
class LinearTopo( Topo ):
318 322
    "Linear topology of k switches, with n hosts per switch."
319 323

  
320
    def build( self, k=2, n=1, **opts):
324
    def build( self, k=2, n=1, **_opts):
321 325
        """k: number of switches
322 326
           n: number of hosts per switch"""
323 327
        self.k = k
......
340 344
            if lastSwitch:
341 345
                self.addLink( switch, lastSwitch )
342 346
            lastSwitch = switch
347

  
348
# pylint: enable=arguments-differ, attribute-defined-outside-init

Also available in: Unified diff