[Python-checkins] CVS: python/dist/src/Lib pdb.py,1.49,1.50
Eric S. Raymond
esr@users.sourceforge.net
Thu, 08 Feb 2001 23:58:55 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv17065
Modified Files:
pdb.py
Log Message:
String method conversion.
Index: pdb.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pdb.py,v
retrieving revision 1.49
retrieving revision 1.50
diff -C2 -r1.49 -r1.50
*** pdb.py 2001/02/07 23:14:30 1.49
--- pdb.py 2001/02/09 07:58:53 1.50
***************
*** 5,9 ****
# (See pdb.doc for documentation.)
- import string
import sys
import linecache
--- 5,8 ----
***************
*** 155,178 ****
if not line:
return line
! args = string.split(line)
while self.aliases.has_key(args[0]):
line = self.aliases[args[0]]
ii = 1
for tmpArg in args[1:]:
! line = string.replace(line, "%" + str(ii),
tmpArg)
ii = ii + 1
! line = string.replace(line, "%*",
! string.join(args[1:], ' '))
! args = string.split(line)
# split into ';;' separated commands
# unless it's an alias command
if args[0] != 'alias':
! marker = string.find(line, ';;')
if marker >= 0:
# queue up everything after marker
! next = string.lstrip(line[marker+2:])
self.cmdqueue.append(next)
! line = string.rstrip(line[:marker])
return line
--- 154,176 ----
if not line:
return line
! args = line.split()
while self.aliases.has_key(args[0]):
line = self.aliases[args[0]]
ii = 1
for tmpArg in args[1:]:
! line = line.replace("%" + str(ii),
tmpArg)
ii = ii + 1
! line = line.replace("%*", ' '.join(args[1:]))
! args = line.split()
# split into ';;' separated commands
# unless it's an alias command
if args[0] != 'alias':
! marker = line.find(';;')
if marker >= 0:
# queue up everything after marker
! next = line[marker+2:].lstrip()
self.cmdqueue.append(next)
! line = line[:marker].rstrip()
return line
***************
*** 200,212 ****
lineno = None
cond = None
! comma = string.find(arg, ',')
if comma > 0:
# parse stuff after comma: "condition"
! cond = string.lstrip(arg[comma+1:])
! arg = string.rstrip(arg[:comma])
# parse stuff before comma: [filename:]lineno | function
! colon = string.rfind(arg, ':')
if colon >= 0:
! filename = string.rstrip(arg[:colon])
f = self.lookupmodule(filename)
if not f:
--- 198,210 ----
lineno = None
cond = None
! comma = arg.find(',')
if comma > 0:
# parse stuff after comma: "condition"
! cond = arg[comma+1:].lstrip()
! arg = arg[:comma].rstrip()
# parse stuff before comma: [filename:]lineno | function
! colon = arg.rfind(':')
if colon >= 0:
! filename = arg[:colon].rstrip()
f = self.lookupmodule(filename)
if not f:
***************
*** 216,220 ****
else:
filename = f
! arg = string.lstrip(arg[colon+1:])
try:
lineno = int(arg)
--- 214,218 ----
else:
filename = f
! arg = arg[colon+1:].lstrip()
try:
lineno = int(arg)
***************
*** 280,294 ****
failed = (None, None, None)
# Input is identifier, may be in single quotes
! idstring = string.split(identifier, "'")
if len(idstring) == 1:
# not in single quotes
! id = string.strip(idstring[0])
elif len(idstring) == 3:
# quoted
! id = string.strip(idstring[1])
else:
return failed
if id == '': return failed
! parts = string.split(id, '.')
# Protection for derived debuggers
if parts[0] == 'self':
--- 278,292 ----
failed = (None, None, None)
# Input is identifier, may be in single quotes
! idstring = identifier.split("'")
if len(idstring) == 1:
# not in single quotes
! id = idstring[0].strip()
elif len(idstring) == 3:
# quoted
! id = idstring[1].strip()
else:
return failed
if id == '': return failed
! parts = id.split('.')
# Protection for derived debuggers
if parts[0] == 'self':
***************
*** 322,326 ****
print 'End of file'
return 0
! line = string.strip(line)
# Don't allow setting breakpoint at a blank line
if ( not line or (line[0] == '#') or
--- 320,324 ----
print 'End of file'
return 0
! line = line.strip()
# Don't allow setting breakpoint at a blank line
if ( not line or (line[0] == '#') or
***************
*** 358,362 ****
print 'end of file'
return 0
! line = string.strip(line)
if not line: continue # Blank line
if brackets <= 0 and line[0] not in ('#','"',"'"):
--- 356,360 ----
print 'end of file'
return 0
! line = line.strip()
if not line: continue # Blank line
if brackets <= 0 and line[0] not in ('#','"',"'"):
***************
*** 365,369 ****
def do_enable(self, arg):
! args = string.split(arg)
for i in args:
bp = bdb.Breakpoint.bpbynumber[int(i)]
--- 363,367 ----
def do_enable(self, arg):
! args = arg.split()
for i in args:
bp = bdb.Breakpoint.bpbynumber[int(i)]
***************
*** 372,376 ****
def do_disable(self, arg):
! args = string.split(arg)
for i in args:
bp = bdb.Breakpoint.bpbynumber[int(i)]
--- 370,374 ----
def do_disable(self, arg):
! args = arg.split()
for i in args:
bp = bdb.Breakpoint.bpbynumber[int(i)]
***************
*** 380,385 ****
def do_condition(self, arg):
# arg is breakpoint number and condition
! args = string.split(arg, ' ', 1)
! bpnum = int(string.strip(args[0]))
try:
cond = args[1]
--- 378,383 ----
def do_condition(self, arg):
# arg is breakpoint number and condition
! args = arg.split(' ', 1)
! bpnum = int(args[0].strip())
try:
cond = args[1]
***************
*** 395,402 ****
def do_ignore(self,arg):
"""arg is bp number followed by ignore count."""
! args = string.split(arg)
! bpnum = int(string.strip(args[0]))
try:
! count = int(string.strip(args[1]))
except:
count = 0
--- 393,400 ----
def do_ignore(self,arg):
"""arg is bp number followed by ignore count."""
! args = arg.split()
! bpnum = int(args[0].strip())
try:
! count = int(args[1].strip())
except:
count = 0
***************
*** 425,429 ****
except EOFError:
reply = 'no'
! reply = string.lower(string.strip(reply))
if reply in ('y', 'yes'):
self.clear_all_breaks()
--- 423,427 ----
except EOFError:
reply = 'no'
! reply = reply.strip().lower()
if reply in ('y', 'yes'):
self.clear_all_breaks()
***************
*** 431,435 ****
if ':' in arg:
# Make sure it works for "clear C:\foo\bar.py:12"
! i = string.rfind(arg, ':')
filename = arg[:i]
arg = arg[i+1:]
--- 429,433 ----
if ':' in arg:
# Make sure it works for "clear C:\foo\bar.py:12"
! i = arg.rfind(':')
filename = arg[:i]
arg = arg[i+1:]
***************
*** 442,446 ****
if err: print '***', err
return
! numberlist = string.split(arg)
for i in numberlist:
err = self.clear_bpbynumber(i)
--- 440,444 ----
if err: print '***', err
return
! numberlist = arg.split()
for i in numberlist:
err = self.clear_bpbynumber(i)
***************
*** 569,573 ****
break
else:
! s = string.rjust(`lineno`, 3)
if len(s) < 4: s = s + ' '
if lineno in breaklist: s = s + 'B'
--- 567,571 ----
break
else:
! s = `lineno`.rjust(3)
if len(s) < 4: s = s + ' '
if lineno in breaklist: s = s + 'B'
***************
*** 609,613 ****
def do_alias(self, arg):
! args = string.split (arg)
if len(args) == 0:
keys = self.aliases.keys()
--- 607,611 ----
def do_alias(self, arg):
! args = arg.split()
if len(args) == 0:
keys = self.aliases.keys()
***************
*** 619,626 ****
print "%s = %s" % (args[0], self.aliases[args[0]])
else:
! self.aliases[args[0]] = string.join(args[1:], ' ')
def do_unalias(self, arg):
! args = string.split (arg)
if len(args) == 0: return
if self.aliases.has_key(args[0]):
--- 617,624 ----
print "%s = %s" % (args[0], self.aliases[args[0]])
else:
! self.aliases[args[0]] = ' '.join(args[1:])
def do_unalias(self, arg):
! args = arg.split()
if len(args) == 0: return
if self.aliases.has_key(args[0]):