cpython (3.2): Fix string exception and a few style issues in mailerdaemon script
http://hg.python.org/cpython/rev/94b1771dbe4b changeset: 71556:94b1771dbe4b branch: 3.2 user: Éric Araujo <merwok@netwok.org> date: Tue Jul 26 17:36:19 2011 +0200 summary: Fix string exception and a few style issues in mailerdaemon script files: Tools/scripts/mailerdaemon.py | 24 +++++++++++++++------- 1 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Tools/scripts/mailerdaemon.py b/Tools/scripts/mailerdaemon.py --- a/Tools/scripts/mailerdaemon.py +++ b/Tools/scripts/mailerdaemon.py @@ -1,4 +1,4 @@ -"""mailerdaemon - classes to parse mailer-daemon messages""" +"""Classes to parse mailer-daemon messages.""" import calendar import email.message @@ -6,7 +6,10 @@ import os import sys -Unparseable = 'mailerdaemon.Unparseable' + +class Unparseable(Exception): + pass + class ErrorMessage(email.message.Message): def __init__(self): @@ -18,8 +21,10 @@ if not sub: return 0 sub = sub.lower() - if sub.startswith('waiting mail'): return 1 - if 'warning' in sub: return 1 + if sub.startswith('waiting mail'): + return 1 + if 'warning' in sub: + return 1 self.sub = sub return 0 @@ -145,14 +150,17 @@ errors.append(' '.join((email.strip()+': '+reason).split())) return errors -EMPARSERS = [emparse_list, ] +EMPARSERS = [emparse_list] def sort_numeric(a, b): a = int(a) b = int(b) - if a < b: return -1 - elif a > b: return 1 - else: return 0 + if a < b: + return -1 + elif a > b: + return 1 + else: + return 0 def parsedir(dir, modify): os.chdir(dir) -- Repository URL: http://hg.python.org/cpython
participants (1)
-
eric.araujo