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