Re: [PATCH] doc: Allow rst2man.py as an alternative to rst2man
[notmuch-archives.git] / 57 / b6bc091208c16d8cd80f0eb9de83c8910e6ed2
1 Return-Path: <mpn@google.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 087DA431FB6\r
6         for <notmuch@notmuchmail.org>; Fri,  7 Dec 2012 03:48:25 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.8\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.8 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id WMkcaTl46IHA for <notmuch@notmuchmail.org>;\r
17         Fri,  7 Dec 2012 03:48:24 -0800 (PST)\r
18 Received: from mail-bk0-f53.google.com (mail-bk0-f53.google.com\r
19         [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 4C337431FAE\r
22         for <notmuch@notmuchmail.org>; Fri,  7 Dec 2012 03:48:24 -0800 (PST)\r
23 Received: by mail-bk0-f53.google.com with SMTP id j5so188863bkw.26\r
24         for <notmuch@notmuchmail.org>; Fri, 07 Dec 2012 03:48:23 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\r
26  s=20120113;\r
27         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
28         bh=NzI9aK/KYKB1NlqriSJcHSbR5nzLIsJFCIKM2oRKf4g=;\r
29         b=ZDAFzgxliMawO/sPhwTS7raRbPpI75xG5mdD5K4qjUDFu9T28rPJijKFVq7KFiQ56L\r
30         TARFGr2anKLPmFa7KB078QyaA96D/Hsp7haxR3QBB5fI09MlCghSJxdTPZYvv49GkUZb\r
31         wVA6jrY4ryFN3OUytknjNuAOCs9cQJQSY5U4mQrSWQMtC3l4VkfO1g47ViJtO080ckl9\r
32         2ct8WSg2JQ/dZb8Kr2KUBtRNiWn1sDjIOc7rVcqwRKAqpub+sOmXnhPC21DVXy4QwNVJ\r
33         19WqVexNL/scYMQVRiMUQ/JO0rpPFj80bsZuXu78EvcvawJkDSGQA4HTxNeE417bpXjL    wcpA==\r
34 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
35         d=google.com; s=20120113;\r
36         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references\r
37         :x-gm-message-state;\r
38         bh=NzI9aK/KYKB1NlqriSJcHSbR5nzLIsJFCIKM2oRKf4g=;\r
39         b=mdBqpsetbf78k4aWCHRIrY5KqXQIgXRiL3MS5/YvHO0Ue8T00fAGAWcM0JSWg2UFsx\r
40         6+VhZXR83D6G/0WXDUXH39QWmbx8lzdycRX6BuWBln9p2FB6fvD9e7IoNi6v/pLpMIPk\r
41         +eHDlYpClgDtDVUlGwOBs2EKqUCFySqdXXs2JF9DclXoGIFYrDI7NiQWly7G8tP8gFYp\r
42         1A4ItTKQ6PnGa6DmMBfFX+GLG+ja+bUKgpwBlLHk3LYmZBEznNwnpQWv1Si7PKboZPNj\r
43         GCGUZIV6HuP1VNMahL7/bZqvnxl7vZYdd7nvt9cE2cMcpLtz9U1QJWLJuL43+1mp2U3Y\r
44         Vm7A==\r
45 Received: by 10.204.15.203 with SMTP id l11mr1761334bka.74.1354880902897;\r
46         Fri, 07 Dec 2012 03:48:22 -0800 (PST)\r
47 Received: from mpn-glaptop.corp.google.com\r
48         ([2620:0:105f:5:cdae:35d2:d623:7b7a])\r
49         by mx.google.com with ESMTPS id u3sm8767560bkw.9.2012.12.07.03.48.21\r
50         (version=SSLv3 cipher=OTHER); Fri, 07 Dec 2012 03:48:22 -0800 (PST)\r
51 From: Michal Nazarewicz <mpn@google.com>\r
52 To: Jason@zx2c4.com\r
53 Subject: [PATCH] Minor style changes.\r
54 Date: Fri,  7 Dec 2012 12:48:13 +0100\r
55 Message-Id:\r
56  <84e52691df739ca60507787173b41663caaf99ed.1354880726.git.mina86@mina86.com>\r
57 X-Mailer: git-send-email 1.7.7.3\r
58 In-Reply-To:\r
59  <CAHmME9om0twqigr0L2pwXtbj4ceBVVFz0HqxkwFfB-AnusP2VQ@mail.gmail.com>\r
60 References:\r
61  <CAHmME9om0twqigr0L2pwXtbj4ceBVVFz0HqxkwFfB-AnusP2VQ@mail.gmail.com>\r
62 X-Gm-Message-State: ALoCoQmfaFsXPmIwlGU2C3TRFh1BSDOFhv1RbRtWroGfuvR3SiG0wtYSUurGMqaOLMjMWHPbfU53xhb53AzOkrrH3scfwYRMy8o+DVuvNA4K4ZaUyiJQav8ThCAGH8kroJMz+Mtz+25kfYV10KgE+6VAM8uX5WmCh7QaUF8+Fuj8cunC2A3D79Cge7aA4k8vvFey4k8mjw05\r
63 Cc: notmuch@notmuchmail.org\r
64 X-BeenThere: notmuch@notmuchmail.org\r
65 X-Mailman-Version: 2.1.13\r
66 Precedence: list\r
67 List-Id: "Use and development of the notmuch mail system."\r
68         <notmuch.notmuchmail.org>\r
69 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
71 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
72 List-Post: <mailto:notmuch@notmuchmail.org>\r
73 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
74 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
75         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
76 X-List-Received-Date: Fri, 07 Dec 2012 11:48:25 -0000\r
77 \r
78 From: Michal Nazarewicz <mina86@mina86.com>\r
79 \r
80 ---\r
81  gmail-notmuch.py |   29 +++++++++--------------------\r
82  1 files changed, 9 insertions(+), 20 deletions(-)\r
83 \r
84 On Fri, Dec 07 2012, Jason A. Donenfeld wrote:\r
85 > I wrote a script that imports emails and tags from gmail. It's\r
86 > resumable and appears to be working reasonably well. I could use some\r
87 > experienced eyes looking at it, as my first exposure to notmuch was\r
88 > just a few hours ago.\r
89 \r
90 Didn't really use it, but I still have some suggested code changes: ;)\r
91 \r
92 diff --git a/gmail-notmuch.py b/gmail-notmuch.py\r
93 index 04a60dc..ef7fa85 100755\r
94 --- a/gmail-notmuch.py\r
95 +++ b/gmail-notmuch.py\r
96 @@ -43,7 +43,7 @@ def main():\r
97         (options, args) = parser.parse_args()\r
98         if options.username == None or options.password == None:\r
99                 parser.error("Username and password are required.")\r
100 -       if not options.username.lower().endswith("@gmail.com") and not options.username.lower().endswith("@googlemail.com"):\r
101 +       if options.username.find("@") == -1:\r
102                 options.username += "@gmail.com"\r
103         if len(args) == 0:\r
104                 parser.error("Maildir location is required.")\r
105 @@ -60,7 +60,7 @@ def main():\r
106                 print("Nothing to do!")\r
107                 logout(imap)\r
108                 sys.exit(0)\r
109 -       \r
110 +\r
111         download_new_messages(imap, new_messages, destination_dir)\r
112  \r
113         logout(imap)\r
114 @@ -84,9 +84,8 @@ def discover_new_messages(imap, old_messages):\r
115         for response in data:\r
116                 imap_seq = response[0:response.find(" ")]\r
117                 gmail_id = response[response.rfind(" ") + 1:len(response) - 1]\r
118 -               if gmail_id in old_messages:\r
119 -                       continue\r
120 -               new_messages.append((gmail_id, imap_seq))\r
121 +               if gmail_id not in old_messages:\r
122 +                       new_messages.append((gmail_id, imap_seq))\r
123         return new_messages\r
124  \r
125  def download_new_messages(imap, messages, destination):\r
126 @@ -112,7 +111,7 @@ def download_new_messages(imap, messages, destination):\r
127                 typ, data = imap.fetch(str(imap_seq), "(FLAGS X-GM-LABELS)")\r
128                 if typ != "OK":\r
129                         sys.exit("Failed to download labels gmail-%d/imap-%d" % (gmail_id, imap_seq))\r
130 -               \r
131 +\r
132                 labels = label_parser.search(data[0]).groups()\r
133                 labels = filter_labels(shlex.split(labels[0], False, True) + labels[1].split(" "))\r
134  \r
135 @@ -149,22 +148,12 @@ def filter_labels(labels):\r
136                         "\\Important":  None, # I realize this is controversial, but I hate the priority inbox.\r
137                         "Junk":         "spam",\r
138                         "NonJunk":      None }\r
139 -       ret = set()\r
140 -       for label in labels:\r
141 -               if label in translation:\r
142 -                       if translation[label] is None:\r
143 -                               continue\r
144 -                       ret.add(translation[label])\r
145 -               else:\r
146 -                       ret.add(label)\r
147 -       if "!read!" in ret:\r
148 -               ret.remove("!read!")\r
149 -       else:\r
150 +       ret = set(translation.get(label, label) for label in labels)\r
151 +       if not ret.pop("!read!", None):\r
152                 ret.add("unread")\r
153 -       if "" in ret:\r
154 -               ret.remove("")\r
155 +       ret.pop(None, None)\r
156 +       ret.pop("", None)\r
157         return ret\r
158 -                       \r
159  \r
160  def logout(imap):\r
161         imap.close()\r
162 -- \r
163 1.7.7.3\r
164 \r