summaryrefslogtreecommitdiffstats
path: root/Lib/mhlib.py
diff options
context:
space:
mode:
authorCollin Winter <collinw@gmail.com>2007-08-30 01:19:48 (GMT)
committerCollin Winter <collinw@gmail.com>2007-08-30 01:19:48 (GMT)
commitce36ad8a467d914eb5c91f33835b9eaea18ee93b (patch)
tree05bf654f3359e20b455dc300bd860bba5d291c8d /Lib/mhlib.py
parent8b3febef2f96c35e9aad9db2ef499db040fdefae (diff)
downloadcpython-ce36ad8a467d914eb5c91f33835b9eaea18ee93b.zip
cpython-ce36ad8a467d914eb5c91f33835b9eaea18ee93b.tar.gz
cpython-ce36ad8a467d914eb5c91f33835b9eaea18ee93b.tar.bz2
Raise statement normalization in Lib/.
Diffstat (limited to 'Lib/mhlib.py')
-rw-r--r--Lib/mhlib.py44
1 files changed, 22 insertions, 22 deletions
diff --git a/Lib/mhlib.py b/Lib/mhlib.py
index c06e1a6..955862b 100644
--- a/Lib/mhlib.py
+++ b/Lib/mhlib.py
@@ -104,7 +104,7 @@ class MH:
if not os.path.isabs(path) and path[0] != '~':
path = os.path.join('~', path)
path = os.path.expanduser(path)
- if not os.path.isdir(path): raise Error, 'MH() path not found'
+ if not os.path.isdir(path): raise Error('MH() path not found')
self.path = path
def __repr__(self):
@@ -243,7 +243,7 @@ class Folder:
self.mh = mh
self.name = name
if not os.path.isdir(self.getfullname()):
- raise Error, 'no folder %s' % name
+ raise Error('no folder %s' % name)
def __repr__(self):
"""String representation."""
@@ -332,7 +332,7 @@ class Folder:
try:
return max(seqs['cur'])
except (ValueError, KeyError):
- raise Error, "no cur message"
+ raise Error("no cur message")
def setcurrent(self, n):
"""Set the current message."""
@@ -350,7 +350,7 @@ class Folder:
all = self.listmessages()
# Observed behavior: test for empty folder is done first
if not all:
- raise Error, "no messages in %s" % self.name
+ raise Error("no messages in %s" % self.name)
# Common case first: all is frequently the default
if seq == 'all':
return all
@@ -361,7 +361,7 @@ class Folder:
if tail[:1] in '-+':
dir, tail = tail[:1], tail[1:]
if not isnumeric(tail):
- raise Error, "bad message list %s" % seq
+ raise Error("bad message list %s" % seq)
try:
count = int(tail)
except (ValueError, OverflowError):
@@ -374,10 +374,10 @@ class Folder:
if not head in seqs:
if not msg:
msg = "bad message list %s" % seq
- raise Error, msg, sys.exc_info()[2]
+ raise Error(msg).with_traceback(sys.exc_info()[2])
msgs = seqs[head]
if not msgs:
- raise Error, "sequence %s empty" % head
+ raise Error("sequence %s empty" % head)
if dir == '-':
return msgs[-count:]
else:
@@ -401,7 +401,7 @@ class Folder:
j = bisect(all, end)
r = all[i:j]
if not r:
- raise Error, "bad message list %s" % seq
+ raise Error("bad message list %s" % seq)
return r
# Neither X:Y nor X-Y; must be a number or a (pseudo-)sequence
try:
@@ -411,14 +411,14 @@ class Folder:
if not seq in seqs:
if not msg:
msg = "bad message list %s" % seq
- raise Error, msg
+ raise Error(msg)
return seqs[seq]
else:
if n not in all:
if isnumeric(seq):
- raise Error, "message %d doesn't exist" % n
+ raise Error("message %d doesn't exist" % n)
else:
- raise Error, "no %s message" % seq
+ raise Error("no %s message" % seq)
else:
return [n]
@@ -441,17 +441,17 @@ class Folder:
try:
return all[i]
except IndexError:
- raise Error, "no next message"
+ raise Error("no next message")
if seq == 'prev':
n = self.getcurrent()
i = bisect(all, n-1)
if i == 0:
- raise Error, "no prev message"
+ raise Error("no prev message")
try:
return all[i-1]
except IndexError:
- raise Error, "no prev message"
- raise Error, None
+ raise Error("no prev message")
+ raise Error()
def openmessage(self, n):
"""Open a message -- returns a Message object."""
@@ -478,9 +478,9 @@ class Folder:
self.removefromallsequences(deleted)
if errors:
if len(errors) == 1:
- raise os.error, errors[0]
+ raise os.error(errors[0])
else:
- raise os.error, ('multiple errors:', errors)
+ raise os.error('multiple errors:', errors)
def refilemessages(self, list, tofolder, keepsequences=0):
"""Refile one or more messages -- may raise os.error.
@@ -513,9 +513,9 @@ class Folder:
self.removefromallsequences(refiled.keys())
if errors:
if len(errors) == 1:
- raise os.error, errors[0]
+ raise os.error(errors[0])
else:
- raise os.error, ('multiple errors:', errors)
+ raise os.error('multiple errors:', errors)
def _copysequences(self, fromfolder, refileditems):
"""Helper for refilemessages() to copy sequences."""
@@ -706,10 +706,10 @@ class Message(mimetools.Message):
list of SubMessage objects. Each submessage object behaves
(almost) as a Message object."""
if self.getmaintype() != 'multipart':
- raise Error, 'Content-Type is not multipart/*'
+ raise Error('Content-Type is not multipart/*')
bdry = self.getparam('boundary')
if not bdry:
- raise Error, 'multipart/* without boundary param'
+ raise Error('multipart/* without boundary param')
self.fp.seek(self.startofbody)
mf = multifile.MultiFile(self.fp)
mf.push(bdry)
@@ -890,7 +890,7 @@ class IntSet:
elif len(list) == 2 and list[0] <= list[1]:
new.append((list[0], list[1]))
else:
- raise ValueError, 'bad data passed to IntSet'
+ raise ValueError('bad data passed to IntSet')
self.pairs = self.pairs + new
self.normalize()