From a8fd701ceb226a59499eada70eccbe31c36d7205 Mon Sep 17 00:00:00 2001 From: Chris Mutel Date: Fri, 8 May 2015 13:07:25 +0200 Subject: [PATCH] get_foo is deprecated in favour of foo --- pyprind/prog_class.py | 6 +++--- pyprind/progbar.py | 6 +++--- pyprind/progpercent.py | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pyprind/prog_class.py b/pyprind/prog_class.py index 7439b2a..a9532c6 100644 --- a/pyprind/prog_class.py +++ b/pyprind/prog_class.py @@ -139,11 +139,11 @@ def __repr__(self): str_end, self.total_time) else: try: + cpu_total = self.process.cpu_percent() + mem_total = self.process.memory_percent() + except AttributeError: # old version of psutil cpu_total = self.process.get_cpu_percent() mem_total = self.process.get_memory_percent() - except AttributeError: # old version of psutil - cpu_total = self.process.cpu_percent() - mem_total = self.process.memory_percent() return 'Title: {}\n'\ ' Started: {}\n'\ diff --git a/pyprind/progbar.py b/pyprind/progbar.py index 3bc521f..ea7f08a 100755 --- a/pyprind/progbar.py +++ b/pyprind/progbar.py @@ -44,11 +44,11 @@ def __init__(self, iterations, track_time=True, width=30, stream=2, title='', mo self._print_progress_bar(0) if monitor: try: + self.process.cpu_percent() + self.process.memory_percent() + except AttributeError: # old version of psutil self.process.get_cpu_percent() self.process.get_memory_percent() - except AttributeError: # old version of psutil - cpu_total = self.process.cpu_percent() - mem_total = self.process.memory_percent() if self.item_id: self._print_item_id() diff --git a/pyprind/progpercent.py b/pyprind/progpercent.py index bb4d913..2013181 100755 --- a/pyprind/progpercent.py +++ b/pyprind/progpercent.py @@ -37,11 +37,11 @@ def __init__(self, iterations, track_time=True, stream=2, title='', monitor=Fals self._print() if monitor: try: + self.process.cpu_percent() + self.process.memory_percent() + except AttributeError: # old version of psutil self.process.get_cpu_percent() self.process.get_memory_percent() - except AttributeError: # old version of psutil - cpu_total = self.process.cpu_percent() - mem_total = self.process.memory_percent() def _print(self):