[Python-checkins] python/dist/src/Lib ftplib.py,1.68,1.69 markupbase.py,1.4,1.5 tabnanny.py,1.20,1.21
nnorwitz@users.sourceforge.net
nnorwitz@users.sourceforge.net
Fri, 31 May 2002 07:13:06 -0700
Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv5685
Modified Files:
ftplib.py markupbase.py tabnanny.py
Log Message:
Use string methods where possible, and remove import string
Index: ftplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/ftplib.py,v
retrieving revision 1.68
retrieving revision 1.69
diff -C2 -d -r1.68 -r1.69
*** ftplib.py 12 May 2002 05:53:51 -0000 1.68
--- ftplib.py 31 May 2002 14:13:03 -0000 1.69
***************
*** 37,41 ****
import os
import sys
- import string
# Import SOCKS module if it exists, else standard socket module socket
--- 37,40 ----
***************
*** 267,271 ****
raise error_proto, 'unsupported address family'
fields = ['', `af`, host, `port`, '']
! cmd = 'EPRT ' + string.joinfields(fields, '|')
return self.voidcmd(cmd)
--- 266,270 ----
raise error_proto, 'unsupported address family'
fields = ['', `af`, host, `port`, '']
! cmd = 'EPRT ' + '|'.join(fields)
return self.voidcmd(cmd)
***************
*** 586,601 ****
if resp[:3] <> '229':
raise error_reply, resp
! left = string.find(resp, '(')
if left < 0: raise error_proto, resp
! right = string.find(resp, ')', left + 1)
if right < 0:
raise error_proto, resp # should contain '(|||port|)'
if resp[left + 1] <> resp[right - 1]:
raise error_proto, resp
! parts = string.split(resp[left + 1:right], resp[left+1])
if len(parts) <> 5:
raise error_proto, resp
host = peer[0]
! port = string.atoi(parts[3])
return host, port
--- 585,600 ----
if resp[:3] <> '229':
raise error_reply, resp
! left = resp.find('(')
if left < 0: raise error_proto, resp
! right = resp.find(')', left + 1)
if right < 0:
raise error_proto, resp # should contain '(|||port|)'
if resp[left + 1] <> resp[right - 1]:
raise error_proto, resp
! parts = resp[left+1].split(resp[left + 1:right])
if len(parts) <> 5:
raise error_proto, resp
host = peer[0]
! port = int(parts[3])
return host, port
Index: markupbase.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/markupbase.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** markupbase.py 26 Oct 2001 18:02:28 -0000 1.4
--- markupbase.py 31 May 2002 14:13:03 -0000 1.5
***************
*** 39,46 ****
return j
rawdata = self.rawdata
! nlines = string.count(rawdata, "\n", i, j)
if nlines:
self.lineno = self.lineno + nlines
! pos = string.rindex(rawdata, "\n", i, j) # Should not fail
self.offset = j-(pos+1)
else:
--- 39,46 ----
return j
rawdata = self.rawdata
! nlines = rawdata.count("\n", i, j)
if nlines:
self.lineno = self.lineno + nlines
! pos = rawdata.rindex("\n", i, j) # Should not fail
self.offset = j-(pos+1)
else:
***************
*** 177,181 ****
rawdata = self.rawdata
if '>' in rawdata[j:]:
! return string.find(rawdata, ">", j) + 1
return -1
--- 177,181 ----
rawdata = self.rawdata
if '>' in rawdata[j:]:
! return rawdata.find(">", j) + 1
return -1
***************
*** 201,205 ****
# an enumerated type; look for ')'
if ")" in rawdata[j:]:
! j = string.find(rawdata, ")", j) + 1
else:
return -1
--- 201,205 ----
# an enumerated type; look for ')'
if ")" in rawdata[j:]:
! j = rawdata.find(")", j) + 1
else:
return -1
***************
*** 308,312 ****
if (i + len(s)) == n:
return None, -1 # end of buffer
! return string.lower(name), m.end()
else:
self.updatepos(declstartpos, i)
--- 308,312 ----
if (i + len(s)) == n:
return None, -1 # end of buffer
! return name.lower(), m.end()
else:
self.updatepos(declstartpos, i)
Index: tabnanny.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/tabnanny.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** tabnanny.py 23 May 2002 15:15:29 -0000 1.20
--- tabnanny.py 31 May 2002 14:13:04 -0000 1.21
***************
*** 262,271 ****
def format_witnesses(w):
- import string
firsts = map(lambda tup: str(tup[0]), w)
prefix = "at tab size"
if len(w) > 1:
prefix = prefix + "s"
! return prefix + " " + string.join(firsts, ', ')
def process_tokens(tokens):
--- 262,270 ----
def format_witnesses(w):
firsts = map(lambda tup: str(tup[0]), w)
prefix = "at tab size"
if len(w) > 1:
prefix = prefix + "s"
! return prefix + " " + ', '.join(firsts)
def process_tokens(tokens):