diff Tools/scripts/trace.py @ 25219:8a7a2f1f88f0 legacy-trunk

Apply diff2.txt from SF patch http://www.python.org/sf/572113 (with one small bugfix in bgen/bgen/scantools.py) This replaces string module functions with string methods for the stuff in the Tools directory. Several uses of string.letters etc. are still remaining.
author Walter Dörwald <walter@livinglogic.de>
date Wed, 11 Sep 2002 20:36:02 +0000
parents cf5928fab108
children 4ec1902ee6b7
line wrap: on
line diff
--- a/Tools/scripts/trace.py	Wed Sep 11 19:40:10 2002 +0000
+++ b/Tools/scripts/trace.py	Wed Sep 11 20:36:02 2002 +0000
@@ -83,7 +83,7 @@
    trace.print_results(show_missing=1)
 """
 
-import sys, os, string, tempfile, types, copy, operator, inspect, exceptions, marshal
+import sys, os, tempfile, types, copy, operator, inspect, exceptions, marshal
 try:
     import cPickle
     pickle = cPickle
@@ -177,7 +177,7 @@
             # or
             #  d = "/usr/local.py"
             #  filename = "/usr/local.py"
-            if string.find(filename, d + os.sep) == 0:
+            if filename.startswith(d + os.sep):
                 self._ignore[modulename] = 1
                 return 1
 
@@ -341,13 +341,12 @@
                     # '#pragma: NO COVER' (it is possible to embed this into
                     # the text as a non-comment; no easy fix)
                     if executable_linenos.has_key(i+1) and \
-                       string.find(lines[i],
-                                   string.join(['#pragma', 'NO COVER'])) == -1:
+                       lines[i].find(' '.join(['#pragma', 'NO COVER'])) == -1:
                         outfile.write('>>>>>> ')
                     else:
                         outfile.write(' '*7)
                     n_lines = n_lines + 1
-                outfile.write(string.expandtabs(lines[i], 8))
+                outfile.write(lines[i].expandtabs(8))
 
             outfile.close()
 
@@ -675,16 +674,16 @@
             continue
 
         if opt == "--ignore-dir":
-            for s in string.split(val, os.pathsep):
+            for s in val.split(os.pathsep):
                 s = os.path.expandvars(s)
                 # should I also call expanduser? (after all, could use $HOME)
 
-                s = string.replace(s, "$prefix",
-                                   os.path.join(sys.prefix, "lib",
-                                                "python" + sys.version[:3]))
-                s = string.replace(s, "$exec_prefix",
-                                   os.path.join(sys.exec_prefix, "lib",
-                                                "python" + sys.version[:3]))
+                s = s.replace("$prefix",
+                              os.path.join(sys.prefix, "lib",
+                                           "python" + sys.version[:3]))
+                s = s.replace("$exec_prefix",
+                              os.path.join(sys.exec_prefix, "lib",
+                                           "python" + sys.version[:3]))
                 s = os.path.normpath(s)
                 ignore_dirs.append(s)
             continue