Revision c273f490

View differences:

mininet/link.py
160 160
        f = getattr( self, method, None )
161 161
        if not f or value is None:
162 162
            return
163
        if type( value ) is list:
163
        if isinstance( value, list ):
164 164
            result = f( *value )
165
        elif type( value ) is dict:
165
        elif isinstance( value, dict ):
166 166
            result = f( **value )
167 167
        else:
168 168
            result = f( value )
mininet/node.py
258 258
        assert not self.waiting
259 259
        printPid = kwargs.get( 'printPid', True )
260 260
        # Allow sendCmd( [ list ] )
261
        if len( args ) == 1 and type( args[ 0 ] ) is list:
261
        if len( args ) == 1 and isinstance( args[ 0 ], list ):
262 262
            cmd = args[ 0 ]
263 263
        # Allow sendCmd( cmd, arg1, arg2... )
264 264
        elif len( args ) > 0:
......
352 352
                     [ 'mnexec', '-da', str( self.pid ) ] }
353 353
        defaults.update( kwargs )
354 354
        if len( args ) == 1:
355
            if type( args[ 0 ] ) is list:
355
            if isinstance( args[ 0 ], list ):
356 356
                # popen([cmd, arg1, arg2...])
357 357
                cmd = args[ 0 ]
358 358
            elif isinstance( args[ 0 ], basestring ):
......
539 539
        f = getattr( self, method, None )
540 540
        if not f:
541 541
            return
542
        if type( value ) is list:
542
        if isinstance( value, list ):
543 543
            result = f( *value )
544
        elif type( value ) is dict:
544
        elif isinstance( valude, dict ):
545 545
            result = f( **value )
546 546
        else:
547 547
            result = f( value )
......
774 774
        "Specify (real) cores that our cgroup can run on"
775 775
        if not cores:
776 776
            return
777
        if type( cores ) is list:
777
        if isinstance( cores, list ):
778 778
            cores = ','.join( [ str( c ) for c in cores ] )
779 779
        self.cgroupSet( resource='cpuset', param='cpus',
780 780
                        value=cores )
......
937 937
           over tc queuing disciplines. To resolve the conflict,
938 938
           we re-create the user switch's configuration, but as a
939 939
           leaf of the TCIntf-created configuration."""
940
        if type( intf ) is TCIntf:
940
        if isinstance( intf, TCIntf ):
941 941
            ifspeed = 10000000000 # 10 Gbps
942 942
            minspeed = ifspeed * 0.001
943 943

  
......
1097 1097
        """Unfortunately OVS and Mininet are fighting
1098 1098
           over tc queuing disciplines. As a quick hack/
1099 1099
           workaround, we clear OVS's and reapply our own."""
1100
        if type( intf ) is TCIntf:
1100
        if isinstance( intf, TCIntf ):
1101 1101
            intf.config( **intf.params )
1102 1102

  
1103 1103
    def attach( self, intf ):
mininet/topo.py
45 45
        entry = self.edge[ dst ][ src ] = self.edge[ src ][ dst ]
46 46
        # If no key, pick next ordinal number
47 47
        if key is None:
48
            keys = [ k for k in entry.keys() if type( k ) is int ]
48
            keys = [ k for k in entry.keys() if isinstance( k, int ) ]
49 49
            key = max( [ 0 ] + keys ) + 1
50 50
        entry[ key ] = attr_dict
51 51
        return key
mininet/util.py
388 388
    #read limit
389 389
    with open( name, 'r' ) as readFile:
390 390
        oldLimit = readFile.readline()
391
        if type( limit ) is int:
391
        if isinstance( limit, int ):
392 392
            #compare integer limits before overriding
393 393
            if int( oldLimit ) < limit:
394 394
                with open( name, 'w' ) as writeFile:

Also available in: Unified diff