summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2001-02-09 05:07:04 (GMT)
committerEric S. Raymond <esr@thyrsus.com>2001-02-09 05:07:04 (GMT)
commitb49f4a4b15228799aad77ba569971a23d21cc4f7 (patch)
treefca74bb59fa56fde8e2a23f209b41157172977d9
parent20e4423adef209d2260fd952533dc2360e2d257e (diff)
downloadcpython-b49f4a4b15228799aad77ba569971a23d21cc4f7.zip
cpython-b49f4a4b15228799aad77ba569971a23d21cc4f7.tar.gz
cpython-b49f4a4b15228799aad77ba569971a23d21cc4f7.tar.bz2
String method conversion.
-rw-r--r--Lib/BaseHTTPServer.py7
-rw-r--r--Lib/asynchat.py3
-rw-r--r--Lib/asyncore.py11
-rw-r--r--Lib/bdb.py10
-rw-r--r--Lib/binhex.py2
5 files changed, 13 insertions, 20 deletions
diff --git a/Lib/BaseHTTPServer.py b/Lib/BaseHTTPServer.py
index 2f17938..8d90345 100644
--- a/Lib/BaseHTTPServer.py
+++ b/Lib/BaseHTTPServer.py
@@ -68,7 +68,6 @@ __all__ = ["HTTPServer", "BaseHTTPRequestHandler"]
import sys
import time
import socket # For gethostbyaddr()
-import string
import mimetools
import SocketServer
@@ -203,7 +202,7 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
"""
# The Python system version, truncated to its first component.
- sys_version = "Python/" + string.split(sys.version)[0]
+ sys_version = "Python/" + sys.version.split()[0]
# The server software version. You may want to override this.
# The format is multiple whitespace-separated strings,
@@ -228,7 +227,7 @@ class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler):
elif requestline[-1:] == '\n':
requestline = requestline[:-1]
self.requestline = requestline
- words = string.split(requestline)
+ words = requestline.split()
if len(words) == 3:
[command, path, version] = words
if version[:5] != 'HTTP/':
@@ -468,7 +467,7 @@ def test(HandlerClass = BaseHTTPRequestHandler,
"""
if sys.argv[1:]:
- port = string.atoi(sys.argv[1])
+ port = sys.argv[1].atoi()
else:
port = 8000
server_address = ('', port)
diff --git a/Lib/asynchat.py b/Lib/asynchat.py
index 0ce5f43..88873d2 100644
--- a/Lib/asynchat.py
+++ b/Lib/asynchat.py
@@ -48,7 +48,6 @@ you - by calling your self.found_terminator() method.
import socket
import asyncore
-import string
class async_chat (asyncore.dispatcher):
"""This is an abstract class. You must derive from this class, and add
@@ -120,7 +119,7 @@ class async_chat (asyncore.dispatcher):
# 3) end of buffer does not match any prefix:
# collect data
terminator_len = len(terminator)
- index = string.find (self.ac_in_buffer, terminator)
+ index = terminator.find (self.ac_in_buffer)
if index != -1:
# we found the terminator
if index > 0:
diff --git a/Lib/asyncore.py b/Lib/asyncore.py
index f177692..145da58 100644
--- a/Lib/asyncore.py
+++ b/Lib/asyncore.py
@@ -49,7 +49,6 @@ sophisticated high-performance network servers and clients a snap.
import exceptions
import select
import socket
-import string
import sys
import os
@@ -219,7 +218,7 @@ class dispatcher:
status.append ('%s:%d' % self.addr)
return '<%s %s at %x>' % (
self.__class__.__name__,
- string.join (status, ' '),
+ ' '.join (status),
id(self)
)
except:
@@ -480,13 +479,7 @@ def compact_traceback ():
del tb
file, function, line = tbinfo[-1]
- info = '[' + string.join (
- map (
- lambda x: string.join (x, '|'),
- tbinfo
- ),
- '] ['
- ) + ']'
+ info = '[' + '] ['.join(map(lambda x: '|'.join(x), tbinfo)) + ']'
return (file, function, line), t, v, info
def close_all (map=None):
diff --git a/Lib/bdb.py b/Lib/bdb.py
index a0bf9b7..5cfb5ef 100644
--- a/Lib/bdb.py
+++ b/Lib/bdb.py
@@ -306,7 +306,7 @@ class Bdb:
#
def format_stack_entry(self, frame_lineno, lprefix=': '):
- import linecache, repr, string
+ import linecache, repr
frame, lineno = frame_lineno
filename = self.canonic(frame.f_code.co_filename)
s = filename + '(' + `lineno` + ')'
@@ -327,7 +327,7 @@ class Bdb:
s = s + '->'
s = s + repr.repr(rv)
line = linecache.getline(filename, lineno)
- if line: s = s + lprefix + string.strip(line)
+ if line: s = s + lprefix + line.strip()
return s
# The following two methods can be called by clients to use
@@ -534,12 +534,12 @@ class Tdb(Bdb):
if not name: name = '???'
print '+++ call', name, args
def user_line(self, frame):
- import linecache, string
+ import linecache
name = frame.f_code.co_name
if not name: name = '???'
fn = self.canonic(frame.f_code.co_filename)
line = linecache.getline(fn, frame.f_lineno)
- print '+++', fn, frame.f_lineno, name, ':', string.strip(line)
+ print '+++', fn, frame.f_lineno, name, ':', line.strip()
def user_return(self, frame, retval):
print '+++ return', retval
def user_exception(self, frame, exc_stuff):
@@ -558,3 +558,5 @@ def bar(a):
def test():
t = Tdb()
t.run('import bdb; bdb.foo(10)')
+
+# end
diff --git a/Lib/binhex.py b/Lib/binhex.py
index 8189563..5137ccf 100644
--- a/Lib/binhex.py
+++ b/Lib/binhex.py
@@ -102,7 +102,7 @@ else:
dsize = fp.tell()
fp.close()
dir, file = os.path.split(name)
- file = string.replace(file, ':', '-', 1)
+ file = file.replace(':', '-', 1)
return file, finfo, dsize, 0
class openrsrc: