Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Gentoo Portage Developer (http://www.linux-archive.org/gentoo-portage-developer/)
-   -   fpformat is deprecated, use string interpolation (http://www.linux-archive.org/gentoo-portage-developer/142807-fpformat-deprecated-use-string-interpolation.html)

Ali Polatel 08-14-2008 09:03 AM

fpformat is deprecated, use string interpolation
 
Hi,
The fpformat module is deprecated and will be removed in py3k.
The % string interpolation operator should be used instead.
Attached patch fixes this.

---
pym/_emerge/__init__.py | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 7a5c743..9bc06db 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -24,7 +24,6 @@ import array
from collections import deque
import fcntl
import formatter
-import fpformat
import logging
import select
import shlex
@@ -8674,7 +8673,7 @@ class JobStatusDisplay(object):
avg = os.getloadavg()
except OSError, e:
return str(e)
- return ", ".join(fpformat.fix(x, digits) for x in avg)
+ return ", ".join(("%%.%df" % digits ) % x for x in avg)

def display(self):
"""
--
Regards,
Ali Polatel


All times are GMT. The time now is 05:49 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.