[PATCH 04/17] Remove uses of the deprecated string.split method.

David Shea dshea at redhat.com
Sun Sep 21 19:36:56 UTC 2014


Strings can do that themselves nowadays. This gets us more ready for
python3 and gets an import out of the anaconda script.
---
 anaconda         | 4 +---
 scripts/instperf | 3 +--
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/anaconda b/anaconda
index f16bce6..19441b4 100755
--- a/anaconda
+++ b/anaconda
@@ -690,7 +690,7 @@ def setupDisplay(anaconda, options, addons=None):
 
         # Only consider vncconnect when vnc is a param
         if options.vncconnect:
-            cargs = string.split(options.vncconnect, ":")
+            cargs = options.vncconnect.split(":")
             vncS.vncconnecthost = cargs[0]
             if len(cargs) > 1 and len(cargs[1]) > 0:
                 if len(cargs[1]) > 0:
@@ -964,8 +964,6 @@ if __name__ == "__main__":
 
     from pyanaconda import isys
 
-    import string
-
     from pyanaconda import iutil
 
     iutil.ipmi_report(constants.IPMI_STARTED)
diff --git a/scripts/instperf b/scripts/instperf
index f0d53b2..daa91a7 100755
--- a/scripts/instperf
+++ b/scripts/instperf
@@ -1,7 +1,6 @@
 #!/usr/bin/python
 
 import logging
-from string import split
 from subprocess import Popen, PIPE
 import time
 
@@ -12,7 +11,7 @@ import time
 def topProcesses():
     output = Popen(["ps", "-eo", "comm,rss", "--sort", "-rss", "--no-headers"], stdout=PIPE).communicate()[0]
     top5 = output.split("\n")[:5]
-    return ",".join(map(lambda (a,b): a+":"+b, map(split, top5)))
+    return ",".join("%s:%s" % (proc[0], proc[1]) for proc in (s.split() for s in top5))
 
 def logit():
     buffers = 0
-- 
1.9.3



More information about the anaconda-patches mailing list