def cpuCount():
 if (sys.platform == 'win32'):
  try:
   num = int(os.environ['NUMBER_OF_PROCESSORS'])
  except (ValueError, KeyError):
   num = (-1)
 elif (sys.platform == 'darwin'):
  try:
   num = int(os.popen('sysctl -n hw.ncpu').read())
  except ValueError:
   num = (-1)
 else:
  try:
   num = os.sysconf('SC_NPROCESSORS_ONLN')
  except (ValueError, OSError, AttributeError):
   num = (-1)
 return num

def cpuCount ( ) : if ( sys . platform == 'win32' ) : try : num = int ( os . environ [ 'NUMBER_OF_PROCESSORS' ] ) except ( ValueError , KeyError ) : num = ( - 1 ) elif ( sys . platform == 'darwin' ) : try : num = int ( os . popen ( 'sysctl -n hw.ncpu' ) . read ( ) ) except ValueError : num = ( - 1 ) else : try : num = os . sysconf ( 'SC_NPROCESSORS_ONLN' ) except ( ValueError , OSError , AttributeError ) : num = ( - 1 ) return num
returns the number of cpus in the system .