import sys
import time
import socket # For gethostbyaddr()
-import string
import mimetools
import SocketServer
"""
# 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,
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/':
"""
if sys.argv[1:]:
- port = string.atoi(sys.argv[1])
+ port = sys.argv[1].atoi()
else:
port = 8000
server_address = ('', port)
import socket
import asyncore
-import string
class async_chat (asyncore.dispatcher):
"""This is an abstract class. You must derive from this class, and add
# 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:
import exceptions
import select
import socket
-import string
import sys
import os
status.append ('%s:%d' % self.addr)
return '<%s %s at %x>' % (
self.__class__.__name__,
- string.join (status, ' '),
+ ' '.join (status),
id(self)
)
except:
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):
#
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` + ')'
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
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):
def test():
t = Tdb()
t.run('import bdb; bdb.foo(10)')
+
+# end
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: