From: Karl Hasselström Date: Tue, 5 Feb 2008 05:51:30 +0000 (+0100) Subject: Reduce number of backslashes by using raw strings X-Git-Tag: v0.15-rc1~286 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/77eeb7f4b04e5c3b73b3b0d30605f469f8e8d1b5 Reduce number of backslashes by using raw strings Signed-off-by: Karl Hasselström --- diff --git a/stgit/commands/common.py b/stgit/commands/common.py index 7a7cb80..5a1952b 100644 --- a/stgit/commands/common.py +++ b/stgit/commands/common.py @@ -269,7 +269,7 @@ def name_email(address): """Return a tuple consisting of the name and email parsed from a standard 'name ' or 'email (name)' string """ - address = re.sub('[\\\\"]', '\\\\\g<0>', address) + address = re.sub(r'[\\"]', r'\\\g<0>', address) str_list = re.findall('^(.*)\s*<(.*)>\s*$', address) if not str_list: str_list = re.findall('^(.*)\s*\((.*)\)\s*$', address) @@ -284,7 +284,7 @@ def name_email_date(address): """Return a tuple consisting of the name, email and date parsed from a 'name date' string """ - address = re.sub('[\\\\"]', '\\\\\g<0>', address) + address = re.sub(r'[\\"]', r'\\\g<0>', address) str_list = re.findall('^(.*)\s*<(.*)>\s*(.*)\s*$', address) if not str_list: raise CmdException, 'Incorrect "name date" string: %s' % address diff --git a/stgit/commands/mail.py b/stgit/commands/mail.py index 7d19eca..f12d694 100644 --- a/stgit/commands/mail.py +++ b/stgit/commands/mail.py @@ -27,7 +27,7 @@ from stgit.config import config help = 'send a patch or series of patches by e-mail' -usage = """%prog [options] [] [] [..] +usage = r"""%prog [options] [] [] [..] Send a patch or a range of patches by e-mail using the SMTP server specified by the 'stgit.smtpserver' configuration option, or the @@ -84,7 +84,7 @@ the following: %(commemail)s - committer's e-mail %(commname)s - committer's name %(diff)s - unified diff of the patch - %(fromauth)s - 'From: author\\n\\n' if different from sender + %(fromauth)s - 'From: author\n\n' if different from sender %(longdescr)s - the rest of the patch description, after the first line %(patch)s - patch name %(prefix)s - 'prefix ' string passed on the command line