unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] contib/nmbug/nmbug-status: leftover whitespaces, indentation & quoting
@ 2012-07-10 22:29 Tomi Ollila
  2012-07-11  9:10 ` [PATCH 1/2] contrib/nmbug/ nmbug-status: restored out['subject']... block level Tomi Ollila
  2012-07-11  9:10 ` [PATCH 2/2] contib/nmbug/nmbug-status: leftover whitespaces, indentation & quoting Tomi Ollila
  0 siblings, 2 replies; 5+ messages in thread
From: Tomi Ollila @ 2012-07-10 22:29 UTC (permalink / raw)
  To: notmuch; +Cc: Tomi Ollila

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'] = '<a href="http://mid.gmane.org/%s">%s</a>' \
-                                        % (urllib.quote(mid), out['subject'])
-
-            print " <tr><td>%s %s" % (br, out['date'])
-            print "</td><td>%s %s" % (br, out['id'])
-            print "</td></tr>"
-            print " <tr><td>%s" % out['from']
-            print "</td><td>%s" % out['subject']
-            print "</td></tr>\n"
+                    % (urllib.quote(mid), out['subject'])
+
+            print ' <tr><td>%s %s' % (br, out['date'])
+            print '</td><td>%s %s' % (br, out['id'])
+            print '</td></tr>'
+            print ' <tr><td>%s' % out['from']
+            print '</td><td>%s' % out['subject']
+            print '</td></tr>\n'
         else:
             print '%(date)-10.10s %(from)-20.20s %(subject)-40.40s\n%(id)72s\n' % out
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 1/2] contrib/nmbug/ nmbug-status: restored out['subject']... block level
  2012-07-10 22:29 [PATCH] contib/nmbug/nmbug-status: leftover whitespaces, indentation & quoting Tomi Ollila
@ 2012-07-11  9:10 ` Tomi Ollila
  2012-07-11 11:59   ` Tomi Ollila
  2012-07-12 22:09   ` David Bremner
  2012-07-11  9:10 ` [PATCH 2/2] contib/nmbug/nmbug-status: leftover whitespaces, indentation & quoting Tomi Ollila
  1 sibling, 2 replies; 5+ messages in thread
From: Tomi Ollila @ 2012-07-11  9:10 UTC (permalink / raw)
  To: notmuch; +Cc: Tomi Ollila

In reformatting the line 111 accidentally indented to one indentation
level too much (happens easily when interactively indenting python
code using emacs). The line now has 4 spacess less indentation, thus
restoring it to the block level it belongs.
---
 contrib/nmbug/nmbug-status |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/contrib/nmbug/nmbug-status b/contrib/nmbug/nmbug-status
index 6aa86a0..8c6377e 100755
--- a/contrib/nmbug/nmbug-status
+++ b/contrib/nmbug/nmbug-status
@@ -108,8 +108,9 @@ def print_view(title, query, comment):
                 br = '<br />'
             else:
                 br = ''
-                out['subject'] = '<a href="http://mid.gmane.org/%s">%s</a>' \
-                                        % (urllib.quote(mid), out['subject'])
+                
+            out['subject'] = '<a href="http://mid.gmane.org/%s">%s</a>' \
+                                    % (urllib.quote(mid), out['subject'])
 
             print " <tr><td>%s %s" % (br, out['date'])
             print "</td><td>%s %s" % (br, out['id'])
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] contib/nmbug/nmbug-status: leftover whitespaces, indentation & quoting
  2012-07-10 22:29 [PATCH] contib/nmbug/nmbug-status: leftover whitespaces, indentation & quoting Tomi Ollila
  2012-07-11  9:10 ` [PATCH 1/2] contrib/nmbug/ nmbug-status: restored out['subject']... block level Tomi Ollila
@ 2012-07-11  9:10 ` Tomi Ollila
  1 sibling, 0 replies; 5+ messages in thread
From: Tomi Ollila @ 2012-07-11  9:10 UTC (permalink / raw)
  To: notmuch; +Cc: Tomi Ollila

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.
---
 contrib/nmbug/nmbug-status |   43 +++++++++++++++++++++----------------------
 1 files changed, 21 insertions(+), 22 deletions(-)

diff --git a/contrib/nmbug/nmbug-status b/contrib/nmbug/nmbug-status
index 8c6377e..f37ee84 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
@@ -108,16 +107,16 @@ def print_view(title, query, comment):
                 br = '<br />'
             else:
                 br = ''
-                
+
             out['subject'] = '<a href="http://mid.gmane.org/%s">%s</a>' \
-                                    % (urllib.quote(mid), out['subject'])
-
-            print " <tr><td>%s %s" % (br, out['date'])
-            print "</td><td>%s %s" % (br, out['id'])
-            print "</td></tr>"
-            print " <tr><td>%s" % out['from']
-            print "</td><td>%s" % out['subject']
-            print "</td></tr>\n"
+                % (urllib.quote(mid), out['subject'])
+
+            print ' <tr><td>%s %s' % (br, out['date'])
+            print '</td><td>%s %s' % (br, out['id'])
+            print '</td></tr>'
+            print ' <tr><td>%s' % out['from']
+            print '</td><td>%s' % out['subject']
+            print '</td></tr>\n'
         else:
             print '%(date)-10.10s %(from)-20.20s %(subject)-40.40s\n%(id)72s\n' % out
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] contrib/nmbug/ nmbug-status: restored out['subject']... block level
  2012-07-11  9:10 ` [PATCH 1/2] contrib/nmbug/ nmbug-status: restored out['subject']... block level Tomi Ollila
@ 2012-07-11 11:59   ` Tomi Ollila
  2012-07-12 22:09   ` David Bremner
  1 sibling, 0 replies; 5+ messages in thread
From: Tomi Ollila @ 2012-07-11 11:59 UTC (permalink / raw)
  To: notmuch

On Wed, Jul 11 2012, Tomi Ollila <tomi.ollila@iki.fi> wrote:

> In reformatting the line 111 accidentally indented to one indentation
> level too much (happens easily when interactively indenting python
> code using emacs). The line now has 4 spacess less indentation, thus
> restoring it to the block level it belongs.
> ---
>  contrib/nmbug/nmbug-status |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/contrib/nmbug/nmbug-status b/contrib/nmbug/nmbug-status
> index 6aa86a0..8c6377e 100755
> --- a/contrib/nmbug/nmbug-status
> +++ b/contrib/nmbug/nmbug-status
> @@ -108,8 +108,9 @@ def print_view(title, query, comment):
>                  br = '<br />'
>              else:
>                  br = ''
> -                out['subject'] = '<a href="http://mid.gmane.org/%s">%s</a>' \
> -                                        % (urllib.quote(mid), out['subject'])
> +                

Damn, trailing whitespace above. I forgot to follow my own rule and attempt
to 'git am' these patches before sending. The next patch fixes this along
other changes it done. To lessen (patch) email flow I don't fix this at
this time in a hope that these 2 patches will be pushed. 

Sorry for the inconvenience.

Tomi

> +            out['subject'] = '<a href="http://mid.gmane.org/%s">%s</a>' \
> +                                    % (urllib.quote(mid), out['subject'])
>  
>              print " <tr><td>%s %s" % (br, out['date'])
>              print "</td><td>%s %s" % (br, out['id'])
> -- 
> 1.7.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] contrib/nmbug/ nmbug-status: restored out['subject']... block level
  2012-07-11  9:10 ` [PATCH 1/2] contrib/nmbug/ nmbug-status: restored out['subject']... block level Tomi Ollila
  2012-07-11 11:59   ` Tomi Ollila
@ 2012-07-12 22:09   ` David Bremner
  1 sibling, 0 replies; 5+ messages in thread
From: David Bremner @ 2012-07-12 22:09 UTC (permalink / raw)
  To: Tomi Ollila, notmuch

On Wed, 11 Jul 2012 12:10:04 +0300, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> In reformatting the line 111 accidentally indented to one indentation
> level too much (happens easily when interactively indenting python
> code using emacs). The line now has 4 spacess less indentation, thus
> restoring it to the block level it belongs.

Thanks Tomi, both pushed

d

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-07-12 22:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-10 22:29 [PATCH] contib/nmbug/nmbug-status: leftover whitespaces, indentation & quoting Tomi Ollila
2012-07-11  9:10 ` [PATCH 1/2] contrib/nmbug/ nmbug-status: restored out['subject']... block level Tomi Ollila
2012-07-11 11:59   ` Tomi Ollila
2012-07-12 22:09   ` David Bremner
2012-07-11  9:10 ` [PATCH 2/2] contib/nmbug/nmbug-status: leftover whitespaces, indentation & quoting Tomi Ollila

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).