def cpu(self, type): if type == 'count': return psutil.cpu_count() elif type == 'cpu_percent': return psutil.cpu_percent(interval=1)