summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/Cookie.py2
-rw-r--r--Lib/binhex.py6
-rw-r--r--Lib/calendar.py2
-rw-r--r--Lib/cmd.py2
-rw-r--r--Lib/commands.py2
-rw-r--r--Lib/dircache.py2
-rw-r--r--Lib/dospath.py6
-rw-r--r--Lib/filecmp.py5
-rw-r--r--Lib/ftplib.py24
-rw-r--r--Lib/imputil.py4
-rw-r--r--Lib/linecache.py2
-rw-r--r--Lib/macpath.py6
-rw-r--r--Lib/macurl2path.py4
-rwxr-xr-xLib/mailbox.py2
-rw-r--r--Lib/mailcap.py4
-rw-r--r--Lib/mhlib.py2
-rw-r--r--Lib/mimetools.py6
-rw-r--r--Lib/multifile.py2
-rw-r--r--Lib/netrc.py2
-rw-r--r--Lib/nntplib.py12
-rw-r--r--Lib/ntpath.py6
-rwxr-xr-xLib/pdb.py5
-rw-r--r--Lib/pipes.py14
-rw-r--r--Lib/posixpath.py8
-rwxr-xr-xLib/quopri.py2
-rw-r--r--Lib/regsub.py6
-rw-r--r--Lib/sgmllib.py4
-rwxr-xr-xLib/smtplib.py12
-rw-r--r--Lib/sndhdr.py10
-rw-r--r--Lib/statcache.py6
-rw-r--r--Lib/sunaudio.py2
-rw-r--r--Lib/toaiff.py6
-rw-r--r--Lib/tzparse.py2
-rwxr-xr-xLib/uu.py12
-rw-r--r--Lib/xdrlib.py4
-rw-r--r--Lib/xmllib.py4
36 files changed, 101 insertions, 99 deletions
diff --git a/Lib/Cookie.py b/Lib/Cookie.py
index 67259af..223e715 100644
--- a/Lib/Cookie.py
+++ b/Lib/Cookie.py
@@ -489,7 +489,7 @@ class Morsel(UserDict):
RA("%s=%s;" % (self.key, self.coded_value))
# Now add any defined attributes
- if attrs == None:
+ if attrs is None:
attrs = self._reserved_keys
for K,V in self.items():
if V == "": continue
diff --git a/Lib/binhex.py b/Lib/binhex.py
index 0892203..fe695ac 100644
--- a/Lib/binhex.py
+++ b/Lib/binhex.py
@@ -189,7 +189,7 @@ class BinHex:
hqxer = _Hqxcoderengine(ofp)
self.ofp = _Rlecoderengine(hqxer)
self.crc = 0
- if finfo == None:
+ if finfo is None:
finfo = FInfo()
self.dlen = dlen
self.rlen = rlen
@@ -228,7 +228,7 @@ class BinHex:
self._write(data)
def close_data(self):
- if self.dlen <> 0:
+ if self.dlen != 0:
raise Error, 'Incorrect data size, diff='+`self.rlen`
self._writecrc()
self.state = _DID_DATA
@@ -246,7 +246,7 @@ class BinHex:
self.close_data()
if self.state != _DID_DATA:
raise Error, 'Close at the wrong time'
- if self.rlen <> 0:
+ if self.rlen != 0:
raise Error, \
"Incorrect resource-datasize, diff="+`self.rlen`
self._writecrc()
diff --git a/Lib/calendar.py b/Lib/calendar.py
index 41bb191..01c2194 100644
--- a/Lib/calendar.py
+++ b/Lib/calendar.py
@@ -50,7 +50,7 @@ def setfirstweekday(weekday):
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)
+ return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
def leapdays(y1, y2):
"""Return number of leap years in range [y1, y2).
diff --git a/Lib/cmd.py b/Lib/cmd.py
index 41b2293..7671573 100644
--- a/Lib/cmd.py
+++ b/Lib/cmd.py
@@ -57,7 +57,7 @@ class Cmd:
def cmdloop(self, intro=None):
self.preloop()
- if intro != None:
+ if intro is not None:
self.intro = intro
if self.intro:
print self.intro
diff --git a/Lib/commands.py b/Lib/commands.py
index 12acc36..99387b1 100644
--- a/Lib/commands.py
+++ b/Lib/commands.py
@@ -51,7 +51,7 @@ def getstatusoutput(cmd):
pipe = os.popen('{ ' + cmd + '; } 2>&1', 'r')
text = pipe.read()
sts = pipe.close()
- if sts == None: sts = 0
+ if sts is None: sts = 0
if text[-1:] == '\n': text = text[:-1]
return sts, text
diff --git a/Lib/dircache.py b/Lib/dircache.py
index a35e16d..08b127a 100644
--- a/Lib/dircache.py
+++ b/Lib/dircache.py
@@ -19,7 +19,7 @@ def listdir(path):
mtime = os.stat(path)[8]
except os.error:
return []
- if mtime <> cached_mtime:
+ if mtime != cached_mtime:
try:
list = os.listdir(path)
except os.error:
diff --git a/Lib/dospath.py b/Lib/dospath.py
index f44d499..17db624 100644
--- a/Lib/dospath.py
+++ b/Lib/dospath.py
@@ -108,7 +108,7 @@ def commonprefix(m):
prefix = m[0]
for item in m:
for i in range(len(prefix)):
- if prefix[:i+1] <> item[:i+1]:
+ if prefix[:i+1] != item[:i+1]:
prefix = prefix[:i]
if i == 0: return ''
break
@@ -210,7 +210,7 @@ def expanduser(path):
(A function should also be defined to do full *sh-style environment
variable expansion.)"""
- if path[:1] <> '~':
+ if path[:1] != '~':
return path
i, n = 1, len(path)
while i < n and path[i] not in '/\\':
@@ -303,7 +303,7 @@ def normpath(path):
comps[i-1] not in ('', '..'):
del comps[i-1:i+1]
i = i - 1
- elif comps[i] == '' and i > 0 and comps[i-1] <> '':
+ elif comps[i] == '' and i > 0 and comps[i-1] != '':
del comps[i]
elif '.' in comps[i]:
comp = comps[i].split('.')
diff --git a/Lib/filecmp.py b/Lib/filecmp.py
index e5024a4..eb98a71 100644
--- a/Lib/filecmp.py
+++ b/Lib/filecmp.py
@@ -199,7 +199,7 @@ class dircmp:
if ok:
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:
+ if a_type != b_type:
self.common_funny.append(x)
elif stat.S_ISDIR(a_type):
self.common_dirs.append(x)
@@ -317,7 +317,8 @@ def demo():
import sys
import getopt
options, args = getopt.getopt(sys.argv[1:], 'r')
- if len(args) <> 2: raise getopt.error, 'need exactly two args'
+ if len(args) != 2:
+ raise getopt.error, 'need exactly two args'
dd = dircmp(args[0], args[1])
if ('-r', '') in options:
dd.report_full_closure()
diff --git a/Lib/ftplib.py b/Lib/ftplib.py
index 429e834..df28200 100644
--- a/Lib/ftplib.py
+++ b/Lib/ftplib.py
@@ -185,7 +185,7 @@ class FTP:
nextline = self.getline()
line = line + ('\n' + nextline)
if nextline[:3] == code and \
- nextline[3:4] <> '-':
+ nextline[3:4] != '-':
break
return line
@@ -207,7 +207,7 @@ class FTP:
def voidresp(self):
"""Expect a response beginning with '2'."""
resp = self.getresp()
- if resp[0] <> '2':
+ if resp[0] != '2':
raise error_reply, resp
return resp
@@ -277,14 +277,14 @@ class FTP:
if rest is not None:
self.sendcmd("REST %s" % rest)
resp = self.sendcmd(cmd)
- if resp[0] <> '1':
+ if resp[0] != '1':
raise error_reply, resp
else:
sock = self.makeport()
if rest is not None:
self.sendcmd("REST %s" % rest)
resp = self.sendcmd(cmd)
- if resp[0] <> '1':
+ if resp[0] != '1':
raise error_reply, resp
conn, sockaddr = sock.accept()
if resp[:3] == '150':
@@ -318,7 +318,7 @@ class FTP:
resp = self.sendcmd('USER ' + user)
if resp[0] == '3': resp = self.sendcmd('PASS ' + passwd)
if resp[0] == '3': resp = self.sendcmd('ACCT ' + acct)
- if resp[0] <> '2':
+ if resp[0] != '2':
raise error_reply, resp
return resp
@@ -384,7 +384,7 @@ class FTP:
while 1:
buf = fp.readline()
if not buf: break
- if buf[-2:] <> CRLF:
+ if buf[-2:] != CRLF:
if buf[-1] in CRLF: buf = buf[:-1]
buf = buf + CRLF
conn.send(buf)
@@ -423,7 +423,7 @@ class FTP:
def rename(self, fromname, toname):
'''Rename a file.'''
resp = self.sendcmd('RNFR ' + fromname)
- if resp[0] <> '3':
+ if resp[0] != '3':
raise error_reply, resp
return self.voidcmd('RNTO ' + toname)
@@ -508,7 +508,7 @@ def parse227(resp):
Raises error_proto if it does not contain '(h1,h2,h3,h4,p1,p2)'
Return ('host.addr.as.numbers', port#) tuple.'''
- if resp[:3] <> '227':
+ if resp[:3] != '227':
raise error_reply, resp
left = string.find(resp, '(')
if left < 0: raise error_proto, resp
@@ -516,7 +516,7 @@ def parse227(resp):
if right < 0:
raise error_proto, resp # should contain '(h1,h2,h3,h4,p1,p2)'
numbers = string.split(resp[left+1:right], ',')
- if len(numbers) <> 6:
+ if len(numbers) != 6:
raise error_proto, resp
host = string.join(numbers[:4], '.')
port = (string.atoi(numbers[4]) << 8) + string.atoi(numbers[5])
@@ -528,9 +528,9 @@ def parse257(resp):
This is a response to a MKD or PWD request: a directory name.
Returns the directoryname in the 257 reply.'''
- if resp[:3] <> '257':
+ if resp[:3] != '257':
raise error_reply, resp
- if resp[3:5] <> ' "':
+ if resp[3:5] != ' "':
return '' # Not compliant to RFC 959, but UNIX ftpd does this
dirname = ''
i = 5
@@ -539,7 +539,7 @@ def parse257(resp):
c = resp[i]
i = i+1
if c == '"':
- if i >= n or resp[i] <> '"':
+ if i >= n or resp[i] != '"':
break
i = i+1
dirname = dirname + c
diff --git a/Lib/imputil.py b/Lib/imputil.py
index d442d9f..0dd7b51 100644
--- a/Lib/imputil.py
+++ b/Lib/imputil.py
@@ -434,7 +434,7 @@ def _os_bootstrap():
path = s
if ':' not in a:
a = ':' + a
- if a[-1:] <> ':':
+ if a[-1:] != ':':
a = a + ':'
return a + b
else:
@@ -643,7 +643,7 @@ def _test_revamp():
# from Guido:
# 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
+# watch out for sys.modules[...] is None
# flag to force absolute imports? (speeds _determine_import_context and
# checking for a relative module)
# insert names of archives into sys.path (see quote below)
diff --git a/Lib/linecache.py b/Lib/linecache.py
index bca40b2..c39f8db 100644
--- a/Lib/linecache.py
+++ b/Lib/linecache.py
@@ -50,7 +50,7 @@ def checkcache():
except os.error:
del cache[filename]
continue
- if size <> stat[ST_SIZE] or mtime <> stat[ST_MTIME]:
+ if size != stat[ST_SIZE] or mtime != stat[ST_MTIME]:
del cache[filename]
diff --git a/Lib/macpath.py b/Lib/macpath.py
index 12eec0c..bf2660f 100644
--- a/Lib/macpath.py
+++ b/Lib/macpath.py
@@ -17,7 +17,7 @@ def isabs(s):
Anything else is absolute (the string up to the first colon is the
volume name)."""
- return ':' in s and s[0] <> ':'
+ return ':' in s and s[0] != ':'
def join(s, *p):
@@ -30,7 +30,7 @@ def join(s, *p):
t = t[1:]
if ':' not in path:
path = ':' + path
- if path[-1:] <> ':':
+ if path[-1:] != ':':
path = path + ':'
path = path + t
return path
@@ -151,7 +151,7 @@ def commonprefix(m):
prefix = m[0]
for item in m:
for i in range(len(prefix)):
- if prefix[:i+1] <> item[:i+1]:
+ if prefix[:i+1] != item[:i+1]:
prefix = prefix[:i]
if i == 0: return ''
break
diff --git a/Lib/macurl2path.py b/Lib/macurl2path.py
index c971eda..9daeae4 100644
--- a/Lib/macurl2path.py
+++ b/Lib/macurl2path.py
@@ -12,7 +12,7 @@ def url2pathname(pathname):
# XXXX The .. handling should be fixed...
#
tp = urllib.splittype(pathname)[0]
- if tp and tp <> 'file':
+ if tp and tp != 'file':
raise RuntimeError, 'Cannot convert non-local URL to pathname'
# Turn starting /// into /, an empty hostname means current host
if pathname[:3] == '///':
@@ -29,7 +29,7 @@ def url2pathname(pathname):
components[i-1] not in ('', '..'):
del components[i-1:i+1]
i = i-1
- elif components[i] == '' and i > 0 and components[i-1] <> '':
+ elif components[i] == '' and i > 0 and components[i-1] != '':
del components[i]
else:
i = i+1
diff --git a/Lib/mailbox.py b/Lib/mailbox.py
index c92e145..53b2c19 100755
--- a/Lib/mailbox.py
+++ b/Lib/mailbox.py
@@ -30,7 +30,7 @@ class _Mailbox:
start = self.fp.tell()
self._search_end()
self.seekp = stop = self.fp.tell()
- if start <> stop:
+ if start != stop:
break
return rfc822.Message(_Subfile(self.fp, start, stop))
diff --git a/Lib/mailcap.py b/Lib/mailcap.py
index 636f2dd..9756594 100644
--- a/Lib/mailcap.py
+++ b/Lib/mailcap.py
@@ -173,7 +173,7 @@ def subst(field, MIMEtype, filename, plist=[]):
i, n = 0, len(field)
while i < n:
c = field[i]; i = i+1
- if c <> '%':
+ if c != '%':
if c == '\\':
c = field[i:i+1]; i = i+1
res = res + c
@@ -187,7 +187,7 @@ def subst(field, MIMEtype, filename, plist=[]):
res = res + MIMEtype
elif c == '{':
start = i
- while i < n and field[i] <> '}':
+ while i < n and field[i] != '}':
i = i+1
name = field[start:i]
i = i+1
diff --git a/Lib/mhlib.py b/Lib/mhlib.py
index df538f2..f5ece05 100644
--- a/Lib/mhlib.py
+++ b/Lib/mhlib.py
@@ -305,7 +305,7 @@ class Folder:
line = f.readline()
if not line: break
fields = string.splitfields(line, ':')
- if len(fields) <> 2:
+ if len(fields) != 2:
self.error('bad sequence in %s: %s' %
(fullname, string.strip(line)))
key = string.strip(fields[0])
diff --git a/Lib/mimetools.py b/Lib/mimetools.py
index da955af..abdfa62 100644
--- a/Lib/mimetools.py
+++ b/Lib/mimetools.py
@@ -22,7 +22,7 @@ class Message(rfc822.Message):
def parsetype(self):
str = self.typeheader
- if str == None:
+ if str is None:
str = 'text/plain'
if ';' in str:
i = string.index(str, ';')
@@ -75,7 +75,7 @@ class Message(rfc822.Message):
return result
def getencoding(self):
- if self.encodingheader == None:
+ if self.encodingheader is None:
return '7bit'
return string.lower(self.encodingheader)
@@ -109,7 +109,7 @@ def choose_boundary():
global _prefix
import time
import random
- if _prefix == None:
+ if _prefix is None:
import socket
import os
hostid = socket.gethostbyname(socket.gethostname())
diff --git a/Lib/multifile.py b/Lib/multifile.py
index e43d331..54de947 100644
--- a/Lib/multifile.py
+++ b/Lib/multifile.py
@@ -155,7 +155,7 @@ class MultiFile:
self.lastpos = abslastpos - self.start
def is_data(self, line):
- return line[:2] <> '--'
+ return line[:2] != '--'
def section_divider(self, str):
return "--" + str
diff --git a/Lib/netrc.py b/Lib/netrc.py
index c46ba73..e3374b0 100644
--- a/Lib/netrc.py
+++ b/Lib/netrc.py
@@ -17,7 +17,7 @@ class netrc:
while 1:
# Look for a machine, default, or macdef top-level keyword
toplevel = tt = lexer.get_token()
- if tt == '' or tt == None:
+ if not tt:
break
elif tt == 'machine':
entryname = lexer.get_token()
diff --git a/Lib/nntplib.py b/Lib/nntplib.py
index 7a90543..526677a 100644
--- a/Lib/nntplib.py
+++ b/Lib/nntplib.py
@@ -258,7 +258,7 @@ class NNTP:
- name: the group name"""
resp = self.shortcmd('GROUP ' + name)
- if resp[:3] <> '211':
+ if resp[:3] != '211':
raise NNTPReplyError(resp)
words = string.split(resp)
count = first = last = 0
@@ -282,7 +282,7 @@ class NNTP:
def statparse(self, resp):
"""Internal: parse the response of a STAT, NEXT or LAST command."""
- if resp[:2] <> '22':
+ if resp[:2] != '22':
raise NNTPReplyError(resp)
words = string.split(resp)
nr = 0
@@ -429,7 +429,7 @@ class NNTP:
path: directory path to article"""
resp = self.shortcmd("XPATH " + id)
- if resp[:3] <> '223':
+ if resp[:3] != '223':
raise NNTPReplyError(resp)
try:
[resp_num, path] = string.split(resp)
@@ -447,7 +447,7 @@ class NNTP:
time: Time suitable for newnews/newgroups commands etc."""
resp = self.shortcmd("DATE")
- if resp[:3] <> '111':
+ if resp[:3] != '111':
raise NNTPReplyError(resp)
elem = string.split(resp)
if len(elem) != 2:
@@ -467,7 +467,7 @@ class NNTP:
resp = self.shortcmd('POST')
# Raises error_??? if posting is not allowed
- if resp[0] <> '3':
+ if resp[0] != '3':
raise NNTPReplyError(resp)
while 1:
line = f.readline()
@@ -491,7 +491,7 @@ class NNTP:
resp = self.shortcmd('IHAVE ' + id)
# Raises error_??? if the server already has it
- if resp[0] <> '3':
+ if resp[0] != '3':
raise NNTPReplyError(resp)
while 1:
line = f.readline()
diff --git a/Lib/ntpath.py b/Lib/ntpath.py
index efcba6d..c1f4df7 100644
--- a/Lib/ntpath.py
+++ b/Lib/ntpath.py
@@ -160,7 +160,7 @@ def commonprefix(m):
prefix = m[0]
for item in m:
for i in range(len(prefix)):
- if prefix[:i+1] <> item[:i+1]:
+ if prefix[:i+1] != item[:i+1]:
prefix = prefix[:i]
if i == 0: return ''
break
@@ -283,7 +283,7 @@ def expanduser(path):
"""Expand ~ and ~user constructs.
If user or $HOME is unknown, do nothing."""
- if path[:1] <> '~':
+ if path[:1] != '~':
return path
i, n = 1, len(path)
while i < n and path[i] not in '/\\':
@@ -387,7 +387,7 @@ def normpath(path):
elif comps[i] == '..' and i > 0 and comps[i-1] not in ('', '..'):
del comps[i-1:i+1]
i = i - 1
- elif comps[i] == '' and i > 0 and comps[i-1] <> '':
+ elif comps[i] == '' and i > 0 and comps[i-1] != '':
del comps[i]
else:
i = i + 1
diff --git a/Lib/pdb.py b/Lib/pdb.py
index db4a2cd..f4a0c89 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -553,7 +553,7 @@ class Pdb(bdb.Bdb, cmd.Cmd):
first = max(1, self.curframe.f_lineno - 5)
else:
first = self.lineno + 1
- if last == None:
+ if last is None:
last = first + 10
filename = self.curframe.f_code.co_filename
breaklist = self.get_file_breaks(filename)
@@ -895,7 +895,8 @@ def set_trace():
def post_mortem(t):
p = Pdb()
p.reset()
- while t.tb_next <> None: t = t.tb_next
+ while t.tb_next is not None:
+ t = t.tb_next
p.interaction(t.tb_frame, t)
def pm():
diff --git a/Lib/pipes.py b/Lib/pipes.py
index 4057fac..3aa1bf1 100644
--- a/Lib/pipes.py
+++ b/Lib/pipes.py
@@ -110,7 +110,7 @@ class Template:
def append(self, cmd, kind):
"""t.append(cmd, kind) adds a new step at the end."""
- if type(cmd) <> type(''):
+ if type(cmd) is not type(''):
raise TypeError, \
'Template.append: cmd must be a string'
if kind not in stepkinds:
@@ -119,7 +119,7 @@ class Template:
if kind == SOURCE:
raise ValueError, \
'Template.append: SOURCE can only be prepended'
- if self.steps <> [] and self.steps[-1][1] == SINK:
+ if self.steps and self.steps[-1][1] == SINK:
raise ValueError, \
'Template.append: already ends with SINK'
if kind[0] == 'f' and not re.search('\$IN\b', cmd):
@@ -132,7 +132,7 @@ class Template:
def prepend(self, cmd, kind):
"""t.prepend(cmd, kind) adds a new step at the front."""
- if type(cmd) <> type(''):
+ if type(cmd) is not type(''):
raise TypeError, \
'Template.prepend: cmd must be a string'
if kind not in stepkinds:
@@ -141,7 +141,7 @@ class Template:
if kind == SINK:
raise ValueError, \
'Template.prepend: SINK can only be appended'
- if self.steps <> [] and self.steps[0][1] == SOURCE:
+ if self.steps and self.steps[0][1] == SOURCE:
raise ValueError, \
'Template.prepend: already begins with SOURCE'
if kind[0] == 'f' and not re.search('\$IN\b', cmd):
@@ -165,7 +165,7 @@ class Template:
def open_r(self, file):
"""t.open_r(file) and t.open_w(file) implement
t.open(file, 'r') and t.open(file, 'w') respectively."""
- if self.steps == []:
+ if not self.steps:
return open(file, 'r')
if self.steps[-1][1] == SINK:
raise ValueError, \
@@ -174,7 +174,7 @@ class Template:
return os.popen(cmd, 'r')
def open_w(self, file):
- if self.steps == []:
+ if not self.steps:
return open(file, 'w')
if self.steps[0][1] == SOURCE:
raise ValueError, \
@@ -203,7 +203,7 @@ def makepipeline(infile, steps, outfile):
#
# Make sure there is at least one step
#
- if list == []:
+ if not list:
list.append(['', 'cat', '--', ''])
#
# Take care of the input and output ends
diff --git a/Lib/posixpath.py b/Lib/posixpath.py
index 2826604..32850b4 100644
--- a/Lib/posixpath.py
+++ b/Lib/posixpath.py
@@ -59,7 +59,7 @@ def split(p):
everything after the final slash. Either part may be empty."""
i = p.rfind('/') + 1
head, tail = p[:i], p[i:]
- if head and head <> '/'*len(head):
+ if head and head != '/'*len(head):
while head[-1] == '/':
head = head[:-1]
return head, tail
@@ -120,7 +120,7 @@ def commonprefix(m):
prefix = m[0]
for item in m:
for i in range(len(prefix)):
- if prefix[:i+1] <> item[:i+1]:
+ if prefix[:i+1] != item[:i+1]:
prefix = prefix[:i]
if i == 0: return ''
break
@@ -281,10 +281,10 @@ def walk(top, func, arg):
def expanduser(path):
"""Expand ~ and ~user constructions. If user or $HOME is unknown,
do nothing."""
- if path[:1] <> '~':
+ if path[:1] != '~':
return path
i, n = 1, len(path)
- while i < n and path[i] <> '/':
+ while i < n and path[i] != '/':
i = i + 1
if i == 1:
if not os.environ.has_key('HOME'):
diff --git a/Lib/quopri.py b/Lib/quopri.py
index b449792..80fc6f9 100755
--- a/Lib/quopri.py
+++ b/Lib/quopri.py
@@ -69,7 +69,7 @@ def decode(input, output):
partial = 1
while i < n:
c = line[i]
- if c <> ESCAPE:
+ if c != ESCAPE:
new = new + c; i = i+1
elif i+1 == n and not partial:
partial = 1; break
diff --git a/Lib/regsub.py b/Lib/regsub.py
index 8e341bb..dc95028 100644
--- a/Lib/regsub.py
+++ b/Lib/regsub.py
@@ -124,7 +124,7 @@ def capwords(str, pat='[^a-zA-Z0-9_]+'):
cache = {}
def compile(pat):
- if type(pat) <> type(''):
+ if type(pat) != type(''):
return pat # Assume it is a compiled regex
key = (pat, regex.get_syntax())
if cache.has_key(key):
@@ -153,7 +153,7 @@ def expand(repl, regs, str):
ord0 = ord('0')
while i < len(repl):
c = repl[i]; i = i+1
- if c <> '\\' or i >= len(repl):
+ if c != '\\' or i >= len(repl):
new = new + c
else:
c = repl[i]; i = i+1
@@ -182,7 +182,7 @@ def test():
if not line: break
if line[-1] == '\n': line = line[:-1]
fields = split(line, delpat)
- if len(fields) <> 3:
+ if len(fields) != 3:
print 'Sorry, not three fields'
print 'split:', `fields`
continue
diff --git a/Lib/sgmllib.py b/Lib/sgmllib.py
index d7e8319..c1467b0 100644
--- a/Lib/sgmllib.py
+++ b/Lib/sgmllib.py
@@ -185,7 +185,7 @@ class SGMLParser:
# Internal -- parse comment, return length or -1 if not terminated
def parse_comment(self, i):
rawdata = self.rawdata
- if rawdata[i:i+4] <> '<!--':
+ if rawdata[i:i+4] != '<!--':
raise RuntimeError, 'unexpected call to handle_comment'
match = commentclose.search(rawdata, i+4)
if not match:
@@ -198,7 +198,7 @@ class SGMLParser:
# Internal -- parse processing instr, return length or -1 if not terminated
def parse_pi(self, i):
rawdata = self.rawdata
- if rawdata[i:i+2] <> '<?':
+ if rawdata[i:i+2] != '<?':
raise RuntimeError, 'unexpected call to handle_pi'
match = piclose.search(rawdata, i+2)
if not match:
diff --git a/Lib/smtplib.py b/Lib/smtplib.py
index 77cd223..064a9f8 100755
--- a/Lib/smtplib.py
+++ b/Lib/smtplib.py
@@ -319,7 +319,7 @@ class SMTP:
if code == -1 and len(msg) == 0:
raise SMTPServerDisconnected("Server not connected")
self.ehlo_resp=msg
- if code<>250:
+ if code != 250:
return (code,msg)
self.does_esmtp=1
#parse the ehlo response -ddm
@@ -378,7 +378,7 @@ class SMTP:
self.putcmd("data")
(code,repl)=self.getreply()
if self.debuglevel >0 : print "data:", (code,repl)
- if code <> 354:
+ if code != 354:
raise SMTPDataError(code,repl)
else:
q = quotedata(msg)
@@ -475,7 +475,7 @@ class SMTP:
esmtp_opts.append(option)
(code,resp) = self.mail(from_addr, esmtp_opts)
- if code <> 250:
+ if code != 250:
self.rset()
raise SMTPSenderRefused(code, resp, from_addr)
senderrs={}
@@ -483,14 +483,14 @@ class SMTP:
to_addrs = [to_addrs]
for each in to_addrs:
(code,resp)=self.rcpt(each, rcpt_options)
- if (code <> 250) and (code <> 251):
+ if (code != 250) and (code != 251):
senderrs[each]=(code,resp)
if len(senderrs)==len(to_addrs):
# the server refused all our recipients
self.rset()
raise SMTPRecipientsRefused(senderrs)
- (code,resp)=self.data(msg)
- if code <> 250:
+ (code,resp) = self.data(msg)
+ if code != 250:
self.rset()
raise SMTPDataError(code, resp)
#if we got here then somebody got our mail
diff --git a/Lib/sndhdr.py b/Lib/sndhdr.py
index b2cdd30..b20a696 100644
--- a/Lib/sndhdr.py
+++ b/Lib/sndhdr.py
@@ -56,7 +56,7 @@ tests = []
def test_aifc(h, f):
import aifc
- if h[:4] <> 'FORM':
+ if h[:4] != 'FORM':
return None
if h[8:12] == 'AIFC':
fmt = 'aifc'
@@ -105,7 +105,7 @@ tests.append(test_au)
def test_hcom(h, f):
- if h[65:69] <> 'FSSD' or h[128:132] <> 'HCOM':
+ if h[65:69] != 'FSSD' or h[128:132] != 'HCOM':
return None
divisor = get_long_be(h[128+16:128+20])
return 'hcom', 22050/divisor, 1, -1, 8
@@ -114,7 +114,7 @@ tests.append(test_hcom)
def test_voc(h, f):
- if h[:20] <> 'Creative Voice File\032':
+ if h[:20] != 'Creative Voice File\032':
return None
sbseek = get_short_le(h[20:22])
rate = 0
@@ -128,7 +128,7 @@ tests.append(test_voc)
def test_wav(h, f):
# 'RIFF' <len> 'WAVE' 'fmt ' <len>
- if h[:4] <> 'RIFF' or h[8:12] <> 'WAVE' or h[12:16] <> 'fmt ':
+ if h[:4] != 'RIFF' or h[8:12] != 'WAVE' or h[12:16] != 'fmt ':
return None
style = get_short_le(h[20:22])
nchannels = get_short_le(h[22:24])
@@ -140,7 +140,7 @@ tests.append(test_wav)
def test_8svx(h, f):
- if h[:4] <> 'FORM' or h[8:12] <> '8SVX':
+ if h[:4] != 'FORM' or h[8:12] != '8SVX':
return None
# Should decode it to get #channels -- assume always 1
return '8svx', 0, 1, 0, 8
diff --git a/Lib/statcache.py b/Lib/statcache.py
index b5147c2..26f90942 100644
--- a/Lib/statcache.py
+++ b/Lib/statcache.py
@@ -43,10 +43,10 @@ def forget_prefix(prefix):
def forget_dir(prefix):
"""Forget about a directory and all entries in it, but not about
entries in subdirectories."""
- if prefix[-1:] == '/' and prefix <> '/':
+ if prefix[-1:] == '/' and prefix != '/':
prefix = prefix[:-1]
forget(prefix)
- if prefix[-1:] <> '/':
+ if prefix[-1:] != '/':
prefix = prefix + '/'
n = len(prefix)
for path in cache.keys():
@@ -62,7 +62,7 @@ def forget_except_prefix(prefix):
Normally used with prefix = '/' after a chdir()."""
n = len(prefix)
for path in cache.keys():
- if path[:n] <> prefix:
+ if path[:n] != prefix:
del cache[path]
diff --git a/Lib/sunaudio.py b/Lib/sunaudio.py
index cbd17d2..87dc6ee 100644
--- a/Lib/sunaudio.py
+++ b/Lib/sunaudio.py
@@ -13,7 +13,7 @@ def get_long_be(s):
def gethdr(fp):
"""Read a sound header from an open file."""
- if fp.read(4) <> MAGIC:
+ if fp.read(4) != MAGIC:
raise error, 'gethdr: bad magic word'
hdr_size = get_long_be(fp.read(4))
data_size = get_long_be(fp.read(4))
diff --git a/Lib/toaiff.py b/Lib/toaiff.py
index 52c5a89..25be46f 100644
--- a/Lib/toaiff.py
+++ b/Lib/toaiff.py
@@ -63,7 +63,7 @@ def toaiff(filename):
ret = _toaiff(filename, temps)
finally:
for temp in temps[:]:
- if temp <> ret:
+ if temp != ret:
try:
os.unlink(temp)
except os.error:
@@ -88,12 +88,12 @@ def _toaiff(filename, temps):
if type(msg) == type(()) and len(msg) == 2 and \
type(msg[0]) == type(0) and type(msg[1]) == type(''):
msg = msg[1]
- if type(msg) <> type(''):
+ if type(msg) != type(''):
msg = `msg`
raise error, filename + ': ' + msg
if ftype == 'aiff':
return fname
- if ftype == None or not table.has_key(ftype):
+ if ftype is None or not table.has_key(ftype):
raise error, \
filename + ': unsupported audio file type ' + `ftype`
temp = tempfile.mktemp()
diff --git a/Lib/tzparse.py b/Lib/tzparse.py
index fa94bd5..27f1fa1 100644
--- a/Lib/tzparse.py
+++ b/Lib/tzparse.py
@@ -16,7 +16,7 @@ def tzparse(tzstr):
timezone, and 'daystart'/'hourstart' and 'dayend'/'hourend'
specify the starting and ending points for daylight saving time."""
global tzprog
- if tzprog == None:
+ if tzprog is None:
import re
tzprog = re.compile(tzpat)
match = tzprog.match(tzstr)
diff --git a/Lib/uu.py b/Lib/uu.py
index e39b61b..3856d69 100755
--- a/Lib/uu.py
+++ b/Lib/uu.py
@@ -46,9 +46,9 @@ def encode(in_file, out_file, name=None, mode=None):
if in_file == '-':
in_file = sys.stdin
elif type(in_file) == type(''):
- if name == None:
+ if name is None:
name = os.path.basename(in_file)
- if mode == None:
+ if mode is None:
try:
mode = os.stat(in_file)[0]
except AttributeError:
@@ -64,9 +64,9 @@ def encode(in_file, out_file, name=None, mode=None):
#
# Set defaults for name and mode
#
- if name == None:
+ if name is None:
name = '-'
- if mode == None:
+ if mode is None:
mode = 0666
#
# Write the data
@@ -104,9 +104,9 @@ def decode(in_file, out_file=None, mode=None):
break
except ValueError:
pass
- if out_file == None:
+ if out_file is None:
out_file = hdrfields[2]
- if mode == None:
+ if mode is None:
mode = string.atoi(hdrfields[1], 8)
#
# Open the output file
diff --git a/Lib/xdrlib.py b/Lib/xdrlib.py
index 290d92e..c97975d 100644
--- a/Lib/xdrlib.py
+++ b/Lib/xdrlib.py
@@ -95,7 +95,7 @@ class Packer:
self.pack_uint(0)
def pack_farray(self, n, list, pack_item):
- if len(list) <> n:
+ if len(list) != n:
raise ValueError, 'wrong array size'
for item in list:
pack_item(item)
@@ -204,7 +204,7 @@ class Unpacker:
while 1:
x = self.unpack_uint()
if x == 0: break
- if x <> 1:
+ if x != 1:
raise ConversionError, '0 or 1 expected, got ' + `x`
item = unpack_item()
list.append(item)
diff --git a/Lib/xmllib.py b/Lib/xmllib.py
index 2f92556..8bca0fc 100644
--- a/Lib/xmllib.py
+++ b/Lib/xmllib.py
@@ -421,7 +421,7 @@ class XMLParser:
# Internal -- parse comment, return length or -1 if not terminated
def parse_comment(self, i):
rawdata = self.rawdata
- if rawdata[i:i+4] <> '<!--':
+ if rawdata[i:i+4] != '<!--':
raise Error('unexpected call to handle_comment')
res = commentclose.search(rawdata, i+4)
if res is None:
@@ -487,7 +487,7 @@ class XMLParser:
# Internal -- handle CDATA tag, return length or -1 if not terminated
def parse_cdata(self, i):
rawdata = self.rawdata
- if rawdata[i:i+9] <> '<![CDATA[':
+ if rawdata[i:i+9] != '<![CDATA[':
raise Error('unexpected call to parse_cdata')
res = cdataclose.search(rawdata, i+9)
if res is None: