def cpu_count():
 if (sys.platform == 'win32'):
  try:
   num = int(os.environ['NUMBER_OF_PROCESSORS'])
  except (ValueError, KeyError):
   num = 0
 elif (sys.platform == 'darwin'):
  try:
   num = int(command_output(['/usr/sbin/sysctl', '-n', 'hw.ncpu']))
  except (ValueError, OSError, subprocess.CalledProcessError):
   num = 0
 else:
  try:
   num = os.sysconf('SC_NPROCESSORS_ONLN')
  except (ValueError, OSError, AttributeError):
   num = 0
 if (num >= 1):
  return num
 else:
  return 1

def cpu_count ( ) : if ( sys . platform == 'win32' ) : try : num = int ( os . environ [ 'NUMBER_OF_PROCESSORS' ] ) except ( ValueError , KeyError ) : num = 0 elif ( sys . platform == 'darwin' ) : try : num = int ( command_output ( [ '/usr/sbin/sysctl' , '-n' , 'hw.ncpu' ] ) ) except ( ValueError , OSError , subprocess . CalledProcessError ) : num = 0 else : try : num = os . sysconf ( 'SC_NPROCESSORS_ONLN' ) except ( ValueError , OSError , AttributeError ) : num = 0 if ( num >= 1 ) : return num else : return 1
returns the number of processors on this machine .