[PATCH] contib/nmbug/nmbug-status: leftover whitespaces, indentation & quoting
authorTomi Ollila <tomi.ollila@iki.fi>
Tue, 10 Jul 2012 22:29:11 +0000 (01:29 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:48:09 +0000 (09:48 -0800)
e3/0b2e929a0ea132b53c142a3e69034b1c26dd4a [new file with mode: 0644]

diff --git a/e3/0b2e929a0ea132b53c142a3e69034b1c26dd4a b/e3/0b2e929a0ea132b53c142a3e69034b1c26dd4a
new file mode 100644 (file)
index 0000000..b848ece
--- /dev/null
@@ -0,0 +1,151 @@
+Return-Path: <too@guru-group.fi>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id A7637431FC7\r
+       for <notmuch@notmuchmail.org>; Tue, 10 Jul 2012 15:29:08 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.379\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.379 tagged_above=-999 required=5\r
+       tests=[NO_DNS_FOR_FROM=0.379] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id 1RK8GjW-cGc3 for <notmuch@notmuchmail.org>;\r
+       Tue, 10 Jul 2012 15:29:04 -0700 (PDT)\r
+Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])\r
+       by olra.theworths.org (Postfix) with ESMTP id 8FED7431FAE\r
+       for <notmuch@notmuchmail.org>; Tue, 10 Jul 2012 15:29:04 -0700 (PDT)\r
+Received: by guru.guru-group.fi (Postfix, from userid 501)\r
+       id 3AE36100386; Wed, 11 Jul 2012 01:29:13 +0300 (EEST)\r
+From: Tomi Ollila <tomi.ollila@iki.fi>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH] contib/nmbug/nmbug-status: leftover whitespaces,\r
+       indentation & quoting\r
+Date: Wed, 11 Jul 2012 01:29:11 +0300\r
+Message-Id: <1341959351-16183-1-git-send-email-tomi.ollila@iki.fi>\r
+X-Mailer: git-send-email 1.7.1\r
+Cc: Tomi Ollila <tomi.ollila@iki.fi>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 10 Jul 2012 22:29:08 -0000\r
+\r
+The initial nmbug-status was pretty consistent in it's whitespacing\r
+but a few lines had some leftover slips. Those are now "corrected".\r
+\r
+Also, most of the code used ' as quoting char. As in Python one can\r
+use ' and " interchangeably some code used " instead of '. However\r
+the usage of those were inconsistent. Now all quotes that python\r
+parses are ':s (only quoted content uses ":s).\r
+\r
+No functional changes.\r
+---\r
+\r
+I tested that this produces identical output compared to the unpatched version.\r
+\r
+ contrib/nmbug/nmbug-status |   41 ++++++++++++++++++++---------------------\r
+ 1 files changed, 20 insertions(+), 21 deletions(-)\r
+\r
+diff --git a/contrib/nmbug/nmbug-status b/contrib/nmbug/nmbug-status\r
+index 6aa86a0..2abb3e4 100755\r
+--- a/contrib/nmbug/nmbug-status\r
++++ b/contrib/nmbug/nmbug-status\r
+@@ -18,10 +18,10 @@ import subprocess\r
+ # parse command line arguments\r
+ \r
+ parser = argparse.ArgumentParser()\r
+-parser.add_argument("--text", help="output plain text format",\r
+-                    action="store_true")\r
++parser.add_argument('--text', help='output plain text format',\r
++                    action='store_true')\r
+ \r
+-parser.add_argument("--config", help="load config from given file")\r
++parser.add_argument('--config', help='load config from given file')\r
+ \r
+ \r
+ args = parser.parse_args()\r
+@@ -31,18 +31,18 @@ args = parser.parse_args()\r
+ if args.config != None:\r
+     fp = open(args.config)\r
+ else:\r
+-    nmbhome = os.getenv('NMBGIT', os.path.expanduser("~/.nmbug"))\r
++    nmbhome = os.getenv('NMBGIT', os.path.expanduser('~/.nmbug'))\r
+ \r
+     # read only the first line from the pipe\r
+-    sha1 =  subprocess.Popen(['git', '--git-dir', nmbhome,\r
+-                     'show-ref', '-s', 'config'],\r
+-                      stdout=subprocess.PIPE).stdout.readline()\r
++    sha1 = subprocess.Popen(['git', '--git-dir', nmbhome,\r
++                             'show-ref', '-s', 'config'],\r
++                            stdout=subprocess.PIPE).stdout.readline()\r
+ \r
+     sha1 = sha1.rstrip()\r
+ \r
+-    fp =  subprocess.Popen(['git', '--git-dir', nmbhome,\r
+-                            'cat-file', 'blob', sha1+':status-config.json'],\r
+-                           stdout=subprocess.PIPE).stdout\r
++    fp = subprocess.Popen(['git', '--git-dir', nmbhome,\r
++                           'cat-file', 'blob', sha1+':status-config.json'],\r
++                          stdout=subprocess.PIPE).stdout\r
+ \r
+ config = json.load(fp)\r
+ \r
+@@ -60,11 +60,10 @@ def clear_last():\r
+ \r
+ def print_view(title, query, comment):\r
+ \r
+-    query_string = " and ".join(query)\r
++    query_string = ' and '.join(query)\r
+     q_new = notmuch.Query(db, query_string)\r
+     q_new.set_sort(notmuch.Query.SORT.OLDEST_FIRST)\r
+ \r
+-\r
+     last['thread_id'] = ''\r
+ \r
+     if output_format == 'html':\r
+@@ -94,7 +93,7 @@ def print_view(title, query, comment):\r
+                 val = rfc822.parseaddr(val)[0]\r
+ \r
+             if last[header] == val:\r
+-                out[header] = ""\r
++                out[header] = ''\r
+             else:\r
+                 out[header] = val.encode('utf-8')\r
+                 last[header] = val\r
+@@ -109,14 +108,14 @@ def print_view(title, query, comment):\r
+             else:\r
+                 br = ''\r
+                 out['subject'] = '<a href="http://mid.gmane.org/%s">%s</a>' \\r
+-                                        % (urllib.quote(mid), out['subject'])\r
+-\r
+-            print " <tr><td>%s %s" % (br, out['date'])\r
+-            print "</td><td>%s %s" % (br, out['id'])\r
+-            print "</td></tr>"\r
+-            print " <tr><td>%s" % out['from']\r
+-            print "</td><td>%s" % out['subject']\r
+-            print "</td></tr>\n"\r
++                    % (urllib.quote(mid), out['subject'])\r
++\r
++            print ' <tr><td>%s %s' % (br, out['date'])\r
++            print '</td><td>%s %s' % (br, out['id'])\r
++            print '</td></tr>'\r
++            print ' <tr><td>%s' % out['from']\r
++            print '</td><td>%s' % out['subject']\r
++            print '</td></tr>\n'\r
+         else:\r
+             print '%(date)-10.10s %(from)-20.20s %(subject)-40.40s\n%(id)72s\n' % out\r
+ \r
+-- \r
+1.7.1\r
+\r