def numCores():
 if hasattr(numCores, 'ncores'):
  return numCores.ncores
 try:
  numCores.ncores = int(quietRun('grep -c processor /proc/cpuinfo'))
 except ValueError:
  return 0
 return numCores.ncores

def numCores ( ) : if hasattr ( numCores , 'ncores' ) : return numCores . ncores try : numCores . ncores = int ( quietRun ( 'grep -c processor /proc/cpuinfo' ) ) except ValueError : return 0 return numCores . ncores
returns number of cpu cores based on /proc/cpuinfo .