summaryrefslogtreecommitdiffstats
path: root/Lib/lib-old
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2001-02-09 11:51:27 (GMT)
committerEric S. Raymond <esr@thyrsus.com>2001-02-09 11:51:27 (GMT)
commitfc170b1fd5db978f4e8d4c23c138a7b59df681ec (patch)
tree3c73ffcba8f5ece8c64a086a362b7fbe65368048 /Lib/lib-old
parentd8c628bd59f70b5389c39fd9e6a15cb3e2d46f27 (diff)
downloadcpython-fc170b1fd5db978f4e8d4c23c138a7b59df681ec.zip
cpython-fc170b1fd5db978f4e8d4c23c138a7b59df681ec.tar.gz
cpython-fc170b1fd5db978f4e8d4c23c138a7b59df681ec.tar.bz2
String method conversion.
Diffstat (limited to 'Lib/lib-old')
-rw-r--r--Lib/lib-old/codehack.py2
-rw-r--r--Lib/lib-old/grep.py3
-rw-r--r--Lib/lib-old/ni.py17
-rw-r--r--Lib/lib-old/packmail.py3
-rw-r--r--Lib/lib-old/tb.py11
5 files changed, 16 insertions, 20 deletions
diff --git a/Lib/lib-old/codehack.py b/Lib/lib-old/codehack.py
index 6453db5..52ac6be 100644
--- a/Lib/lib-old/codehack.py
+++ b/Lib/lib-old/codehack.py
@@ -48,7 +48,7 @@ def getcodename(co):
if ord(code[0]) == SET_LINENO:
lineno = ord(code[1]) | ord(code[2]) << 8
line = linecache.getline(filename, lineno)
- words = string.split(line)
+ words = line.split()
if len(words) >= 2 and words[0] in ('def', 'class'):
name = words[1]
for i in range(len(name)):
diff --git a/Lib/lib-old/grep.py b/Lib/lib-old/grep.py
index 6f74fd3..6f66081 100644
--- a/Lib/lib-old/grep.py
+++ b/Lib/lib-old/grep.py
@@ -2,7 +2,6 @@
import regex
from regex_syntax import *
-import string
opt_show_where = 0
opt_show_filename = 0
@@ -59,7 +58,7 @@ def pgrep(pat, *files):
def showline(filename, lineno, line, prog):
if line[-1:] == '\n': line = line[:-1]
if opt_show_lineno:
- prefix = string.rjust(`lineno`, 3) + ': '
+ prefix = `lineno`.rjust(, 3) + ': '
else:
prefix = ''
if opt_show_filename:
diff --git a/Lib/lib-old/ni.py b/Lib/lib-old/ni.py
index 4a06f59..074f989 100644
--- a/Lib/lib-old/ni.py
+++ b/Lib/lib-old/ni.py
@@ -163,7 +163,6 @@ XXX Need to have an explicit name for '', e.g. '__root__'.
import imp
-import string
import sys
import __builtin__
@@ -206,7 +205,7 @@ class PackageLoader(ModuleLoader):
def load_dynamic(self, name, stuff):
file, filename, (suff, mode, type) = stuff
# Hack around restriction in imp.load_dynamic()
- i = string.rfind(name, '.')
+ i = name.rfind('.')
tail = name[i+1:]
if sys.modules.has_key(tail):
save = sys.modules[tail]
@@ -241,7 +240,7 @@ class PackageLoader(ModuleLoader):
def set_parent(self, m):
name = m.__name__
if '.' in name:
- name = name[:string.rfind(name, '.')]
+ name = name[:name.rfind('.')]
else:
name = ''
m.__ = sys.modules[name]
@@ -250,7 +249,7 @@ class PackageLoader(ModuleLoader):
name = package.__name__
package.__domain__ = domain = [name]
while '.' in name:
- name = name[:string.rfind(name, '.')]
+ name = name[:name.rfind('.')]
domain.append(name)
if name:
domain.append('')
@@ -285,7 +284,7 @@ class PackageImporter(ModuleImporter):
if not name:
return self.finish(package, p, '', fromlist)
if '.' in name:
- i = string.find(name, '.')
+ i = name.find('.')
name, tail = name[:i], name[i:]
else:
tail = ''
@@ -293,7 +292,7 @@ class PackageImporter(ModuleImporter):
m = self.get1(mname)
return self.finish(package, m, tail, fromlist)
if '.' in name:
- i = string.find(name, '.')
+ i = name.find('.')
name, tail = name[:i], name[i:]
else:
tail = ''
@@ -312,7 +311,7 @@ class PackageImporter(ModuleImporter):
yname, tail = yname + tail, ''
m = self.get1(yname)
while tail:
- i = string.find(tail, '.', 1)
+ i = tail.find('.', 1)
if i > 0:
head, tail = tail[:i], tail[i:]
else:
@@ -351,7 +350,7 @@ class PackageImporter(ModuleImporter):
if sys.modules.has_key(name):
return sys.modules[name]
if '.' in name:
- i = string.rfind(name, '.')
+ i = name.rfind('.')
head, tail = name[:i], name[i+1:]
else:
head, tail = '', name
@@ -367,7 +366,7 @@ class PackageImporter(ModuleImporter):
def reload(self, module):
name = module.__name__
if '.' in name:
- i = string.rfind(name, '.')
+ i = name.rfind('.')
head, tail = name[:i], name[i+1:]
path = sys.modules[head].__path__
else:
diff --git a/Lib/lib-old/packmail.py b/Lib/lib-old/packmail.py
index 2a5aa75..8d247bc 100644
--- a/Lib/lib-old/packmail.py
+++ b/Lib/lib-old/packmail.py
@@ -5,7 +5,6 @@
import os
from stat import ST_MTIME
-import string
# Print help
def help():
@@ -103,7 +102,7 @@ def packtree(outfp, dirname):
packtree(outfp, subdirname)
def unixfix(name):
- comps = string.splitfields(name, os.sep)
+ comps = name.splitfields(os.sep)
res = ''
for comp in comps:
if comp:
diff --git a/Lib/lib-old/tb.py b/Lib/lib-old/tb.py
index abe4824..57851aa 100644
--- a/Lib/lib-old/tb.py
+++ b/Lib/lib-old/tb.py
@@ -5,7 +5,6 @@
import sys
import os
from stat import *
-import string
import linecache
def br(): browser(sys.last_traceback)
@@ -35,7 +34,7 @@ def browser(tb):
except EOFError:
print '\n[EOF]'
break
- cmd = string.strip(line)
+ cmd = line.strip()
if cmd:
if cmd == 'quit':
break
@@ -62,8 +61,8 @@ def browserlist(tb):
last = lineno
first = max(1, last-10)
for i in range(first, last+1):
- if i == lineno: prefix = '***' + string.rjust(`i`, 4) + ':'
- else: prefix = string.rjust(`i`, 7) + ':'
+ if i == lineno: prefix = '***' + `i`.rjust(4) + ':'
+ else: prefix = `i`.rjust(7) + ':'
line = linecache.getline(filename, i)
if line[-1:] == '\n': line = line[:-1]
print prefix + line
@@ -115,14 +114,14 @@ def printtbheader(tb):
info = '"' + filename + '"(' + `lineno` + ')'
line = linecache.getline(filename, lineno)
if line:
- info = info + ': ' + string.strip(line)
+ info = info + ': ' + line.strip()
print info
def printsymbols(d):
keys = d.keys()
keys.sort()
for name in keys:
- print ' ' + string.ljust(name, 12) + ':',
+ print ' ' + name.ljust(12) + ':',
printobject(d[name], 4)
print