[Python-checkins] CVS: python/dist/src/Lib Cookie.py,1.3,1.4 binhex.py,1.15,1.16 calendar.py,1.18,1.19 cmd.py,1.18,1.19 commands.py,1.12,1.13 dircache.py,1.6,1.7 dospath.py,1.19,1.20 filecmp.py,1.7,1.8 ftplib.py,1.45,1.46 imputil.py,1.14,1.15 linecache.py,1.5,1.6 macpath.py,1.26,1.27 macurl2path.py,1.7,1.8 mailbox.py,1.26,1.27 mailcap.py,1.5,1.6 mhlib.py,1.21,1.22 mimetools.py,1.18,1.19 multifile.py,1.11,1.12 netrc.py,1.6,1.7 nntplib.py,1.20,1.21 ntpath.py,1.31,1.32 pdb.py,1.44,1.45 pipes.py,1.5,1.6 posixpath.py,1.37,1.38 quopri.py,1.7,1.8 regsub.py,1.7,1.8 sgmllib.py,1.21,1.22 smtplib.py,1.30,1.31 sndhdr.py,1.3,1.4 statcache.py,1.7,1.8 sunaudio.py,1.5,1.6 toaiff.py,1.7,1.8 tzparse.py,1.7,1.8 uu.py,1.12,1.13 xdrlib.py,1.9,1.10 xmllib.py,1.24,1.25
Fred L. Drake
python-dev@python.org
Tue, 12 Dec 2000 15:20:48 -0800
Update of /cvsroot/python/python/dist/src/Lib
In directory slayer.i.sourceforge.net:/tmp/cvs-serv19858
Modified Files:
Cookie.py binhex.py calendar.py cmd.py commands.py dircache.py
dospath.py filecmp.py ftplib.py imputil.py linecache.py
macpath.py macurl2path.py mailbox.py mailcap.py mhlib.py
mimetools.py multifile.py netrc.py nntplib.py ntpath.py pdb.py
pipes.py posixpath.py quopri.py regsub.py sgmllib.py
smtplib.py sndhdr.py statcache.py sunaudio.py toaiff.py
tzparse.py uu.py xdrlib.py xmllib.py
Log Message:
Update the code to better reflect recommended style:
Use != instead of <> since <> is documented as "obsolescent".
Use "is" and "is not" when comparing with None or type objects.
Index: Cookie.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/Cookie.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** Cookie.py 2000/08/24 14:40:35 1.3
--- Cookie.py 2000/12/12 23:20:44 1.4
***************
*** 490,494 ****
# Now add any defined attributes
! if attrs == None:
attrs = self._reserved_keys
for K,V in self.items():
--- 490,494 ----
# Now add any defined attributes
! if attrs is None:
attrs = self._reserved_keys
for K,V in self.items():
Index: binhex.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/binhex.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -r1.15 -r1.16
*** binhex.py 2000/08/17 05:06:49 1.15
--- binhex.py 2000/12/12 23:20:44 1.16
***************
*** 190,194 ****
self.ofp = _Rlecoderengine(hqxer)
self.crc = 0
! if finfo == None:
finfo = FInfo()
self.dlen = dlen
--- 190,194 ----
self.ofp = _Rlecoderengine(hqxer)
self.crc = 0
! if finfo is None:
finfo = FInfo()
self.dlen = dlen
***************
*** 229,233 ****
def close_data(self):
! if self.dlen <> 0:
raise Error, 'Incorrect data size, diff='+`self.rlen`
self._writecrc()
--- 229,233 ----
def close_data(self):
! if self.dlen != 0:
raise Error, 'Incorrect data size, diff='+`self.rlen`
self._writecrc()
***************
*** 247,251 ****
if self.state != _DID_DATA:
raise Error, 'Close at the wrong time'
! if self.rlen <> 0:
raise Error, \
"Incorrect resource-datasize, diff="+`self.rlen`
--- 247,251 ----
if self.state != _DID_DATA:
raise Error, 'Close at the wrong time'
! if self.rlen != 0:
raise Error, \
"Incorrect resource-datasize, diff="+`self.rlen`
Index: calendar.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/calendar.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** calendar.py 2000/10/09 12:42:04 1.18
--- calendar.py 2000/12/12 23:20:44 1.19
***************
*** 51,55 ****
def isleap(year):
"""Return 1 for leap years, 0 for non-leap years."""
! return year % 4 == 0 and (year % 100 <> 0 or year % 400 == 0)
def leapdays(y1, y2):
--- 51,55 ----
def isleap(year):
"""Return 1 for leap years, 0 for non-leap years."""
! return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
def leapdays(y1, y2):
Index: cmd.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/cmd.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** cmd.py 2000/07/11 13:03:55 1.18
--- cmd.py 2000/12/12 23:20:44 1.19
***************
*** 58,62 ****
def cmdloop(self, intro=None):
self.preloop()
! if intro != None:
self.intro = intro
if self.intro:
--- 58,62 ----
def cmdloop(self, intro=None):
self.preloop()
! if intro is not None:
self.intro = intro
if self.intro:
Index: commands.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/commands.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** commands.py 1998/03/26 21:11:54 1.12
--- commands.py 2000/12/12 23:20:44 1.13
***************
*** 52,56 ****
text = pipe.read()
sts = pipe.close()
! if sts == None: sts = 0
if text[-1:] == '\n': text = text[:-1]
return sts, text
--- 52,56 ----
text = pipe.read()
sts = pipe.close()
! if sts is None: sts = 0
if text[-1:] == '\n': text = text[:-1]
return sts, text
Index: dircache.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/dircache.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** dircache.py 2000/02/04 15:39:29 1.6
--- dircache.py 2000/12/12 23:20:44 1.7
***************
*** 20,24 ****
except os.error:
return []
! if mtime <> cached_mtime:
try:
list = os.listdir(path)
--- 20,24 ----
except os.error:
return []
! if mtime != cached_mtime:
try:
list = os.listdir(path)
Index: dospath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/dospath.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -r1.19 -r1.20
*** dospath.py 2000/09/28 16:25:20 1.19
--- dospath.py 2000/12/12 23:20:44 1.20
***************
*** 109,113 ****
for item in m:
for i in range(len(prefix)):
! if prefix[:i+1] <> item[:i+1]:
prefix = prefix[:i]
if i == 0: return ''
--- 109,113 ----
for item in m:
for i in range(len(prefix)):
! if prefix[:i+1] != item[:i+1]:
prefix = prefix[:i]
if i == 0: return ''
***************
*** 211,215 ****
variable expansion.)"""
! if path[:1] <> '~':
return path
i, n = 1, len(path)
--- 211,215 ----
variable expansion.)"""
! if path[:1] != '~':
return path
i, n = 1, len(path)
***************
*** 304,308 ****
del comps[i-1:i+1]
i = i - 1
! elif comps[i] == '' and i > 0 and comps[i-1] <> '':
del comps[i]
elif '.' in comps[i]:
--- 304,308 ----
del comps[i-1:i+1]
i = i - 1
! elif comps[i] == '' and i > 0 and comps[i-1] != '':
del comps[i]
elif '.' in comps[i]:
Index: filecmp.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/filecmp.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** filecmp.py 2000/12/03 20:48:07 1.7
--- filecmp.py 2000/12/12 23:20:44 1.8
***************
*** 200,204 ****
a_type = stat.S_IFMT(a_stat[stat.ST_MODE])
b_type = stat.S_IFMT(b_stat[stat.ST_MODE])
! if a_type <> b_type:
self.common_funny.append(x)
elif stat.S_ISDIR(a_type):
--- 200,204 ----
a_type = stat.S_IFMT(a_stat[stat.ST_MODE])
b_type = stat.S_IFMT(b_stat[stat.ST_MODE])
! if a_type != b_type:
self.common_funny.append(x)
elif stat.S_ISDIR(a_type):
***************
*** 318,322 ****
import getopt
options, args = getopt.getopt(sys.argv[1:], 'r')
! if len(args) <> 2: raise getopt.error, 'need exactly two args'
dd = dircmp(args[0], args[1])
if ('-r', '') in options:
--- 318,323 ----
import getopt
options, args = getopt.getopt(sys.argv[1:], 'r')
! if len(args) != 2:
! raise getopt.error, 'need exactly two args'
dd = dircmp(args[0], args[1])
if ('-r', '') in options:
Index: ftplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/ftplib.py,v
retrieving revision 1.45
retrieving revision 1.46
diff -C2 -r1.45 -r1.46
*** ftplib.py 2000/09/01 06:09:23 1.45
--- ftplib.py 2000/12/12 23:20:44 1.46
***************
*** 186,190 ****
line = line + ('\n' + nextline)
if nextline[:3] == code and \
! nextline[3:4] <> '-':
break
return line
--- 186,190 ----
line = line + ('\n' + nextline)
if nextline[:3] == code and \
! nextline[3:4] != '-':
break
return line
***************
*** 208,212 ****
"""Expect a response beginning with '2'."""
resp = self.getresp()
! if resp[0] <> '2':
raise error_reply, resp
return resp
--- 208,212 ----
"""Expect a response beginning with '2'."""
resp = self.getresp()
! if resp[0] != '2':
raise error_reply, resp
return resp
***************
*** 278,282 ****
self.sendcmd("REST %s" % rest)
resp = self.sendcmd(cmd)
! if resp[0] <> '1':
raise error_reply, resp
else:
--- 278,282 ----
self.sendcmd("REST %s" % rest)
resp = self.sendcmd(cmd)
! if resp[0] != '1':
raise error_reply, resp
else:
***************
*** 285,289 ****
self.sendcmd("REST %s" % rest)
resp = self.sendcmd(cmd)
! if resp[0] <> '1':
raise error_reply, resp
conn, sockaddr = sock.accept()
--- 285,289 ----
self.sendcmd("REST %s" % rest)
resp = self.sendcmd(cmd)
! if resp[0] != '1':
raise error_reply, resp
conn, sockaddr = sock.accept()
***************
*** 319,323 ****
if resp[0] == '3': resp = self.sendcmd('PASS ' + passwd)
if resp[0] == '3': resp = self.sendcmd('ACCT ' + acct)
! if resp[0] <> '2':
raise error_reply, resp
return resp
--- 319,323 ----
if resp[0] == '3': resp = self.sendcmd('PASS ' + passwd)
if resp[0] == '3': resp = self.sendcmd('ACCT ' + acct)
! if resp[0] != '2':
raise error_reply, resp
return resp
***************
*** 385,389 ****
buf = fp.readline()
if not buf: break
! if buf[-2:] <> CRLF:
if buf[-1] in CRLF: buf = buf[:-1]
buf = buf + CRLF
--- 385,389 ----
buf = fp.readline()
if not buf: break
! if buf[-2:] != CRLF:
if buf[-1] in CRLF: buf = buf[:-1]
buf = buf + CRLF
***************
*** 424,428 ****
'''Rename a file.'''
resp = self.sendcmd('RNFR ' + fromname)
! if resp[0] <> '3':
raise error_reply, resp
return self.voidcmd('RNTO ' + toname)
--- 424,428 ----
'''Rename a file.'''
resp = self.sendcmd('RNFR ' + fromname)
! if resp[0] != '3':
raise error_reply, resp
return self.voidcmd('RNTO ' + toname)
***************
*** 509,513 ****
Return ('host.addr.as.numbers', port#) tuple.'''
! if resp[:3] <> '227':
raise error_reply, resp
left = string.find(resp, '(')
--- 509,513 ----
Return ('host.addr.as.numbers', port#) tuple.'''
! if resp[:3] != '227':
raise error_reply, resp
left = string.find(resp, '(')
***************
*** 517,521 ****
raise error_proto, resp # should contain '(h1,h2,h3,h4,p1,p2)'
numbers = string.split(resp[left+1:right], ',')
! if len(numbers) <> 6:
raise error_proto, resp
host = string.join(numbers[:4], '.')
--- 517,521 ----
raise error_proto, resp # should contain '(h1,h2,h3,h4,p1,p2)'
numbers = string.split(resp[left+1:right], ',')
! if len(numbers) != 6:
raise error_proto, resp
host = string.join(numbers[:4], '.')
***************
*** 529,535 ****
Returns the directoryname in the 257 reply.'''
! if resp[:3] <> '257':
raise error_reply, resp
! if resp[3:5] <> ' "':
return '' # Not compliant to RFC 959, but UNIX ftpd does this
dirname = ''
--- 529,535 ----
Returns the directoryname in the 257 reply.'''
! if resp[:3] != '257':
raise error_reply, resp
! if resp[3:5] != ' "':
return '' # Not compliant to RFC 959, but UNIX ftpd does this
dirname = ''
***************
*** 540,544 ****
i = i+1
if c == '"':
! if i >= n or resp[i] <> '"':
break
i = i+1
--- 540,544 ----
i = i+1
if c == '"':
! if i >= n or resp[i] != '"':
break
i = i+1
Index: imputil.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/imputil.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** imputil.py 2000/07/18 09:09:47 1.14
--- imputil.py 2000/12/12 23:20:44 1.15
***************
*** 435,439 ****
if ':' not in a:
a = ':' + a
! if a[-1:] <> ':':
a = a + ':'
return a + b
--- 435,439 ----
if ':' not in a:
a = ':' + a
! if a[-1:] != ':':
a = a + ':'
return a + b
***************
*** 644,648 ****
# need to change sys.* references for rexec environs
# need hook for MAL's walk-me-up import strategy, or Tim's absolute strategy
! # watch out for sys.modules[...] == None
# flag to force absolute imports? (speeds _determine_import_context and
# checking for a relative module)
--- 644,648 ----
# need to change sys.* references for rexec environs
# need hook for MAL's walk-me-up import strategy, or Tim's absolute strategy
! # watch out for sys.modules[...] is None
# flag to force absolute imports? (speeds _determine_import_context and
# checking for a relative module)
Index: linecache.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/linecache.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** linecache.py 2000/02/04 15:10:33 1.5
--- linecache.py 2000/12/12 23:20:44 1.6
***************
*** 51,55 ****
del cache[filename]
continue
! if size <> stat[ST_SIZE] or mtime <> stat[ST_MTIME]:
del cache[filename]
--- 51,55 ----
del cache[filename]
continue
! if size != stat[ST_SIZE] or mtime != stat[ST_MTIME]:
del cache[filename]
Index: macpath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/macpath.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** macpath.py 2000/09/28 16:25:20 1.26
--- macpath.py 2000/12/12 23:20:44 1.27
***************
*** 18,22 ****
volume name)."""
! return ':' in s and s[0] <> ':'
--- 18,22 ----
volume name)."""
! return ':' in s and s[0] != ':'
***************
*** 31,35 ****
if ':' not in path:
path = ':' + path
! if path[-1:] <> ':':
path = path + ':'
path = path + t
--- 31,35 ----
if ':' not in path:
path = ':' + path
! if path[-1:] != ':':
path = path + ':'
path = path + t
***************
*** 152,156 ****
for item in m:
for i in range(len(prefix)):
! if prefix[:i+1] <> item[:i+1]:
prefix = prefix[:i]
if i == 0: return ''
--- 152,156 ----
for item in m:
for i in range(len(prefix)):
! if prefix[:i+1] != item[:i+1]:
prefix = prefix[:i]
if i == 0: return ''
Index: macurl2path.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/macurl2path.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** macurl2path.py 2000/02/04 15:39:29 1.7
--- macurl2path.py 2000/12/12 23:20:44 1.8
***************
*** 13,17 ****
#
tp = urllib.splittype(pathname)[0]
! if tp and tp <> 'file':
raise RuntimeError, 'Cannot convert non-local URL to pathname'
# Turn starting /// into /, an empty hostname means current host
--- 13,17 ----
#
tp = urllib.splittype(pathname)[0]
! if tp and tp != 'file':
raise RuntimeError, 'Cannot convert non-local URL to pathname'
# Turn starting /// into /, an empty hostname means current host
***************
*** 30,34 ****
del components[i-1:i+1]
i = i-1
! elif components[i] == '' and i > 0 and components[i-1] <> '':
del components[i]
else:
--- 30,34 ----
del components[i-1:i+1]
i = i-1
! elif components[i] == '' and i > 0 and components[i-1] != '':
del components[i]
else:
Index: mailbox.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/mailbox.py,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -r1.26 -r1.27
*** mailbox.py 2000/10/23 13:37:01 1.26
--- mailbox.py 2000/12/12 23:20:44 1.27
***************
*** 31,35 ****
self._search_end()
self.seekp = stop = self.fp.tell()
! if start <> stop:
break
return rfc822.Message(_Subfile(self.fp, start, stop))
--- 31,35 ----
self._search_end()
self.seekp = stop = self.fp.tell()
! if start != stop:
break
return rfc822.Message(_Subfile(self.fp, start, stop))
Index: mailcap.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/mailcap.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** mailcap.py 2000/02/04 15:10:33 1.5
--- mailcap.py 2000/12/12 23:20:44 1.6
***************
*** 174,178 ****
while i < n:
c = field[i]; i = i+1
! if c <> '%':
if c == '\\':
c = field[i:i+1]; i = i+1
--- 174,178 ----
while i < n:
c = field[i]; i = i+1
! if c != '%':
if c == '\\':
c = field[i:i+1]; i = i+1
***************
*** 188,192 ****
elif c == '{':
start = i
! while i < n and field[i] <> '}':
i = i+1
name = field[start:i]
--- 188,192 ----
elif c == '{':
start = i
! while i < n and field[i] != '}':
i = i+1
name = field[start:i]
Index: mhlib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/mhlib.py,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** mhlib.py 2000/07/16 12:04:30 1.21
--- mhlib.py 2000/12/12 23:20:44 1.22
***************
*** 306,310 ****
if not line: break
fields = string.splitfields(line, ':')
! if len(fields) <> 2:
self.error('bad sequence in %s: %s' %
(fullname, string.strip(line)))
--- 306,310 ----
if not line: break
fields = string.splitfields(line, ':')
! if len(fields) != 2:
self.error('bad sequence in %s: %s' %
(fullname, string.strip(line)))
Index: mimetools.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/mimetools.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -r1.18 -r1.19
*** mimetools.py 2000/09/30 16:52:45 1.18
--- mimetools.py 2000/12/12 23:20:44 1.19
***************
*** 23,27 ****
def parsetype(self):
str = self.typeheader
! if str == None:
str = 'text/plain'
if ';' in str:
--- 23,27 ----
def parsetype(self):
str = self.typeheader
! if str is None:
str = 'text/plain'
if ';' in str:
***************
*** 76,80 ****
def getencoding(self):
! if self.encodingheader == None:
return '7bit'
return string.lower(self.encodingheader)
--- 76,80 ----
def getencoding(self):
! if self.encodingheader is None:
return '7bit'
return string.lower(self.encodingheader)
***************
*** 110,114 ****
import time
import random
! if _prefix == None:
import socket
import os
--- 110,114 ----
import time
import random
! if _prefix is None:
import socket
import os
Index: multifile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/multifile.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** multifile.py 2000/08/17 05:06:49 1.11
--- multifile.py 2000/12/12 23:20:44 1.12
***************
*** 156,160 ****
def is_data(self, line):
! return line[:2] <> '--'
def section_divider(self, str):
--- 156,160 ----
def is_data(self, line):
! return line[:2] != '--'
def section_divider(self, str):
Index: netrc.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/netrc.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** netrc.py 2000/07/13 13:25:07 1.6
--- netrc.py 2000/12/12 23:20:44 1.7
***************
*** 18,22 ****
# Look for a machine, default, or macdef top-level keyword
toplevel = tt = lexer.get_token()
! if tt == '' or tt == None:
break
elif tt == 'machine':
--- 18,22 ----
# Look for a machine, default, or macdef top-level keyword
toplevel = tt = lexer.get_token()
! if not tt:
break
elif tt == 'machine':
Index: nntplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/nntplib.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** nntplib.py 2000/07/16 12:04:30 1.20
--- nntplib.py 2000/12/12 23:20:45 1.21
***************
*** 259,263 ****
resp = self.shortcmd('GROUP ' + name)
! if resp[:3] <> '211':
raise NNTPReplyError(resp)
words = string.split(resp)
--- 259,263 ----
resp = self.shortcmd('GROUP ' + name)
! if resp[:3] != '211':
raise NNTPReplyError(resp)
words = string.split(resp)
***************
*** 283,287 ****
def statparse(self, resp):
"""Internal: parse the response of a STAT, NEXT or LAST command."""
! if resp[:2] <> '22':
raise NNTPReplyError(resp)
words = string.split(resp)
--- 283,287 ----
def statparse(self, resp):
"""Internal: parse the response of a STAT, NEXT or LAST command."""
! if resp[:2] != '22':
raise NNTPReplyError(resp)
words = string.split(resp)
***************
*** 430,434 ****
resp = self.shortcmd("XPATH " + id)
! if resp[:3] <> '223':
raise NNTPReplyError(resp)
try:
--- 430,434 ----
resp = self.shortcmd("XPATH " + id)
! if resp[:3] != '223':
raise NNTPReplyError(resp)
try:
***************
*** 448,452 ****
resp = self.shortcmd("DATE")
! if resp[:3] <> '111':
raise NNTPReplyError(resp)
elem = string.split(resp)
--- 448,452 ----
resp = self.shortcmd("DATE")
! if resp[:3] != '111':
raise NNTPReplyError(resp)
elem = string.split(resp)
***************
*** 468,472 ****
resp = self.shortcmd('POST')
# Raises error_??? if posting is not allowed
! if resp[0] <> '3':
raise NNTPReplyError(resp)
while 1:
--- 468,472 ----
resp = self.shortcmd('POST')
# Raises error_??? if posting is not allowed
! if resp[0] != '3':
raise NNTPReplyError(resp)
while 1:
***************
*** 492,496 ****
resp = self.shortcmd('IHAVE ' + id)
# Raises error_??? if the server already has it
! if resp[0] <> '3':
raise NNTPReplyError(resp)
while 1:
--- 492,496 ----
resp = self.shortcmd('IHAVE ' + id)
# Raises error_??? if the server already has it
! if resp[0] != '3':
raise NNTPReplyError(resp)
while 1:
Index: ntpath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/ntpath.py,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -r1.31 -r1.32
*** ntpath.py 2000/09/28 16:25:20 1.31
--- ntpath.py 2000/12/12 23:20:45 1.32
***************
*** 161,165 ****
for item in m:
for i in range(len(prefix)):
! if prefix[:i+1] <> item[:i+1]:
prefix = prefix[:i]
if i == 0: return ''
--- 161,165 ----
for item in m:
for i in range(len(prefix)):
! if prefix[:i+1] != item[:i+1]:
prefix = prefix[:i]
if i == 0: return ''
***************
*** 284,288 ****
If user or $HOME is unknown, do nothing."""
! if path[:1] <> '~':
return path
i, n = 1, len(path)
--- 284,288 ----
If user or $HOME is unknown, do nothing."""
! if path[:1] != '~':
return path
i, n = 1, len(path)
***************
*** 388,392 ****
del comps[i-1:i+1]
i = i - 1
! elif comps[i] == '' and i > 0 and comps[i-1] <> '':
del comps[i]
else:
--- 388,392 ----
del comps[i-1:i+1]
i = i - 1
! elif comps[i] == '' and i > 0 and comps[i-1] != '':
del comps[i]
else:
Index: pdb.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pdb.py,v
retrieving revision 1.44
retrieving revision 1.45
diff -C2 -r1.44 -r1.45
*** pdb.py 2000/07/16 12:04:30 1.44
--- pdb.py 2000/12/12 23:20:45 1.45
***************
*** 554,558 ****
else:
first = self.lineno + 1
! if last == None:
last = first + 10
filename = self.curframe.f_code.co_filename
--- 554,558 ----
else:
first = self.lineno + 1
! if last is None:
last = first + 10
filename = self.curframe.f_code.co_filename
***************
*** 896,900 ****
p = Pdb()
p.reset()
! while t.tb_next <> None: t = t.tb_next
p.interaction(t.tb_frame, t)
--- 896,901 ----
p = Pdb()
p.reset()
! while t.tb_next is not None:
! t = t.tb_next
p.interaction(t.tb_frame, t)
Index: pipes.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pipes.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** pipes.py 2000/02/04 15:10:34 1.5
--- pipes.py 2000/12/12 23:20:45 1.6
***************
*** 111,115 ****
def append(self, cmd, kind):
"""t.append(cmd, kind) adds a new step at the end."""
! if type(cmd) <> type(''):
raise TypeError, \
'Template.append: cmd must be a string'
--- 111,115 ----
def append(self, cmd, kind):
"""t.append(cmd, kind) adds a new step at the end."""
! if type(cmd) is not type(''):
raise TypeError, \
'Template.append: cmd must be a string'
***************
*** 120,124 ****
raise ValueError, \
'Template.append: SOURCE can only be prepended'
! if self.steps <> [] and self.steps[-1][1] == SINK:
raise ValueError, \
'Template.append: already ends with SINK'
--- 120,124 ----
raise ValueError, \
'Template.append: SOURCE can only be prepended'
! if self.steps and self.steps[-1][1] == SINK:
raise ValueError, \
'Template.append: already ends with SINK'
***************
*** 133,137 ****
def prepend(self, cmd, kind):
"""t.prepend(cmd, kind) adds a new step at the front."""
! if type(cmd) <> type(''):
raise TypeError, \
'Template.prepend: cmd must be a string'
--- 133,137 ----
def prepend(self, cmd, kind):
"""t.prepend(cmd, kind) adds a new step at the front."""
! if type(cmd) is not type(''):
raise TypeError, \
'Template.prepend: cmd must be a string'
***************
*** 142,146 ****
raise ValueError, \
'Template.prepend: SINK can only be appended'
! if self.steps <> [] and self.steps[0][1] == SOURCE:
raise ValueError, \
'Template.prepend: already begins with SOURCE'
--- 142,146 ----
raise ValueError, \
'Template.prepend: SINK can only be appended'
! if self.steps and self.steps[0][1] == SOURCE:
raise ValueError, \
'Template.prepend: already begins with SOURCE'
***************
*** 166,170 ****
"""t.open_r(file) and t.open_w(file) implement
t.open(file, 'r') and t.open(file, 'w') respectively."""
! if self.steps == []:
return open(file, 'r')
if self.steps[-1][1] == SINK:
--- 166,170 ----
"""t.open_r(file) and t.open_w(file) implement
t.open(file, 'r') and t.open(file, 'w') respectively."""
! if not self.steps:
return open(file, 'r')
if self.steps[-1][1] == SINK:
***************
*** 175,179 ****
def open_w(self, file):
! if self.steps == []:
return open(file, 'w')
if self.steps[0][1] == SOURCE:
--- 175,179 ----
def open_w(self, file):
! if not self.steps:
return open(file, 'w')
if self.steps[0][1] == SOURCE:
***************
*** 204,208 ****
# Make sure there is at least one step
#
! if list == []:
list.append(['', 'cat', '--', ''])
#
--- 204,208 ----
# Make sure there is at least one step
#
! if not list:
list.append(['', 'cat', '--', ''])
#
Index: posixpath.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/posixpath.py,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -r1.37 -r1.38
*** posixpath.py 2000/09/28 16:22:52 1.37
--- posixpath.py 2000/12/12 23:20:45 1.38
***************
*** 60,64 ****
i = p.rfind('/') + 1
head, tail = p[:i], p[i:]
! if head and head <> '/'*len(head):
while head[-1] == '/':
head = head[:-1]
--- 60,64 ----
i = p.rfind('/') + 1
head, tail = p[:i], p[i:]
! if head and head != '/'*len(head):
while head[-1] == '/':
head = head[:-1]
***************
*** 121,125 ****
for item in m:
for i in range(len(prefix)):
! if prefix[:i+1] <> item[:i+1]:
prefix = prefix[:i]
if i == 0: return ''
--- 121,125 ----
for item in m:
for i in range(len(prefix)):
! if prefix[:i+1] != item[:i+1]:
prefix = prefix[:i]
if i == 0: return ''
***************
*** 282,289 ****
"""Expand ~ and ~user constructions. If user or $HOME is unknown,
do nothing."""
! if path[:1] <> '~':
return path
i, n = 1, len(path)
! while i < n and path[i] <> '/':
i = i + 1
if i == 1:
--- 282,289 ----
"""Expand ~ and ~user constructions. If user or $HOME is unknown,
do nothing."""
! if path[:1] != '~':
return path
i, n = 1, len(path)
! while i < n and path[i] != '/':
i = i + 1
if i == 1:
Index: quopri.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/quopri.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** quopri.py 2000/10/05 17:24:33 1.7
--- quopri.py 2000/12/12 23:20:45 1.8
***************
*** 70,74 ****
while i < n:
c = line[i]
! if c <> ESCAPE:
new = new + c; i = i+1
elif i+1 == n and not partial:
--- 70,74 ----
while i < n:
c = line[i]
! if c != ESCAPE:
new = new + c; i = i+1
elif i+1 == n and not partial:
Index: regsub.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/regsub.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** regsub.py 2000/02/04 15:28:40 1.7
--- regsub.py 2000/12/12 23:20:45 1.8
***************
*** 125,129 ****
def compile(pat):
! if type(pat) <> type(''):
return pat # Assume it is a compiled regex
key = (pat, regex.get_syntax())
--- 125,129 ----
def compile(pat):
! if type(pat) != type(''):
return pat # Assume it is a compiled regex
key = (pat, regex.get_syntax())
***************
*** 154,158 ****
while i < len(repl):
c = repl[i]; i = i+1
! if c <> '\\' or i >= len(repl):
new = new + c
else:
--- 154,158 ----
while i < len(repl):
c = repl[i]; i = i+1
! if c != '\\' or i >= len(repl):
new = new + c
else:
***************
*** 183,187 ****
if line[-1] == '\n': line = line[:-1]
fields = split(line, delpat)
! if len(fields) <> 3:
print 'Sorry, not three fields'
print 'split:', `fields`
--- 183,187 ----
if line[-1] == '\n': line = line[:-1]
fields = split(line, delpat)
! if len(fields) != 3:
print 'Sorry, not three fields'
print 'split:', `fields`
Index: sgmllib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/sgmllib.py,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -r1.21 -r1.22
*** sgmllib.py 2000/06/29 18:50:59 1.21
--- sgmllib.py 2000/12/12 23:20:45 1.22
***************
*** 186,190 ****
def parse_comment(self, i):
rawdata = self.rawdata
! if rawdata[i:i+4] <> '<!--':
raise RuntimeError, 'unexpected call to handle_comment'
match = commentclose.search(rawdata, i+4)
--- 186,190 ----
def parse_comment(self, i):
rawdata = self.rawdata
! if rawdata[i:i+4] != '<!--':
raise RuntimeError, 'unexpected call to handle_comment'
match = commentclose.search(rawdata, i+4)
***************
*** 199,203 ****
def parse_pi(self, i):
rawdata = self.rawdata
! if rawdata[i:i+2] <> '<?':
raise RuntimeError, 'unexpected call to handle_pi'
match = piclose.search(rawdata, i+2)
--- 199,203 ----
def parse_pi(self, i):
rawdata = self.rawdata
! if rawdata[i:i+2] != '<?':
raise RuntimeError, 'unexpected call to handle_pi'
match = piclose.search(rawdata, i+2)
Index: smtplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/smtplib.py,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -r1.30 -r1.31
*** smtplib.py 2000/11/08 22:19:47 1.30
--- smtplib.py 2000/12/12 23:20:45 1.31
***************
*** 320,324 ****
raise SMTPServerDisconnected("Server not connected")
self.ehlo_resp=msg
! if code<>250:
return (code,msg)
self.does_esmtp=1
--- 320,324 ----
raise SMTPServerDisconnected("Server not connected")
self.ehlo_resp=msg
! if code != 250:
return (code,msg)
self.does_esmtp=1
***************
*** 379,383 ****
(code,repl)=self.getreply()
if self.debuglevel >0 : print "data:", (code,repl)
! if code <> 354:
raise SMTPDataError(code,repl)
else:
--- 379,383 ----
(code,repl)=self.getreply()
if self.debuglevel >0 : print "data:", (code,repl)
! if code != 354:
raise SMTPDataError(code,repl)
else:
***************
*** 476,480 ****
(code,resp) = self.mail(from_addr, esmtp_opts)
! if code <> 250:
self.rset()
raise SMTPSenderRefused(code, resp, from_addr)
--- 476,480 ----
(code,resp) = self.mail(from_addr, esmtp_opts)
! if code != 250:
self.rset()
raise SMTPSenderRefused(code, resp, from_addr)
***************
*** 484,488 ****
for each in to_addrs:
(code,resp)=self.rcpt(each, rcpt_options)
! if (code <> 250) and (code <> 251):
senderrs[each]=(code,resp)
if len(senderrs)==len(to_addrs):
--- 484,488 ----
for each in to_addrs:
(code,resp)=self.rcpt(each, rcpt_options)
! if (code != 250) and (code != 251):
senderrs[each]=(code,resp)
if len(senderrs)==len(to_addrs):
***************
*** 490,495 ****
self.rset()
raise SMTPRecipientsRefused(senderrs)
! (code,resp)=self.data(msg)
! if code <> 250:
self.rset()
raise SMTPDataError(code, resp)
--- 490,495 ----
self.rset()
raise SMTPRecipientsRefused(senderrs)
! (code,resp) = self.data(msg)
! if code != 250:
self.rset()
raise SMTPDataError(code, resp)
Index: sndhdr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/sndhdr.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** sndhdr.py 1999/01/06 15:20:49 1.3
--- sndhdr.py 2000/12/12 23:20:45 1.4
***************
*** 57,61 ****
def test_aifc(h, f):
import aifc
! if h[:4] <> 'FORM':
return None
if h[8:12] == 'AIFC':
--- 57,61 ----
def test_aifc(h, f):
import aifc
! if h[:4] != 'FORM':
return None
if h[8:12] == 'AIFC':
***************
*** 106,110 ****
def test_hcom(h, f):
! if h[65:69] <> 'FSSD' or h[128:132] <> 'HCOM':
return None
divisor = get_long_be(h[128+16:128+20])
--- 106,110 ----
def test_hcom(h, f):
! if h[65:69] != 'FSSD' or h[128:132] != 'HCOM':
return None
divisor = get_long_be(h[128+16:128+20])
***************
*** 115,119 ****
def test_voc(h, f):
! if h[:20] <> 'Creative Voice File\032':
return None
sbseek = get_short_le(h[20:22])
--- 115,119 ----
def test_voc(h, f):
! if h[:20] != 'Creative Voice File\032':
return None
sbseek = get_short_le(h[20:22])
***************
*** 129,133 ****
def test_wav(h, f):
# 'RIFF' <len> 'WAVE' 'fmt ' <len>
! if h[:4] <> 'RIFF' or h[8:12] <> 'WAVE' or h[12:16] <> 'fmt ':
return None
style = get_short_le(h[20:22])
--- 129,133 ----
def test_wav(h, f):
# 'RIFF' <len> 'WAVE' 'fmt ' <len>
! if h[:4] != 'RIFF' or h[8:12] != 'WAVE' or h[12:16] != 'fmt ':
return None
style = get_short_le(h[20:22])
***************
*** 141,145 ****
def test_8svx(h, f):
! if h[:4] <> 'FORM' or h[8:12] <> '8SVX':
return None
# Should decode it to get #channels -- assume always 1
--- 141,145 ----
def test_8svx(h, f):
! if h[:4] != 'FORM' or h[8:12] != '8SVX':
return None
# Should decode it to get #channels -- assume always 1
Index: statcache.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/statcache.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** statcache.py 2000/02/04 15:39:30 1.7
--- statcache.py 2000/12/12 23:20:45 1.8
***************
*** 44,51 ****
"""Forget about a directory and all entries in it, but not about
entries in subdirectories."""
! if prefix[-1:] == '/' and prefix <> '/':
prefix = prefix[:-1]
forget(prefix)
! if prefix[-1:] <> '/':
prefix = prefix + '/'
n = len(prefix)
--- 44,51 ----
"""Forget about a directory and all entries in it, but not about
entries in subdirectories."""
! if prefix[-1:] == '/' and prefix != '/':
prefix = prefix[:-1]
forget(prefix)
! if prefix[-1:] != '/':
prefix = prefix + '/'
n = len(prefix)
***************
*** 63,67 ****
n = len(prefix)
for path in cache.keys():
! if path[:n] <> prefix:
del cache[path]
--- 63,67 ----
n = len(prefix)
for path in cache.keys():
! if path[:n] != prefix:
del cache[path]
Index: sunaudio.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/sunaudio.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** sunaudio.py 2000/08/17 04:45:13 1.5
--- sunaudio.py 2000/12/12 23:20:45 1.6
***************
*** 14,18 ****
def gethdr(fp):
"""Read a sound header from an open file."""
! if fp.read(4) <> MAGIC:
raise error, 'gethdr: bad magic word'
hdr_size = get_long_be(fp.read(4))
--- 14,18 ----
def gethdr(fp):
"""Read a sound header from an open file."""
! if fp.read(4) != MAGIC:
raise error, 'gethdr: bad magic word'
hdr_size = get_long_be(fp.read(4))
Index: toaiff.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/toaiff.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** toaiff.py 2000/08/17 04:45:13 1.7
--- toaiff.py 2000/12/12 23:20:45 1.8
***************
*** 64,68 ****
finally:
for temp in temps[:]:
! if temp <> ret:
try:
os.unlink(temp)
--- 64,68 ----
finally:
for temp in temps[:]:
! if temp != ret:
try:
os.unlink(temp)
***************
*** 89,98 ****
type(msg[0]) == type(0) and type(msg[1]) == type(''):
msg = msg[1]
! if type(msg) <> type(''):
msg = `msg`
raise error, filename + ': ' + msg
if ftype == 'aiff':
return fname
! if ftype == None or not table.has_key(ftype):
raise error, \
filename + ': unsupported audio file type ' + `ftype`
--- 89,98 ----
type(msg[0]) == type(0) and type(msg[1]) == type(''):
msg = msg[1]
! if type(msg) != type(''):
msg = `msg`
raise error, filename + ': ' + msg
if ftype == 'aiff':
return fname
! if ftype is None or not table.has_key(ftype):
raise error, \
filename + ': unsupported audio file type ' + `ftype`
Index: tzparse.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/tzparse.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** tzparse.py 2000/02/04 15:28:41 1.7
--- tzparse.py 2000/12/12 23:20:45 1.8
***************
*** 17,21 ****
specify the starting and ending points for daylight saving time."""
global tzprog
! if tzprog == None:
import re
tzprog = re.compile(tzpat)
--- 17,21 ----
specify the starting and ending points for daylight saving time."""
global tzprog
! if tzprog is None:
import re
tzprog = re.compile(tzpat)
Index: uu.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/uu.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -r1.12 -r1.13
*** uu.py 2000/08/17 04:45:13 1.12
--- uu.py 2000/12/12 23:20:45 1.13
***************
*** 47,53 ****
in_file = sys.stdin
elif type(in_file) == type(''):
! if name == None:
name = os.path.basename(in_file)
! if mode == None:
try:
mode = os.stat(in_file)[0]
--- 47,53 ----
in_file = sys.stdin
elif type(in_file) == type(''):
! if name is None:
name = os.path.basename(in_file)
! if mode is None:
try:
mode = os.stat(in_file)[0]
***************
*** 65,71 ****
# Set defaults for name and mode
#
! if name == None:
name = '-'
! if mode == None:
mode = 0666
#
--- 65,71 ----
# Set defaults for name and mode
#
! if name is None:
name = '-'
! if mode is None:
mode = 0666
#
***************
*** 105,111 ****
except ValueError:
pass
! if out_file == None:
out_file = hdrfields[2]
! if mode == None:
mode = string.atoi(hdrfields[1], 8)
#
--- 105,111 ----
except ValueError:
pass
! if out_file is None:
out_file = hdrfields[2]
! if mode is None:
mode = string.atoi(hdrfields[1], 8)
#
Index: xdrlib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/xdrlib.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** xdrlib.py 1998/03/26 21:13:22 1.9
--- xdrlib.py 2000/12/12 23:20:45 1.10
***************
*** 96,100 ****
def pack_farray(self, n, list, pack_item):
! if len(list) <> n:
raise ValueError, 'wrong array size'
for item in list:
--- 96,100 ----
def pack_farray(self, n, list, pack_item):
! if len(list) != n:
raise ValueError, 'wrong array size'
for item in list:
***************
*** 205,209 ****
x = self.unpack_uint()
if x == 0: break
! if x <> 1:
raise ConversionError, '0 or 1 expected, got ' + `x`
item = unpack_item()
--- 205,209 ----
x = self.unpack_uint()
if x == 0: break
! if x != 1:
raise ConversionError, '0 or 1 expected, got ' + `x`
item = unpack_item()
Index: xmllib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/xmllib.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -r1.24 -r1.25
*** xmllib.py 2000/12/06 10:37:57 1.24
--- xmllib.py 2000/12/12 23:20:45 1.25
***************
*** 422,426 ****
def parse_comment(self, i):
rawdata = self.rawdata
! if rawdata[i:i+4] <> '<!--':
raise Error('unexpected call to handle_comment')
res = commentclose.search(rawdata, i+4)
--- 422,426 ----
def parse_comment(self, i):
rawdata = self.rawdata
! if rawdata[i:i+4] != '<!--':
raise Error('unexpected call to handle_comment')
res = commentclose.search(rawdata, i+4)
***************
*** 488,492 ****
def parse_cdata(self, i):
rawdata = self.rawdata
! if rawdata[i:i+9] <> '<![CDATA[':
raise Error('unexpected call to parse_cdata')
res = cdataclose.search(rawdata, i+9)
--- 488,492 ----
def parse_cdata(self, i):
rawdata = self.rawdata
! if rawdata[i:i+9] != '<![CDATA[':
raise Error('unexpected call to parse_cdata')
res = cdataclose.search(rawdata, i+9)