#NEWLINE# def set_number_of_online_cpus( self , core , number ) : #NEWLINE# #INDENT# core_ids = [ i for ( i , c ) in enumerate ( self . core_names ) if ( c == core ) ] #NEWLINE# max_cores = len ( core_ids ) #NEWLINE# if ( number > max_cores ) : #NEWLINE# #INDENT# message = 'Attempting to set the number of active {} to {}; maximum is {}' #NEWLINE# raise ValueError ( message . format ( core , core_ids , max_cores ) ) #NEWLINE# #UNINDENT# for i in xrange ( 0 , number ) : #NEWLINE# #INDENT# self . enable_cpu ( core_ids [ i ] ) #NEWLINE# #UNINDENT# for i in xrange ( number , max_cores ) : #NEWLINE# #INDENT# self . disable_cpu ( core_ids [ i ] )