Reduce number of backslashes by using raw strings
authorKarl Hasselström <kha@treskal.com>
Tue, 5 Feb 2008 05:51:30 +0000 (06:51 +0100)
committerKarl Hasselström <kha@treskal.com>
Sun, 10 Feb 2008 14:46:37 +0000 (15:46 +0100)
Signed-off-by: Karl Hasselström <kha@treskal.com>
stgit/commands/common.py
stgit/commands/mail.py

index 7a7cb80..5a1952b 100644 (file)
@@ -269,7 +269,7 @@ def name_email(address):
     """Return a tuple consisting of the name and email parsed from a
     standard 'name <email>' 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 <email> 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 <email> date" string: %s' % address
index 7d19eca..f12d694 100644 (file)
@@ -27,7 +27,7 @@ from stgit.config import config
 
 
 help = 'send a patch or series of patches by e-mail'
-usage = """%prog [options] [<patch1>] [<patch2>] [<patch3>..<patch4>]
+usage = r"""%prog [options] [<patch1>] [<patch2>] [<patch3>..<patch4>]
 
 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