Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 46 / 60f56f39c2bde40466aa08107400d643912959
1 Return-Path: <patricktotzke@googlemail.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 07C65431FD0\r
6         for <notmuch@notmuchmail.org>; Tue, 12 Jul 2011 13:37:19 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, 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 Aye4C-IQ6NgT for <notmuch@notmuchmail.org>;\r
17         Tue, 12 Jul 2011 13:37:14 -0700 (PDT)\r
18 Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com\r
19  [74.125.82.45])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
20  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
21  17D2C431FB6    for <notmuch@notmuchmail.org>; Tue, 12 Jul 2011 13:37:13 -0700\r
22  (PDT)\r
23 Received: by wwj40 with SMTP id 40so3180396wwj.2\r
24         for <notmuch@notmuchmail.org>; Tue, 12 Jul 2011 13:37:12 -0700 (PDT)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
26         d=googlemail.com; s=gamma;\r
27         h=date:from:to:subject:message-id:mime-version:content-type\r
28         :content-disposition:user-agent;\r
29         bh=Uj7EsxRFfmjAdr4s4Ul+N1q64Tnpqx6Go+yXMu4wKjE=;\r
30         b=Z3QdImOVL73qyNVQQQyRF1m1MlQr5bSOO6YVogYl0pDz0cnRNxhnPQ6P+uCgeqYbr3\r
31         7YnxGm86S5itV4se0PYF9tbP1jnzxIhpXsjhuuZVHagATJDgXgg6j3+S6GX26NpEUNOO\r
32         4s7iIp9dDAdVpSFuWnXImS7j6s0k8DwAN0Sro=\r
33 Received: by 10.217.6.81 with SMTP id x59mr301499wes.50.1310503032658;\r
34         Tue, 12 Jul 2011 13:37:12 -0700 (PDT)\r
35 Received: from brick.lan (cpc1-sgyl2-0-0-cust47.sgyl.cable.virginmedia.com\r
36         [80.192.18.48])\r
37         by mx.google.com with ESMTPS id n17sm6361268wed.16.2011.07.12.13.37.08\r
38         (version=TLSv1/SSLv3 cipher=OTHER);\r
39         Tue, 12 Jul 2011 13:37:10 -0700 (PDT)\r
40 Date: Tue, 12 Jul 2011 21:37:05 +0100\r
41 From: Patrick Totzke <patricktotzke@googlemail.com>\r
42 To: notmuch@notmuchmail.org\r
43 Subject: [python] pep8\r
44 Message-ID: <20110712203705.GB28929@brick.lan>\r
45 MIME-Version: 1.0\r
46 Content-Type: multipart/signed; micalg=pgp-sha1;\r
47         protocol="application/pgp-signature"; boundary="g7w8+K/95kPelPD2"\r
48 Content-Disposition: inline\r
49 User-Agent: Mutt/1.5.21 (2010-09-15)\r
50 X-BeenThere: notmuch@notmuchmail.org\r
51 X-Mailman-Version: 2.1.13\r
52 Precedence: list\r
53 List-Id: "Use and development of the notmuch mail system."\r
54         <notmuch.notmuchmail.org>\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
58 List-Post: <mailto:notmuch@notmuchmail.org>\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
62 X-List-Received-Date: Tue, 12 Jul 2011 20:37:19 -0000\r
63 \r
64 \r
65 --g7w8+K/95kPelPD2\r
66 Content-Type: multipart/mixed; boundary="hYooF8G/hrfVAmum"\r
67 Content-Disposition: inline\r
68 \r
69 \r
70 --hYooF8G/hrfVAmum\r
71 Content-Type: text/plain; charset=us-ascii\r
72 Content-Disposition: inline\r
73 Content-Transfer-Encoding: quoted-printable\r
74 \r
75 hi all,\r
76 I just read I'm a bit late with this as Sebastian is going on holiday for t=\r
77 he=20\r
78 next couple of weeks, but here it is anyway.\r
79 The attached patches make notmuch's python bindings pep8 compliant.\r
80 most of it is just chopping down long lines and removin trailing whitespace=\r
81 s.\r
82 best,\r
83 /p\r
84 \r
85 --hYooF8G/hrfVAmum\r
86 Content-Type: text/x-diff; charset=us-ascii\r
87 Content-Disposition: attachment; filename="0002-pep8-compliance-for-message.py.patch"\r
88 Content-Transfer-Encoding: quoted-printable\r
89 \r
90 =46rom f1894462d690924c568213cd497d3546ea3fc362 Mon Sep 17 00:00:00 2001\r
91 =46rom: pazz <patricktotzke@gmail.com>\r
92 Date: Tue, 12 Jul 2011 20:46:59 +0100\r
93 Subject: [PATCH 2/8] pep8 compliance for message.py\r
94 \r
95 ---\r
96  bindings/python/notmuch/message.py |  129 +++++++++++++++++---------------=\r
97 ---\r
98  1 files changed, 63 insertions(+), 66 deletions(-)\r
99 \r
100 diff --git a/bindings/python/notmuch/message.py b/bindings/python/notmuch/m=\r
101 essage.py\r
102 index 4a43a88..f5fd603 100644\r
103 --- a/bindings/python/notmuch/message.py\r
104 +++ b/bindings/python/notmuch/message.py\r
105 @@ -18,7 +18,7 @@ Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>'\r
106                 Jesse Rosenthal <jrosenthal@jhu.edu>\r
107  """\r
108 =20\r
109 -       =20\r
110 +\r
111  from ctypes import c_char_p, c_void_p, c_long, c_uint, c_int\r
112  from datetime import date\r
113  from notmuch.globals import nmlib, STATUS, NotmuchError, Enum\r
114 @@ -31,7 +31,8 @@ try:\r
115      import simplejson as json\r
116  except ImportError:\r
117      import json\r
118 -#-------------------------------------------------------------------------=\r
119 -----\r
120 +\r
121 +\r
122  class Messages(object):\r
123      """Represents a list of notmuch messages\r
124 =20\r
125 @@ -63,8 +64,8 @@ class Messages(object):\r
126        # However it will be kept alive until all retrieved Message()\r
127        # objects are also deleted. If you do e.g. an explicit del(msgs)\r
128        # here, the following lines would fail.\r
129 -     =20\r
130 -      # You can reiterate over *msglist* however as often as you want.=20\r
131 +\r
132 +      # You can reiterate over *msglist* however as often as you want.\r
133        # It is simply a list with :class:`Message`s.\r
134 =20\r
135        print (msglist[0].get_filename())\r
136 @@ -110,7 +111,7 @@ class Messages(object):\r
137               (ie :class:`Query`) these tags are derived from. It saves\r
138               a reference to it, so we can automatically delete the db\r
139               object once all derived objects are dead.\r
140 -        :TODO: Make the iterator work more than once and cache the tags in=\r
141 =20\r
142 +        :TODO: Make the iterator work more than once and cache the tags in\r
143                 the Python object.(?)\r
144          """\r
145          if msgs_p is None:\r
146 @@ -133,7 +134,7 @@ class Messages(object):\r
147              raise NotmuchError(STATUS.NOT_INITIALIZED)\r
148 =20\r
149          # collect all tags (returns NULL on error)\r
150 -        tags_p =3D Messages._collect_tags (self._msgs)\r
151 +        tags_p =3D Messages._collect_tags(self._msgs)\r
152          #reset _msgs as we iterated over it and can do so only once\r
153          self._msgs =3D None\r
154 =20\r
155 @@ -153,7 +154,7 @@ class Messages(object):\r
156              self._msgs =3D None\r
157              raise StopIteration\r
158 =20\r
159 -        msg =3D Message(Messages._get (self._msgs), self)\r
160 +        msg =3D Message(Messages._get(self._msgs), self)\r
161          nmlib.notmuch_messages_move_to_next(self._msgs)\r
162          return msg\r
163 =20\r
164 @@ -167,14 +168,14 @@ class Messages(object):\r
165      def __del__(self):\r
166          """Close and free the notmuch Messages"""\r
167          if self._msgs is not None:\r
168 -            nmlib.notmuch_messages_destroy (self._msgs)\r
169 +            nmlib.notmuch_messages_destroy(self._msgs)\r
170 =20\r
171      def print_messages(self, format, indent=3D0, entire_thread=3DFalse):\r
172          """Outputs messages as needed for 'notmuch show' to sys.stdout\r
173 =20\r
174          :param format: A string of either 'text' or 'json'.\r
175          :param indent: A number indicating the reply depth of these messag=\r
176 es.\r
177 -        :param entire_thread: A bool, indicating whether we want to output=\r
178 =20\r
179 +        :param entire_thread: A bool, indicating whether we want to output\r
180                         whole threads or only the matching messages.\r
181          """\r
182          if format.lower() =3D=3D "text":\r
183 @@ -195,7 +196,7 @@ class Messages(object):\r
184          # iterate through all toplevel messages in this thread\r
185          for msg in self:\r
186              # if not msg:\r
187 -            #     break=20\r
188 +            #     break\r
189              if not first_set:\r
190                  sys.stdout.write(set_sep)\r
191              first_set =3D False\r
192 @@ -222,7 +223,7 @@ class Messages(object):\r
193              sys.stdout.write(set_end)\r
194          sys.stdout.write(set_end)\r
195 =20\r
196 -#-------------------------------------------------------------------------=\r
197 -----\r
198 +\r
199  class Message(object):\r
200      """Represents a single Email message\r
201 =20\r
202 @@ -236,7 +237,7 @@ class Message(object):\r
203 =20\r
204      """notmuch_message_get_filename (notmuch_message_t *message)"""\r
205      _get_filename =3D nmlib.notmuch_message_get_filename\r
206 -    _get_filename.restype =3D c_char_p=20\r
207 +    _get_filename.restype =3D c_char_p\r
208 =20\r
209      """return all filenames for a message"""\r
210      _get_filenames =3D nmlib.notmuch_message_get_filenames\r
211 @@ -248,7 +249,7 @@ class Message(object):\r
212 =20\r
213      """notmuch_message_get_message_id (notmuch_message_t *message)"""\r
214      _get_message_id =3D nmlib.notmuch_message_get_message_id\r
215 -    _get_message_id.restype =3D c_char_p=20\r
216 +    _get_message_id.restype =3D c_char_p\r
217 =20\r
218      """notmuch_message_get_thread_id"""\r
219      _get_thread_id =3D nmlib.notmuch_message_get_thread_id\r
220 @@ -296,12 +297,11 @@ class Message(object):\r
221          #keep reference to parent, so we keep it alive\r
222          self._parent =3D parent\r
223 =20\r
224 -\r
225      def get_message_id(self):\r
226          """Returns the message ID\r
227 -       =20\r
228 +\r
229          :returns: String with a message ID\r
230 -        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the mess=\r
231 age=20\r
232 +        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the mess=\r
233 age\r
234                      is not initialized.\r
235          """\r
236          if self._msg is None:\r
237 @@ -311,23 +311,24 @@ class Message(object):\r
238      def get_thread_id(self):\r
239          """Returns the thread ID\r
240 =20\r
241 -        The returned string belongs to 'message' will only be valid for as=\r
242 =20\r
243 +        The returned string belongs to 'message' will only be valid for as\r
244          long as the message is valid.\r
245 =20\r
246          This function will not return `None` since Notmuch ensures that ev=\r
247 ery\r
248          message belongs to a single thread.\r
249 =20\r
250          :returns: String with a thread ID\r
251 -        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the mess=\r
252 age=20\r
253 +        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the mess=\r
254 age\r
255                      is not initialized.\r
256          """\r
257          if self._msg is None:\r
258              raise NotmuchError(STATUS.NOT_INITIALIZED)\r
259 =20\r
260 -        return Message._get_thread_id (self._msg);\r
261 +        return Message._get_thread_id(self._msg)\r
262 =20\r
263      def get_replies(self):\r
264 -        """Gets all direct replies to this message as :class:`Messages` it=\r
265 erator\r
266 +        """Gets all direct replies to this message as :class:`Messages`\r
267 +        iterator\r
268 =20\r
269          .. note:: This call only makes sense if 'message' was\r
270            ultimately obtained from a :class:`Thread` object, (such as\r
271 @@ -338,20 +339,20 @@ class Message(object):\r
272            to :meth:`Query.search_messages`), then this function will\r
273            return `None`.\r
274 =20\r
275 -        :returns: :class:`Messages` or `None` if there are no replies to=\r
276 =20\r
277 +        :returns: :class:`Messages` or `None` if there are no replies to\r
278              this message.\r
279 -        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the mess=\r
280 age=20\r
281 +        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the mess=\r
282 age\r
283                      is not initialized.\r
284          """\r
285          if self._msg is None:\r
286              raise NotmuchError(STATUS.NOT_INITIALIZED)\r
287 =20\r
288 -        msgs_p =3D Message._get_replies(self._msg);\r
289 +        msgs_p =3D Message._get_replies(self._msg)\r
290 =20\r
291          if msgs_p is None:\r
292              return None\r
293 =20\r
294 -        return Messages(msgs_p,self)\r
295 +        return Messages(msgs_p, self)\r
296 =20\r
297      def get_date(self):\r
298          """Returns time_t of the message date\r
299 @@ -362,7 +363,7 @@ class Message(object):\r
300 =20\r
301          :returns: A time_t timestamp.\r
302          :rtype: c_unit64\r
303 -        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the mess=\r
304 age=20\r
305 +        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the mess=\r
306 age\r
307                      is not initialized.\r
308          """\r
309          if self._msg is None:\r
310 @@ -371,7 +372,7 @@ class Message(object):\r
311 =20\r
312      def get_header(self, header):\r
313          """Returns a message header\r
314 -       =20\r
315 +\r
316          This returns any message header that is stored in the notmuch data=\r
317 base.\r
318          This is only a selected subset of headers, which is currently:\r
319 =20\r
320 @@ -383,7 +384,7 @@ class Message(object):\r
321          :returns: The header value as a unicode string\r
322          :exception: :exc:`NotmuchError`\r
323 =20\r
324 -                    * STATUS.NOT_INITIALIZED if the message=20\r
325 +                    * STATUS.NOT_INITIALIZED if the message\r
326                        is not initialized.\r
327                      * STATUS.NULL_POINTER, if no header was found\r
328          """\r
329 @@ -393,7 +394,7 @@ class Message(object):\r
330              raise NotmuchError(STATUS.NOT_INITIALIZED)\r
331 =20\r
332          #Returns NULL if any error occurs.\r
333 -        header =3D Message._get_header (self._msg, header)\r
334 +        header =3D Message._get_header(self._msg, header)\r
335          if header =3D=3D None:\r
336              raise NotmuchError(STATUS.NULL_POINTER)\r
337          return header.decode('utf-8')\r
338 @@ -402,7 +403,7 @@ class Message(object):\r
339          """Returns the file path of the message file\r
340 =20\r
341          :returns: Absolute file path & name of the message file\r
342 -        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the mess=\r
343 age=20\r
344 +        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the mess=\r
345 age\r
346                is not initialized.\r
347          """\r
348          if self._msg is None:\r
349 @@ -417,7 +418,7 @@ class Message(object):\r
350          not necessarily have identical content."""\r
351          if self._msg is None:\r
352              raise NotmuchError(STATUS.NOT_INITIALIZED)\r
353 -       =20\r
354 +\r
355          files_p =3D Message._get_filenames(self._msg)\r
356 =20\r
357          return Filenames(files_p, self).as_generator()\r
358 @@ -429,10 +430,10 @@ class Message(object):\r
359          *Message.FLAG.MATCH* for those messages that match the\r
360          query. This method allows us to get the value of this flag.\r
361 =20\r
362 -        :param flag: One of the :attr:`Message.FLAG` values (currently onl=\r
363 y=20\r
364 +        :param flag: One of the :attr:`Message.FLAG` values (currently only\r
365                       *Message.FLAG.MATCH*\r
366          :returns: An unsigned int (0/1), indicating whether the flag is se=\r
367 t.\r
368 -        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the mess=\r
369 age=20\r
370 +        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the mess=\r
371 age\r
372                is not initialized.\r
373          """\r
374          if self._msg is None:\r
375 @@ -442,12 +443,12 @@ class Message(object):\r
376      def set_flag(self, flag, value):\r
377          """Sets/Unsets a specific flag for this message\r
378 =20\r
379 -        :param flag: One of the :attr:`Message.FLAG` values (currently onl=\r
380 y=20\r
381 +        :param flag: One of the :attr:`Message.FLAG` values (currently only\r
382                       *Message.FLAG.MATCH*\r
383          :param value: A bool indicating whether to set or unset the flag.\r
384 =20\r
385          :returns: Nothing\r
386 -        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the mess=\r
387 age=20\r
388 +        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the mess=\r
389 age\r
390                is not initialized.\r
391          """\r
392          if self._msg is None:\r
393 @@ -460,7 +461,7 @@ class Message(object):\r
394          :returns: A :class:`Tags` iterator.\r
395          :exception: :exc:`NotmuchError`\r
396 =20\r
397 -                      * STATUS.NOT_INITIALIZED if the message=20\r
398 +                      * STATUS.NOT_INITIALIZED if the message\r
399                          is not initialized.\r
400                        * STATUS.NULL_POINTER, on error\r
401          """\r
402 @@ -495,10 +496,10 @@ class Message(object):\r
403                    STATUS.NULL_POINTER\r
404                      The 'tag' argument is NULL\r
405                    STATUS.TAG_TOO_LONG\r
406 -                    The length of 'tag' is too long=20\r
407 +                    The length of 'tag' is too long\r
408                      (exceeds Message.NOTMUCH_TAG_MAX)\r
409                    STATUS.READ_ONLY_DATABASE\r
410 -                    Database was opened in read-only mode so message canno=\r
411 t be=20\r
412 +                    Database was opened in read-only mode so message canno=\r
413 t be\r
414                      modified.\r
415                    STATUS.NOT_INITIALIZED\r
416                       The message has not been initialized.\r
417 @@ -506,7 +507,7 @@ class Message(object):\r
418          if self._msg is None:\r
419              raise NotmuchError(STATUS.NOT_INITIALIZED)\r
420 =20\r
421 -        status =3D nmlib.notmuch_message_add_tag (self._msg, tag)\r
422 +        status =3D nmlib.notmuch_message_add_tag(self._msg, tag)\r
423 =20\r
424          # bail out on failure\r
425          if status !=3D STATUS.SUCCESS:\r
426 @@ -531,7 +532,7 @@ class Message(object):\r
427              that this will do nothing when a message is frozen, as tag\r
428              changes will not be committed to the database yet.\r
429 =20\r
430 -        :returns: STATUS.SUCCESS if the tag was successfully removed or if=\r
431 =20\r
432 +        :returns: STATUS.SUCCESS if the tag was successfully removed or if\r
433                    the message had no such tag.\r
434                    Raises an exception otherwise.\r
435          :exception: :exc:`NotmuchError`. They have the following meaning:\r
436 @@ -542,7 +543,7 @@ class Message(object):\r
437                       The length of 'tag' is too long\r
438                       (exceeds NOTMUCH_TAG_MAX)\r
439                     STATUS.READ_ONLY_DATABASE\r
440 -                     Database was opened in read-only mode so message cann=\r
441 ot=20\r
442 +                     Database was opened in read-only mode so message cann=\r
443 ot\r
444                       be modified.\r
445                     STATUS.NOT_INITIALIZED\r
446                       The message has not been initialized.\r
447 @@ -559,8 +560,6 @@ class Message(object):\r
448              self.tags_to_maildir_flags()\r
449          return STATUS.SUCCESS\r
450 =20\r
451 -\r
452 -\r
453      def remove_all_tags(self, sync_maildir_flags=3DFalse):\r
454          """Removes all tags from the given message.\r
455 =20\r
456 @@ -581,14 +580,14 @@ class Message(object):\r
457          :exception: :exc:`NotmuchError`. They have the following meaning:\r
458 =20\r
459                     STATUS.READ_ONLY_DATABASE\r
460 -                     Database was opened in read-only mode so message cann=\r
461 ot=20\r
462 +                     Database was opened in read-only mode so message cann=\r
463 ot\r
464                       be modified.\r
465                     STATUS.NOT_INITIALIZED\r
466                       The message has not been initialized.\r
467          """\r
468          if self._msg is None:\r
469              raise NotmuchError(STATUS.NOT_INITIALIZED)\r
470 -=20\r
471 +\r
472          status =3D nmlib.notmuch_message_remove_all_tags(self._msg)\r
473 =20\r
474          # bail out on error\r
475 @@ -602,8 +601,8 @@ class Message(object):\r
476      def freeze(self):\r
477          """Freezes the current state of 'message' within the database\r
478 =20\r
479 -        This means that changes to the message state, (via :meth:`add_tag`=\r
480 ,=20\r
481 -        :meth:`remove_tag`, and :meth:`remove_all_tags`), will not be=20\r
482 +        This means that changes to the message state, (via :meth:`add_tag`,\r
483 +        :meth:`remove_tag`, and :meth:`remove_all_tags`), will not be\r
484          committed to the database until the message is :meth:`thaw`ed.\r
485 =20\r
486          Multiple calls to freeze/thaw are valid and these calls will\r
487 @@ -635,14 +634,14 @@ class Message(object):\r
488          :exception: :exc:`NotmuchError`. They have the following meaning:\r
489 =20\r
490                     STATUS.READ_ONLY_DATABASE\r
491 -                     Database was opened in read-only mode so message cann=\r
492 ot=20\r
493 +                     Database was opened in read-only mode so message cann=\r
494 ot\r
495                       be modified.\r
496                     STATUS.NOT_INITIALIZED\r
497                       The message has not been initialized.\r
498          """\r
499          if self._msg is None:\r
500              raise NotmuchError(STATUS.NOT_INITIALIZED)\r
501 -=20\r
502 +\r
503          status =3D nmlib.notmuch_message_freeze(self._msg)\r
504 =20\r
505          if STATUS.SUCCESS =3D=3D status:\r
506 @@ -654,7 +653,7 @@ class Message(object):\r
507      def thaw(self):\r
508          """Thaws the current 'message'\r
509 =20\r
510 -        Thaw the current 'message', synchronizing any changes that may hav=\r
511 e=20\r
512 +        Thaw the current 'message', synchronizing any changes that may have\r
513          occurred while 'message' was frozen into the notmuch database.\r
514 =20\r
515          See :meth:`freeze` for an example of how to use this\r
516 @@ -669,15 +668,15 @@ class Message(object):\r
517          :exception: :exc:`NotmuchError`. They have the following meaning:\r
518 =20\r
519                     STATUS.UNBALANCED_FREEZE_THAW\r
520 -                     An attempt was made to thaw an unfrozen message.=20\r
521 -                     That is, there have been an unbalanced number of call=\r
522 s=20\r
523 +                     An attempt was made to thaw an unfrozen message.\r
524 +                     That is, there have been an unbalanced number of calls\r
525                       to :meth:`freeze` and :meth:`thaw`.\r
526                     STATUS.NOT_INITIALIZED\r
527                       The message has not been initialized.\r
528          """\r
529          if self._msg is None:\r
530              raise NotmuchError(STATUS.NOT_INITIALIZED)\r
531 -=20\r
532 +\r
533          status =3D nmlib.notmuch_message_thaw(self._msg)\r
534 =20\r
535          if STATUS.SUCCESS =3D=3D status:\r
536 @@ -686,7 +685,6 @@ class Message(object):\r
537 =20\r
538          raise NotmuchError(status)\r
539 =20\r
540 -\r
541      def is_match(self):\r
542          """(Not implemented)"""\r
543          return self.get_flag(Message.FLAG.MATCH)\r
544 @@ -699,10 +697,10 @@ class Message(object):\r
545                'P' if the message has the "passed" tag\r
546                'R' if the message has the "replied" tag\r
547                'S' if the message does not have the "unread" tag\r
548 -           =20\r
549 +\r
550          Any existing flags unmentioned in the list above will be\r
551          preserved in the renaming.\r
552 -           =20\r
553 +\r
554          Also, if this filename is in a directory named "new", rename it\r
555          to be within the neighboring directory named "cur".\r
556 =20\r
557 @@ -755,7 +753,6 @@ class Message(object):\r
558          msg['date'] =3D date.fromtimestamp(self.get_date())\r
559          return "%(from)s (%(date)s) (%(tags)s)" % (msg)\r
560 =20\r
561 -\r
562      def get_message_parts(self):\r
563          """Output like notmuch show"""\r
564          fp =3D open(self.get_filename())\r
565 @@ -804,7 +801,7 @@ class Message(object):\r
566              part_dict["content-type"] =3D cont_type\r
567              # NOTE:\r
568              # Now we emulate the current behaviour, where it ignores\r
569 -            # the html if there's a text representation.=20\r
570 +            # the html if there's a text representation.\r
571              #\r
572              # This is being worked on, but it will be easier to fix\r
573              # here in the future than to end up with another\r
574 @@ -815,7 +812,7 @@ class Message(object):\r
575              else:\r
576                  if cont_type.lower() =3D=3D "text/plain":\r
577                      part_dict["content"] =3D msg.get_payload()\r
578 -                elif (cont_type.lower() =3D=3D "text/html" and=20\r
579 +                elif (cont_type.lower() =3D=3D "text/html" and\r
580                        i =3D=3D 0):\r
581                      part_dict["content"] =3D msg.get_payload()\r
582              body.append(part_dict)\r
583 @@ -860,18 +857,18 @@ class Message(object):\r
584          parts =3D format["body"]\r
585          parts.sort(key=3Dlambda x: x['id'])\r
586          for p in parts:\r
587 -            if not p.has_key("filename"):\r
588 +            if not "filename" in p:\r
589                  output +=3D "\n\fpart{ "\r
590 -                output +=3D "ID: %d, Content-type: %s\n" % (p["id"],=20\r
591 -                                                         p["content-type"])\r
592 -                if p.has_key("content"):\r
593 +                output +=3D "ID: %d, Content-type: %s\n" % (p["id"],\r
594 +                                                          p["content-type"=\r
595 ])\r
596 +                if "content" in p:\r
597                      output +=3D "\n%s\n" % p["content"]\r
598                  else:\r
599                      output +=3D "Non-text part: %s\n" % p["content-type"]\r
600 -                    output +=3D "\n\fpart}"                   =20\r
601 +                    output +=3D "\n\fpart}"\r
602              else:\r
603                  output +=3D "\n\fattachment{ "\r
604 -                output +=3D "ID: %d, Content-type:%s\n" % (p["id"],=20\r
605 +                output +=3D "ID: %d, Content-type:%s\n" % (p["id"],\r
606                                                           p["content-type"])\r
607                  output +=3D "Attachment: %s\n" % p["filename"]\r
608                  output +=3D "\n\fattachment}\n"\r
609 @@ -897,7 +894,7 @@ class Message(object):\r
610          been added or removed, the same messages would not be considered\r
611          equal (as they do not point to the same set of files\r
612          any more)."""\r
613 -        res =3D  cmp(self.get_message_id(), other.get_message_id())\r
614 +        res =3D cmp(self.get_message_id(), other.get_message_id())\r
615          if res:\r
616              res =3D cmp(list(self.get_filenames()), list(other.get_filenam=\r
617 es()))\r
618          return res\r
619 @@ -905,4 +902,4 @@ class Message(object):\r
620      def __del__(self):\r
621          """Close and free the notmuch Message"""\r
622          if self._msg is not None:\r
623 -            nmlib.notmuch_message_destroy (self._msg)\r
624 +            nmlib.notmuch_message_destroy(self._msg)\r
625 --=20\r
626 1.7.4.1\r
627 \r
628 \r
629 --hYooF8G/hrfVAmum\r
630 Content-Type: text/x-diff; charset=us-ascii\r
631 Content-Disposition: attachment; filename="0003-pep8-compliance-for-database.py.patch"\r
632 Content-Transfer-Encoding: quoted-printable\r
633 \r
634 =46rom 3cae17dfd64bc63ae89a2d95cd6ace7cc98807de Mon Sep 17 00:00:00 2001\r
635 =46rom: pazz <patricktotzke@gmail.com>\r
636 Date: Tue, 12 Jul 2011 21:11:29 +0100\r
637 Subject: [PATCH 3/8] pep8 compliance for database.py\r
638 \r
639 ---\r
640  bindings/python/notmuch/database.py |  160 +++++++++++++++++--------------=\r
641 ---\r
642  1 files changed, 80 insertions(+), 80 deletions(-)\r
643 \r
644 diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/=\r
645 database.py\r
646 index 84cf79b..874087e 100644\r
647 --- a/bindings/python/notmuch/database.py\r
648 +++ b/bindings/python/notmuch/database.py\r
649 @@ -24,6 +24,7 @@ from notmuch.thread import Threads\r
650  from notmuch.message import Messages, Message\r
651  from notmuch.tag import Tags\r
652 =20\r
653 +\r
654  class Database(object):\r
655      """Represents a notmuch database (wraps notmuch_database_t)\r
656 =20\r
657 @@ -36,7 +37,7 @@ class Database(object):\r
658      _std_db_path =3D None\r
659      """Class attribute to cache user's default database"""\r
660 =20\r
661 -    MODE =3D Enum(['READ_ONLY','READ_WRITE'])\r
662 +    MODE =3D Enum(['READ_ONLY', 'READ_WRITE'])\r
663      """Constants: Mode in which to open the database"""\r
664 =20\r
665      """notmuch_database_get_directory"""\r
666 @@ -52,7 +53,7 @@ class Database(object):\r
667      _get_version.restype =3D c_uint\r
668 =20\r
669      """notmuch_database_open"""\r
670 -    _open =3D nmlib.notmuch_database_open=20\r
671 +    _open =3D nmlib.notmuch_database_open\r
672      _open.restype =3D c_void_p\r
673 =20\r
674      """notmuch_database_upgrade"""\r
675 @@ -71,9 +72,9 @@ class Database(object):\r
676      _create =3D nmlib.notmuch_database_create\r
677      _create.restype =3D c_void_p\r
678 =20\r
679 -    def __init__(self, path=3DNone, create=3DFalse, mode=3D 0):\r
680 -        """If *path* is `None`, we will try to read a users notmuch=20\r
681 -        configuration and use his configured database. The location of the=\r
682 =20\r
683 +    def __init__(self, path=3DNone, create=3DFalse, mode=3D0):\r
684 +        """If *path* is `None`, we will try to read a users notmuch\r
685 +        configuration and use his configured database. The location of the\r
686          configuration file can be specified through the environment variab=\r
687 le\r
688          *NOTMUCH_CONFIG*, falling back to the default `~/.notmuch-config`.\r
689 =20\r
690 @@ -84,9 +85,9 @@ class Database(object):\r
691                         above for behavior if `None`)\r
692          :type path:    `str` or `None`\r
693          :param create: Pass `False` to open an existing, `True` to create =\r
694 a new\r
695 -                       database. =20\r
696 +                       database.\r
697          :type create:  bool\r
698 -        :param mode:   Mode to open a database in. Is always=20\r
699 +        :param mode:   Mode to open a database in. Is always\r
700                         :attr:`MODE`.READ_WRITE when creating a new one.\r
701          :type mode:    :attr:`MODE`\r
702          :returns:      Nothing\r
703 @@ -100,7 +101,7 @@ class Database(object):\r
704                  Database._std_db_path =3D self._get_user_default_db()\r
705              path =3D Database._std_db_path\r
706 =20\r
707 -        assert isinstance(path, basestring), 'Path needs to be a string or=\r
708  None.'\r
709 +        assert isinstance(path, basestring), 'Path must be a string or Non=\r
710 e.'\r
711          if create =3D=3D False:\r
712              self.open(path, mode)\r
713          else:\r
714 @@ -109,7 +110,7 @@ class Database(object):\r
715      def _verify_initialized_db(self):\r
716          """Raises a NotmuchError in case self._db is still None"""\r
717          if self._db is None:\r
718 -            raise NotmuchError(STATUS.NOT_INITIALIZED)           =20\r
719 +            raise NotmuchError(STATUS.NOT_INITIALIZED)\r
720 =20\r
721      def create(self, path):\r
722          """Creates a new notmuch database\r
723 @@ -128,8 +129,8 @@ class Database(object):\r
724                      (after printing an error message on stderr).\r
725          """\r
726          if self._db is not None:\r
727 -            raise NotmuchError(\r
728 -            message=3D"Cannot create db, this Database() already has an op=\r
729 en one.")\r
730 +            raise NotmuchError(message=3D"Cannot create db, this Database(=\r
731 ) "\r
732 +                                       "already has an open one.")\r
733 =20\r
734          res =3D Database._create(path, Database.MODE.READ_WRITE)\r
735 =20\r
736 @@ -138,7 +139,7 @@ class Database(object):\r
737                  message=3D"Could not create the specified database")\r
738          self._db =3D res\r
739 =20\r
740 -    def open(self, path, mode=3D 0):=20\r
741 +    def open(self, path, mode=3D0):\r
742          """Opens an existing database\r
743 =20\r
744          This function is used by __init__() and usually does not need\r
745 @@ -146,7 +147,7 @@ class Database(object):\r
746          *notmuch_database_open* function.\r
747 =20\r
748          :param status: Open the database in read-only or read-write mode\r
749 -        :type status:  :attr:`MODE`=20\r
750 +        :type status:  :attr:`MODE`\r
751          :returns: Nothing\r
752          :exception: Raises :exc:`NotmuchError` in case\r
753                      of any failure (after printing an error message on std=\r
754 err).\r
755 @@ -178,7 +179,7 @@ class Database(object):\r
756          # Raise a NotmuchError if not initialized\r
757          self._verify_initialized_db()\r
758 =20\r
759 -        return Database._get_version (self._db)\r
760 +        return Database._get_version(self._db)\r
761 =20\r
762      def needs_upgrade(self):\r
763          """Does this database need to be upgraded before writing to it?\r
764 @@ -195,7 +196,7 @@ class Database(object):\r
765          # Raise a NotmuchError if not initialized\r
766          self._verify_initialized_db()\r
767 =20\r
768 -        return nmlib.notmuch_database_needs_upgrade(self._db)=20\r
769 +        return nmlib.notmuch_database_needs_upgrade(self._db)\r
770 =20\r
771      def upgrade(self):\r
772          """Upgrades the current database\r
773 @@ -207,7 +208,7 @@ class Database(object):\r
774          NOT IMPLEMENTED: The optional progress_notify callback can be\r
775          used by the caller to provide progress indication to the\r
776          user. If non-NULL it will be called periodically with\r
777 -        'progress' as a floating-point value in the range of [0.0..1.0]=20\r
778 +        'progress' as a floating-point value in the range of [0.0..1.0]\r
779          indicating the progress made so far in the upgrade process.\r
780 =20\r
781          :TODO: catch exceptions, document return values and etc...\r
782 @@ -215,15 +216,15 @@ class Database(object):\r
783          # Raise a NotmuchError if not initialized\r
784          self._verify_initialized_db()\r
785 =20\r
786 -        status =3D Database._upgrade (self._db, None, None)\r
787 +        status =3D Database._upgrade(self._db, None, None)\r
788          #TODO: catch exceptions, document return values and etc\r
789          return status\r
790 =20\r
791      def get_directory(self, path):\r
792 -        """Returns a :class:`Directory` of path,=20\r
793 +        """Returns a :class:`Directory` of path,\r
794          (creating it if it does not exist(?))\r
795 =20\r
796 -        .. warning:: This call needs a writeable database in=20\r
797 +        .. warning:: This call needs a writeable database in\r
798             Database.MODE.READ_WRITE mode. The underlying library will exit=\r
799  the\r
800             program if this method is used on a read-only database!\r
801 =20\r
802 @@ -233,11 +234,11 @@ class Database(object):\r
803          :returns: :class:`Directory` or raises an exception.\r
804          :exception: :exc:`NotmuchError`\r
805 =20\r
806 -                  STATUS.NOT_INITIALIZED=20\r
807 +                  STATUS.NOT_INITIALIZED\r
808                      If the database was not intitialized.\r
809 =20\r
810                    STATUS.FILE_ERROR\r
811 -                    If path is not relative database or absolute with init=\r
812 ial=20\r
813 +                    If path is not relative database or absolute with init=\r
814 ial\r
815                      components same as database.\r
816 =20\r
817          """\r
818 @@ -249,14 +250,15 @@ class Database(object):\r
819              # we got an absolute path\r
820              if not path.startswith(self.get_path()):\r
821                  # but its initial components are not equal to the db path\r
822 -                raise NotmuchError(STATUS.FILE_ERROR,=20\r
823 -                                   message=3D"Database().get_directory() c=\r
824 alled with a wrong absolute path.")\r
825 +                raise NotmuchError(STATUS.FILE_ERROR,\r
826 +                                   message=3D"Database().get_directory() c=\r
827 alled "\r
828 +                                           "with a wrong absolute path.")\r
829              abs_dirpath =3D path\r
830          else:\r
831              #we got a relative path, make it absolute\r
832 -            abs_dirpath =3D os.path.abspath(os.path.join(self.get_path(),p=\r
833 ath))\r
834 +            abs_dirpath =3D os.path.abspath(os.path.join(self.get_path(), =\r
835 path))\r
836 =20\r
837 -        dir_p =3D Database._get_directory(self._db, path);\r
838 +        dir_p =3D Database._get_directory(self._db, path)\r
839 =20\r
840          # return the Directory, init it with the absolute path\r
841          return Directory(abs_dirpath, dir_p, self)\r
842 @@ -281,7 +283,7 @@ class Database(object):\r
843              API. You might want to look into the underlying method\r
844              :meth:`Message.maildir_flags_to_tags`.\r
845 =20\r
846 -        :returns: On success, we return=20\r
847 +        :returns: On success, we return\r
848 =20\r
849             1) a :class:`Message` object that can be used for things\r
850                such as adding tags to the just-added message.\r
851 @@ -300,10 +302,11 @@ class Database(object):\r
852                If such an exception occurs, nothing was added to the databa=\r
853 se.\r
854 =20\r
855                STATUS.FILE_ERROR\r
856 -                      An error occurred trying to open the file, (such as=\r
857 =20\r
858 +                      An error occurred trying to open the file, (such as\r
859                        permission denied, or file not found, etc.).\r
860                STATUS.FILE_NOT_EMAIL\r
861 -                      The contents of filename don't look like an email me=\r
862 ssage.\r
863 +                      The contents of filename don't look like an email\r
864 +                      message.\r
865                STATUS.READ_ONLY_DATABASE\r
866                        Database was opened in read-only mode so no message =\r
867 can\r
868                        be added.\r
869 @@ -317,7 +320,7 @@ class Database(object):\r
870          status =3D nmlib.notmuch_database_add_message(self._db,\r
871                                                    filename,\r
872                                                    byref(msg_p))\r
873 -=20\r
874 +\r
875          if not status in [STATUS.SUCCESS, STATUS.DUPLICATE_MESSAGE_ID]:\r
876              raise NotmuchError(status)\r
877 =20\r
878 @@ -341,17 +344,18 @@ class Database(object):\r
879          :returns: A STATUS value with the following meaning:\r
880 =20\r
881               STATUS.SUCCESS\r
882 -               The last filename was removed and the message was removed=\r
883 =20\r
884 +               The last filename was removed and the message was removed\r
885                 from the database.\r
886               STATUS.DUPLICATE_MESSAGE_ID\r
887 -               This filename was removed but the message persists in the=\r
888 =20\r
889 +               This filename was removed but the message persists in the\r
890                 database with at least one other filename.\r
891 =20\r
892          :exception: Raises a :exc:`NotmuchError` with the following meanin=\r
893 g.\r
894 -             If such an exception occurs, nothing was removed from the dat=\r
895 abase.\r
896 +             If such an exception occurs, nothing was removed from the\r
897 +             database.\r
898 =20\r
899               STATUS.READ_ONLY_DATABASE\r
900 -               Database was opened in read-only mode so no message can be=\r
901 =20\r
902 +               Database was opened in read-only mode so no message can be\r
903                 removed.\r
904               STATUS.NOT_INITIALIZED\r
905                 The database has not been initialized.\r
906 @@ -374,8 +378,8 @@ class Database(object):\r
907                    occurs. Do note that Xapian Exceptions include\r
908                    "Database modified" situations, e.g. when the\r
909                    notmuch database has been modified by\r
910 -                  another program in the meantime. A return value of=20\r
911 -                  `None` is therefore no guarantee that the message=20\r
912 +                  another program in the meantime. A return value of\r
913 +                  `None` is therefore no guarantee that the message\r
914                    does not exist.\r
915          :exception: :exc:`NotmuchError` with STATUS.NOT_INITIALIZED if\r
916                    the database was not intitialized.\r
917 @@ -397,7 +401,7 @@ class Database(object):\r
918          # Raise a NotmuchError if not initialized\r
919          self._verify_initialized_db()\r
920 =20\r
921 -        tags_p =3D Database._get_all_tags (self._db)\r
922 +        tags_p =3D Database._get_all_tags(self._db)\r
923          if tags_p =3D=3D None:\r
924              raise NotmuchError(STATUS.NULL_POINTER)\r
925          return Tags(tags_p, self)\r
926 @@ -442,10 +446,10 @@ class Database(object):\r
927          conf_f =3D os.getenv('NOTMUCH_CONFIG',\r
928                             os.path.expanduser('~/.notmuch-config'))\r
929          config.read(conf_f)\r
930 -        if not config.has_option('database','path'):\r
931 -            raise NotmuchError(message=3D\r
932 -                               "No DB path specified and no user default f=\r
933 ound")\r
934 -        return config.get('database','path')\r
935 +        if not config.has_option('database', 'path'):\r
936 +            raise NotmuchError(message=3D"No DB path specified"\r
937 +                                       " and no user default found")\r
938 +        return config.get('database', 'path')\r
939 =20\r
940      @property\r
941      def db_p(self):\r
942 @@ -456,7 +460,7 @@ class Database(object):\r
943          """\r
944          return self._db\r
945 =20\r
946 -#-------------------------------------------------------------------------=\r
947 -----\r
948 +\r
949  class Query(object):\r
950      """Represents a search query on an opened :class:`Database`.\r
951 =20\r
952 @@ -476,7 +480,7 @@ class Query(object):\r
953             other unexpected behavior. See above for more details.\r
954      """\r
955      # constants\r
956 -    SORT =3D Enum(['OLDEST_FIRST','NEWEST_FIRST','MESSAGE_ID', 'UNSORTED'])\r
957 +    SORT =3D Enum(['OLDEST_FIRST', 'NEWEST_FIRST', 'MESSAGE_ID', 'UNSORTED=\r
958 '])\r
959      """Constants: Sort order in which to return results"""\r
960 =20\r
961      """notmuch_query_create"""\r
962 @@ -491,7 +495,6 @@ class Query(object):\r
963      _search_messages =3D nmlib.notmuch_query_search_messages\r
964      _search_messages.restype =3D c_void_p\r
965 =20\r
966 -\r
967      """notmuch_query_count_messages"""\r
968      _count_messages =3D nmlib.notmuch_query_count_messages\r
969      _count_messages.restype =3D c_uint\r
970 @@ -511,7 +514,7 @@ class Query(object):\r
971      def create(self, db, querystr):\r
972          """Creates a new query derived from a Database\r
973 =20\r
974 -        This function is utilized by __init__() and usually does not need =\r
975 to=20\r
976 +        This function is utilized by __init__() and usually does not need =\r
977 to\r
978          be called directly.\r
979 =20\r
980          :param db: Database to create the query from.\r
981 @@ -522,11 +525,11 @@ class Query(object):\r
982          :exception: :exc:`NotmuchError`\r
983 =20\r
984                        * STATUS.NOT_INITIALIZED if db is not inited\r
985 -                      * STATUS.NULL_POINTER if the query creation failed=\r
986 =20\r
987 +                      * STATUS.NULL_POINTER if the query creation failed\r
988                          (too little memory)\r
989          """\r
990          if db.db_p is None:\r
991 -            raise NotmuchError(STATUS.NOT_INITIALIZED)           =20\r
992 +            raise NotmuchError(STATUS.NOT_INITIALIZED)\r
993          # create reference to parent db to keep it alive\r
994          self._db =3D db\r
995          if isinstance(querystr, unicode):\r
996 @@ -545,7 +548,7 @@ class Query(object):\r
997 =20\r
998          :param sort: Sort order (see :attr:`Query.SORT`)\r
999          :returns: Nothing\r
1000 -        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if query ha=\r
1001 s not=20\r
1002 +        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if query ha=\r
1003 s not\r
1004                      been initialized.\r
1005          """\r
1006          if self._query is None:\r
1007 @@ -558,7 +561,7 @@ class Query(object):\r
1008          """Execute a query for threads\r
1009 =20\r
1010          Execute a query for threads, returning a :class:`Threads` iterator.\r
1011 -        The returned threads are owned by the query and as such, will only=\r
1012  be=20\r
1013 +        The returned threads are owned by the query and as such, will only=\r
1014  be\r
1015          valid until the Query is deleted.\r
1016 =20\r
1017          The method sets :attr:`Message.FLAG`\.MATCH for those messages that\r
1018 @@ -572,17 +575,17 @@ class Query(object):\r
1019          :exception: :exc:`NotmuchError`\r
1020 =20\r
1021                        * STATUS.NOT_INITIALIZED if query is not inited\r
1022 -                      * STATUS.NULL_POINTER if search_threads failed=20\r
1023 +                      * STATUS.NULL_POINTER if search_threads failed\r
1024          """\r
1025          if self._query is None:\r
1026 -            raise NotmuchError(STATUS.NOT_INITIALIZED)           =20\r
1027 +            raise NotmuchError(STATUS.NOT_INITIALIZED)\r
1028 =20\r
1029          threads_p =3D Query._search_threads(self._query)\r
1030 =20\r
1031          if threads_p is None:\r
1032              NotmuchError(STATUS.NULL_POINTER)\r
1033 =20\r
1034 -        return Threads(threads_p,self)\r
1035 +        return Threads(threads_p, self)\r
1036 =20\r
1037      def search_messages(self):\r
1038          """Filter messages according to the query and return\r
1039 @@ -595,17 +598,17 @@ class Query(object):\r
1040          :exception: :exc:`NotmuchError`\r
1041 =20\r
1042                        * STATUS.NOT_INITIALIZED if query is not inited\r
1043 -                      * STATUS.NULL_POINTER if search_messages failed=20\r
1044 +                      * STATUS.NULL_POINTER if search_messages failed\r
1045          """\r
1046          if self._query is None:\r
1047 -            raise NotmuchError(STATUS.NOT_INITIALIZED)           =20\r
1048 +            raise NotmuchError(STATUS.NOT_INITIALIZED)\r
1049 =20\r
1050          msgs_p =3D Query._search_messages(self._query)\r
1051 =20\r
1052          if msgs_p is None:\r
1053              NotmuchError(STATUS.NULL_POINTER)\r
1054 =20\r
1055 -        return Messages(msgs_p,self)\r
1056 +        return Messages(msgs_p, self)\r
1057 =20\r
1058      def count_messages(self):\r
1059          """Estimate the number of messages matching the query\r
1060 @@ -623,17 +626,16 @@ class Query(object):\r
1061                        * STATUS.NOT_INITIALIZED if query is not inited\r
1062          """\r
1063          if self._query is None:\r
1064 -            raise NotmuchError(STATUS.NOT_INITIALIZED)           =20\r
1065 +            raise NotmuchError(STATUS.NOT_INITIALIZED)\r
1066 =20\r
1067          return Query._count_messages(self._query)\r
1068 =20\r
1069      def __del__(self):\r
1070          """Close and free the Query"""\r
1071          if self._query is not None:\r
1072 -            nmlib.notmuch_query_destroy (self._query)\r
1073 +            nmlib.notmuch_query_destroy(self._query)\r
1074 =20\r
1075 =20\r
1076 -#-------------------------------------------------------------------------=\r
1077 -----\r
1078  class Directory(object):\r
1079      """Represents a directory entry in the notmuch directory\r
1080 =20\r
1081 @@ -665,9 +667,9 @@ class Directory(object):\r
1082      _get_child_directories.restype =3D c_void_p\r
1083 =20\r
1084      def _verify_dir_initialized(self):\r
1085 -        """Raises a NotmuchError(STATUS.NOT_INITIALIZED) if the dir_p is N=\r
1086 one"""\r
1087 +        """Raises a NotmuchError(STATUS.NOT_INITIALIZED) if dir_p is None"=\r
1088 ""\r
1089          if self._dir_p is None:\r
1090 -            raise NotmuchError(STATUS.NOT_INITIALIZED)           =20\r
1091 +            raise NotmuchError(STATUS.NOT_INITIALIZED)\r
1092 =20\r
1093      def __init__(self, path, dir_p, parent):\r
1094          """\r
1095 @@ -683,8 +685,7 @@ class Directory(object):\r
1096          self._dir_p =3D dir_p\r
1097          self._parent =3D parent\r
1098 =20\r
1099 -\r
1100 -    def set_mtime (self, mtime):\r
1101 +    def set_mtime(self, mtime):\r
1102          """Sets the mtime value of this directory in the database\r
1103 =20\r
1104          The intention is for the caller to use the mtime to allow efficient\r
1105 @@ -692,29 +693,29 @@ class Directory(object):\r
1106          recommended usage is as follows:\r
1107 =20\r
1108          * Read the mtime of a directory from the filesystem\r
1109 -=20\r
1110 +\r
1111          * Call :meth:`Database.add_message` for all mail files in\r
1112            the directory\r
1113 =20\r
1114 -        * Call notmuch_directory_set_mtime with the mtime read from the=20\r
1115 +        * Call notmuch_directory_set_mtime with the mtime read from the\r
1116            filesystem.  Then, when wanting to check for updates to the\r
1117            directory in the future, the client can call :meth:`get_mtime`\r
1118 -          and know that it only needs to add files if the mtime of the=20\r
1119 +          and know that it only needs to add files if the mtime of the\r
1120            directory and files are newer than the stored timestamp.\r
1121 =20\r
1122 -          .. note:: :meth:`get_mtime` function does not allow the caller=\r
1123 =20\r
1124 +          .. note:: :meth:`get_mtime` function does not allow the caller\r
1125                   to distinguish a timestamp of 0 from a non-existent\r
1126                   timestamp. So don't store a timestamp of 0 unless you are\r
1127 -                 comfortable with that. =20\r
1128 +                 comfortable with that.\r
1129 =20\r
1130 -          :param mtime: A (time_t) timestamp=20\r
1131 +          :param mtime: A (time_t) timestamp\r
1132            :returns: Nothing on success, raising an exception on failure.\r
1133            :exception: :exc:`NotmuchError`:\r
1134 =20\r
1135                          STATUS.XAPIAN_EXCEPTION\r
1136                            A Xapian exception occurred, mtime not stored.\r
1137                          STATUS.READ_ONLY_DATABASE\r
1138 -                          Database was opened in read-only mode so directo=\r
1139 ry=20\r
1140 +                          Database was opened in read-only mode so directo=\r
1141 ry\r
1142                            mtime cannot be modified.\r
1143                          STATUS.NOT_INITIALIZED\r
1144                            The directory has not been initialized\r
1145 @@ -731,12 +732,12 @@ class Directory(object):\r
1146          #fail with Exception otherwise\r
1147          raise NotmuchError(status)\r
1148 =20\r
1149 -    def get_mtime (self):\r
1150 +    def get_mtime(self):\r
1151          """Gets the mtime value of this directory in the database\r
1152 =20\r
1153          Retrieves a previously stored mtime for this directory.\r
1154 =20\r
1155 -        :param mtime: A (time_t) timestamp=20\r
1156 +        :param mtime: A (time_t) timestamp\r
1157          :returns: Nothing on success, raising an exception on failure.\r
1158          :exception: :exc:`NotmuchError`:\r
1159 =20\r
1160 @@ -746,19 +747,19 @@ class Directory(object):\r
1161          #Raise a NotmuchError(STATUS.NOT_INITIALIZED) if self.dir_p is None\r
1162          self._verify_dir_initialized()\r
1163 =20\r
1164 -        return Directory._get_mtime (self._dir_p)\r
1165 +        return Directory._get_mtime(self._dir_p)\r
1166 =20\r
1167      # Make mtime attribute a property of Directory()\r
1168      mtime =3D property(get_mtime, set_mtime, doc=3D"""Property that allows=\r
1169  getting\r
1170                       and setting of the Directory *mtime* (read-write)\r
1171 =20\r
1172 -                     See :meth:`get_mtime` and :meth:`set_mtime` for usage=\r
1173  and=20\r
1174 +                     See :meth:`get_mtime` and :meth:`set_mtime` for usage=\r
1175  and\r
1176                       possible exceptions.""")\r
1177 =20\r
1178      def get_child_files(self):\r
1179          """Gets a Filenames iterator listing all the filenames of\r
1180          messages in the database within the given directory.\r
1181 -=20\r
1182 +\r
1183          The returned filenames will be the basename-entries only (not\r
1184          complete paths.\r
1185          """\r
1186 @@ -771,7 +772,7 @@ class Directory(object):\r
1187      def get_child_directories(self):\r
1188          """Gets a :class:`Filenames` iterator listing all the filenames of\r
1189          sub-directories in the database within the given directory\r
1190 -       =20\r
1191 +\r
1192          The returned filenames will be the basename-entries only (not\r
1193          complete paths.\r
1194          """\r
1195 @@ -795,10 +796,9 @@ class Directory(object):\r
1196          if self._dir_p is not None:\r
1197              nmlib.notmuch_directory_destroy(self._dir_p)\r
1198 =20\r
1199 -#-------------------------------------------------------------------------=\r
1200 -----\r
1201 +\r
1202  class Filenames(object):\r
1203 -    """An iterator over File- or Directory names that are stored in the da=\r
1204 tabase\r
1205 -    """\r
1206 +    """An iterator over File- or Directory names stored in the database"""\r
1207 =20\r
1208      #notmuch_filenames_get\r
1209      _get =3D nmlib.notmuch_filenames_get\r
1210 @@ -828,14 +828,14 @@ class Filenames(object):\r
1211              self._files_p =3D None\r
1212              raise StopIteration\r
1213 =20\r
1214 -        file =3D Filenames._get (self._files_p)\r
1215 +        file =3D Filenames._get(self._files_p)\r
1216          nmlib.notmuch_filenames_move_to_next(self._files_p)\r
1217          return file\r
1218 =20\r
1219      def __len__(self):\r
1220          """len(:class:`Filenames`) returns the number of contained files\r
1221 =20\r
1222 -        .. note:: As this iterates over the files, we will not be able to=\r
1223 =20\r
1224 +        .. note:: As this iterates over the files, we will not be able to\r
1225                 iterate over them again! So this will fail::\r
1226 =20\r
1227                   #THIS FAILS\r
1228 @@ -847,7 +847,7 @@ class Filenames(object):\r
1229          if self._files_p is None:\r
1230              raise NotmuchError(STATUS.NOT_INITIALIZED)\r
1231 =20\r
1232 -        i=3D0\r
1233 +        i =3D 0\r
1234          while nmlib.notmuch_filenames_valid(self._files_p):\r
1235              nmlib.notmuch_filenames_move_to_next(self._files_p)\r
1236              i +=3D 1\r
1237 --=20\r
1238 1.7.4.1\r
1239 \r
1240 \r
1241 --hYooF8G/hrfVAmum\r
1242 Content-Type: text/x-diff; charset=us-ascii\r
1243 Content-Disposition: attachment; filename="0004-pep8-compliance-for-filename.py.patch"\r
1244 Content-Transfer-Encoding: quoted-printable\r
1245 \r
1246 =46rom fcea6c05cd89e21bd0743445b69f89f92affbdd0 Mon Sep 17 00:00:00 2001\r
1247 =46rom: pazz <patricktotzke@gmail.com>\r
1248 Date: Tue, 12 Jul 2011 21:13:57 +0100\r
1249 Subject: [PATCH 4/8] pep8 compliance for filename.py\r
1250 \r
1251 ---\r
1252  bindings/python/notmuch/filename.py |   25 +++++++++++++------------\r
1253  1 files changed, 13 insertions(+), 12 deletions(-)\r
1254 \r
1255 diff --git a/bindings/python/notmuch/filename.py b/bindings/python/notmuch/=\r
1256 filename.py\r
1257 index 20b90e9..630886d 100644\r
1258 --- a/bindings/python/notmuch/filename.py\r
1259 +++ b/bindings/python/notmuch/filename.py\r
1260 @@ -19,19 +19,20 @@ Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>'\r
1261  from ctypes import c_char_p\r
1262  from notmuch.globals import nmlib, STATUS, NotmuchError\r
1263 =20\r
1264 -#-------------------------------------------------------------------------=\r
1265 -----\r
1266 +\r
1267  class Filenames(object):\r
1268      """Represents a list of filenames as returned by notmuch\r
1269 =20\r
1270 -    This object contains the Filenames iterator. The main function is as_g=\r
1271 enerator() which will return a generator so we can do a Filenamesth an iter=\r
1272 ator over a list of notmuch filenames. Do\r
1273 -    note that the underlying library only provides a one-time iterator\r
1274 -    (it cannot reset the iterator to the start). Thus iterating over\r
1275 -    the function will "exhaust" the list of tags, and a subsequent\r
1276 -    iteration attempt will raise a :exc:`NotmuchError`\r
1277 -    STATUS.NOT_INITIALIZED. Also note, that any function that uses\r
1278 -    iteration (nearly all) will also exhaust the tags. So both::\r
1279 +    This object contains the Filenames iterator. The main function is\r
1280 +    as_generator() which will return a generator so we can do a Filenamest=\r
1281 h an\r
1282 +    iterator over a list of notmuch filenames. Do note that the underlying\r
1283 +    library only provides a one-time iterator (it cannot reset the iterato=\r
1284 r to\r
1285 +    the start). Thus iterating over the function will "exhaust" the list of\r
1286 +    tags, and a subsequent iteration attempt will raise a :exc:`NotmuchErr=\r
1287 or`\r
1288 +    STATUS.NOT_INITIALIZED. Also note, that any function that uses iterati=\r
1289 on\r
1290 +    (nearly all) will also exhaust the tags. So both::\r
1291 =20\r
1292 -      for name in filenames: print name=20\r
1293 +      for name in filenames: print name\r
1294 =20\r
1295      as well as::\r
1296 =20\r
1297 @@ -85,10 +86,10 @@ class Filenames(object):\r
1298              self._files =3D None\r
1299              return\r
1300 =20\r
1301 -        file =3D Filenames._get (self._files)\r
1302 +        file =3D Filenames._get(self._files)\r
1303          nmlib.notmuch_filenames_move_to_next(self._files)\r
1304          yield file\r
1305 -       =20\r
1306 +\r
1307      def __str__(self):\r
1308          """Represent Filenames() as newline-separated list of full paths\r
1309 =20\r
1310 @@ -105,4 +106,4 @@ class Filenames(object):\r
1311      def __del__(self):\r
1312          """Close and free the notmuch filenames"""\r
1313          if self._files is not None:\r
1314 -            nmlib.notmuch_filenames_destroy (self._files)\r
1315 +            nmlib.notmuch_filenames_destroy(self._files)\r
1316 --=20\r
1317 1.7.4.1\r
1318 \r
1319 \r
1320 --hYooF8G/hrfVAmum\r
1321 Content-Type: text/x-diff; charset=us-ascii\r
1322 Content-Disposition: attachment; filename="0005-pep8-compliance-for-globals.py.patch"\r
1323 Content-Transfer-Encoding: quoted-printable\r
1324 \r
1325 =46rom 224636cd6339ea02a4d304df7b0e3ff958ea7718 Mon Sep 17 00:00:00 2001\r
1326 =46rom: pazz <patricktotzke@gmail.com>\r
1327 Date: Tue, 12 Jul 2011 21:16:04 +0100\r
1328 Subject: [PATCH 5/8] pep8 compliance for globals.py\r
1329 \r
1330 ---\r
1331  bindings/python/notmuch/globals.py |   26 ++++++++++++++++----------\r
1332  1 files changed, 16 insertions(+), 10 deletions(-)\r
1333 \r
1334 diff --git a/bindings/python/notmuch/globals.py b/bindings/python/notmuch/g=\r
1335 lobals.py\r
1336 index c675d04..77f2905 100644\r
1337 --- a/bindings/python/notmuch/globals.py\r
1338 +++ b/bindings/python/notmuch/globals.py\r
1339 @@ -27,14 +27,14 @@ try:\r
1340  except:\r
1341      raise ImportError("Could not find shared 'notmuch' library.")\r
1342 =20\r
1343 -#-------------------------------------------------------------------------=\r
1344 ----\r
1345 +\r
1346  class Enum(object):\r
1347      """Provides ENUMS as "code=3DEnum(['a','b','c'])" where code.a=3D0 etc=\r
1348 =2E.."""\r
1349      def __init__(self, names):\r
1350          for number, name in enumerate(names):\r
1351              setattr(self, name, number)\r
1352 =20\r
1353 -#-------------------------------------------------------------------------=\r
1354 ----\r
1355 +\r
1356  class Status(Enum):\r
1357      """Enum with a string representation of a notmuch_status_t value."""\r
1358      _status2str =3D nmlib.notmuch_status_to_string\r
1359 @@ -49,10 +49,10 @@ class Status(Enum):\r
1360 =20\r
1361      @classmethod\r
1362      def status2str(self, status):\r
1363 -        """Get a string representation of a notmuch_status_t value."""  =\r
1364 =20\r
1365 +        """Get a string representation of a notmuch_status_t value."""\r
1366          # define strings for custom error messages\r
1367          if status =3D=3D STATUS.NOT_INITIALIZED:\r
1368 -          return "Operation on uninitialized object impossible."\r
1369 +            return "Operation on uninitialized object impossible."\r
1370          return str(Status._status2str(status))\r
1371 =20\r
1372  STATUS =3D Status(['SUCCESS',\r
1373 @@ -66,7 +66,10 @@ STATUS =3D Status(['SUCCESS',\r
1374    'TAG_TOO_LONG',\r
1375    'UNBALANCED_FREEZE_THAW',\r
1376    'NOT_INITIALIZED'])\r
1377 -"""STATUS is a class, whose attributes provide constants that serve as ret=\r
1378 urn indicators for notmuch functions. Currently the following ones are defi=\r
1379 ned. For possible return values and specific meaning for each method, see t=\r
1380 he method description.\r
1381 +"""STATUS is a class, whose attributes provide constants that serve as ret=\r
1382 urn\r
1383 +indicators for notmuch functions. Currently the following ones are defined=\r
1384 =2E For\r
1385 +possible return values and specific meaning for each method, see the method\r
1386 +description.\r
1387 =20\r
1388    * SUCCESS\r
1389    * OUT_OF_MEMORY\r
1390 @@ -80,8 +83,10 @@ STATUS =3D Status(['SUCCESS',\r
1391    * UNBALANCED_FREEZE_THAW\r
1392    * NOT_INITIALIZED\r
1393 =20\r
1394 -  Invoke the class method `notmuch.STATUS.status2str` with a status value =\r
1395 as argument to receive a human readable string"""\r
1396 -STATUS.__name__ =3D 'STATUS'=20\r
1397 +Invoke the class method `notmuch.STATUS.status2str` with a status value as\r
1398 +argument to receive a human readable string"""\r
1399 +STATUS.__name__ =3D 'STATUS'\r
1400 +\r
1401 =20\r
1402  class NotmuchError(Exception):\r
1403      def __init__(self, status=3DNone, message=3DNone):\r
1404 @@ -89,6 +94,7 @@ class NotmuchError(Exception):\r
1405          super(NotmuchError, self).__init__(message, status)\r
1406 =20\r
1407      def __str__(self):\r
1408 -        if self.args[0] is not None: return self.args[0]\r
1409 -        else: return STATUS.status2str(self.args[1])\r
1410 -\r
1411 +        if self.args[0] is not None:\r
1412 +            return self.args[0]\r
1413 +        else:\r
1414 +            return STATUS.status2str(self.args[1])\r
1415 --=20\r
1416 1.7.4.1\r
1417 \r
1418 \r
1419 --hYooF8G/hrfVAmum\r
1420 Content-Type: text/x-diff; charset=us-ascii\r
1421 Content-Disposition: attachment; filename="0006-pep8-compliance-for-tag.py.patch"\r
1422 Content-Transfer-Encoding: quoted-printable\r
1423 \r
1424 =46rom b257591409a6c5d5804b0e34a81bd95912a07c59 Mon Sep 17 00:00:00 2001\r
1425 =46rom: pazz <patricktotzke@gmail.com>\r
1426 Date: Tue, 12 Jul 2011 21:17:03 +0100\r
1427 Subject: [PATCH 6/8] pep8 compliance for tag.py\r
1428 \r
1429 ---\r
1430  bindings/python/notmuch/tag.py |   14 +++++++-------\r
1431  1 files changed, 7 insertions(+), 7 deletions(-)\r
1432 \r
1433 diff --git a/bindings/python/notmuch/tag.py b/bindings/python/notmuch/tag.py\r
1434 index 65a9118..a664578 100644\r
1435 --- a/bindings/python/notmuch/tag.py\r
1436 +++ b/bindings/python/notmuch/tag.py\r
1437 @@ -19,12 +19,12 @@ Copyright 2010 Sebastian Spaeth <Sebastian@SSpaeth.de>'\r
1438  from ctypes import c_char_p\r
1439  from notmuch.globals import nmlib, STATUS, NotmuchError\r
1440 =20\r
1441 -#-------------------------------------------------------------------------=\r
1442 -----\r
1443 +\r
1444  class Tags(object):\r
1445      """Represents a list of notmuch tags\r
1446 =20\r
1447      This object provides an iterator over a list of notmuch tags (which\r
1448 -    are unicode instances).=20\r
1449 +    are unicode instances).\r
1450 =20\r
1451      Do note that the underlying library only provides a one-time\r
1452      iterator (it cannot reset the iterator to the start). Thus iterating\r
1453 @@ -33,7 +33,7 @@ class Tags(object):\r
1454      STATUS.NOT_INITIALIZED. Also note, that any function that uses\r
1455      iteration (nearly all) will also exhaust the tags. So both::\r
1456 =20\r
1457 -      for tag in tags: print tag=20\r
1458 +      for tag in tags: print tag\r
1459 =20\r
1460      as well as::\r
1461 =20\r
1462 @@ -62,7 +62,7 @@ class Tags(object):\r
1463               valid, we will raise an :exc:`NotmuchError`\r
1464               (STATUS.NULL_POINTER) if it is `None`.\r
1465          :type tags_p: :class:`ctypes.c_void_p`\r
1466 -        :param parent: The parent object (ie :class:`Database` or=20\r
1467 +        :param parent: The parent object (ie :class:`Database` or\r
1468               :class:`Message` these tags are derived from, and saves a\r
1469               reference to it, so we can automatically delete the db object\r
1470               once all derived objects are dead.\r
1471 @@ -75,7 +75,7 @@ class Tags(object):\r
1472          self._tags =3D tags_p\r
1473          #save reference to parent object so we keep it alive\r
1474          self._parent =3D parent\r
1475 -   =20\r
1476 +\r
1477      def __iter__(self):\r
1478          """ Make Tags an iterator """\r
1479          return self\r
1480 @@ -115,7 +115,7 @@ class Tags(object):\r
1481          if self._tags is None:\r
1482              raise NotmuchError(STATUS.NOT_INITIALIZED)\r
1483 =20\r
1484 -        i=3D0\r
1485 +        i =3D 0\r
1486          while nmlib.notmuch_tags_valid(self._msgs):\r
1487              nmlib.notmuch_tags_move_to_next(self._msgs)\r
1488              i +=3D 1\r
1489 @@ -136,4 +136,4 @@ class Tags(object):\r
1490      def __del__(self):\r
1491          """Close and free the notmuch tags"""\r
1492          if self._tags is not None:\r
1493 -            nmlib.notmuch_tags_destroy (self._tags)\r
1494 +            nmlib.notmuch_tags_destroy(self._tags)\r
1495 --=20\r
1496 1.7.4.1\r
1497 \r
1498 \r
1499 --hYooF8G/hrfVAmum\r
1500 Content-Type: text/x-diff; charset=us-ascii\r
1501 Content-Disposition: attachment; filename="0007-pep8-compliance-for-thread.py.patch"\r
1502 Content-Transfer-Encoding: quoted-printable\r
1503 \r
1504 =46rom 288f53704c95377f546a3b21651610a164c26950 Mon Sep 17 00:00:00 2001\r
1505 =46rom: pazz <patricktotzke@gmail.com>\r
1506 Date: Tue, 12 Jul 2011 21:22:13 +0100\r
1507 Subject: [PATCH 7/8] pep8 compliance for thread.py\r
1508 \r
1509 ---\r
1510  bindings/python/notmuch/thread.py |   65 ++++++++++++++++++++-------------=\r
1511 ----\r
1512  1 files changed, 35 insertions(+), 30 deletions(-)\r
1513 \r
1514 diff --git a/bindings/python/notmuch/thread.py b/bindings/python/notmuch/th=\r
1515 read.py\r
1516 index 2bb30b7..60f6c29 100644\r
1517 --- a/bindings/python/notmuch/thread.py\r
1518 +++ b/bindings/python/notmuch/thread.py\r
1519 @@ -23,7 +23,7 @@ from notmuch.message import Messages\r
1520  from notmuch.tag import Tags\r
1521  from datetime import date\r
1522 =20\r
1523 -#-------------------------------------------------------------------------=\r
1524 -----\r
1525 +\r
1526  class Threads(object):\r
1527      """Represents a list of notmuch threads\r
1528 =20\r
1529 @@ -59,13 +59,13 @@ class Threads(object):\r
1530        for thread in threads:\r
1531           threadlist.append(thread)\r
1532 =20\r
1533 -      # threads is "exhausted" now and even len(threads) will raise an=20\r
1534 +      # threads is "exhausted" now and even len(threads) will raise an\r
1535        # exception.\r
1536        # However it will be kept around until all retrieved Thread() object=\r
1537 s are\r
1538 -      # also deleted. If you did e.g. an explicit del(threads) here, the=\r
1539 =20\r
1540 +      # also deleted. If you did e.g. an explicit del(threads) here, the\r
1541        # following lines would fail.\r
1542 -     =20\r
1543 -      # You can reiterate over *threadlist* however as often as you want.=\r
1544 =20\r
1545 +\r
1546 +      # You can reiterate over *threadlist* however as often as you want.\r
1547        # It is simply a list with Thread objects.\r
1548 =20\r
1549        print (threadlist[0].get_thread_id())\r
1550 @@ -91,7 +91,7 @@ class Threads(object):\r
1551               (ie :class:`Query`) these tags are derived from. It saves\r
1552               a reference to it, so we can automatically delete the db\r
1553               object once all derived objects are dead.\r
1554 -        :TODO: Make the iterator work more than once and cache the tags in=\r
1555 =20\r
1556 +        :TODO: Make the iterator work more than once and cache the tags in\r
1557                 the Python object.(?)\r
1558          """\r
1559          if threads_p is None:\r
1560 @@ -113,14 +113,14 @@ class Threads(object):\r
1561              self._threads =3D None\r
1562              raise StopIteration\r
1563 =20\r
1564 -        thread =3D Thread(Threads._get (self._threads), self)\r
1565 +        thread =3D Thread(Threads._get(self._threads), self)\r
1566          nmlib.notmuch_threads_move_to_next(self._threads)\r
1567          return thread\r
1568 =20\r
1569      def __len__(self):\r
1570          """len(:class:`Threads`) returns the number of contained Threads\r
1571 =20\r
1572 -        .. note:: As this iterates over the threads, we will not be able t=\r
1573 o=20\r
1574 +        .. note:: As this iterates over the threads, we will not be able to\r
1575                 iterate over them again! So this will fail::\r
1576 =20\r
1577                   #THIS FAILS\r
1578 @@ -132,7 +132,7 @@ class Threads(object):\r
1579          if self._threads is None:\r
1580              raise NotmuchError(STATUS.NOT_INITIALIZED)\r
1581 =20\r
1582 -        i=3D0\r
1583 +        i =3D 0\r
1584          # returns 'bool'. On out-of-memory it returns None\r
1585          while nmlib.notmuch_threads_valid(self._threads):\r
1586              nmlib.notmuch_threads_move_to_next(self._threads)\r
1587 @@ -143,7 +143,7 @@ class Threads(object):\r
1588 =20\r
1589      def __nonzero__(self):\r
1590          """Check if :class:`Threads` contains at least one more valid thre=\r
1591 ad\r
1592 -       =20\r
1593 +\r
1594          The existence of this function makes 'if Threads: foo' work, as\r
1595          that will implicitely call len() exhausting the iterator if\r
1596          __nonzero__ does not exist. This function makes `bool(Threads())`\r
1597 @@ -158,9 +158,9 @@ class Threads(object):\r
1598      def __del__(self):\r
1599          """Close and free the notmuch Threads"""\r
1600          if self._threads is not None:\r
1601 -            nmlib.notmuch_messages_destroy (self._threads)\r
1602 +            nmlib.notmuch_messages_destroy(self._threads)\r
1603 +\r
1604 =20\r
1605 -#-------------------------------------------------------------------------=\r
1606 -----\r
1607  class Thread(object):\r
1608      """Represents a single message thread."""\r
1609 =20\r
1610 @@ -218,7 +218,7 @@ class Thread(object):\r
1611          for as long as the thread is valid.\r
1612 =20\r
1613          :returns: String with a message ID\r
1614 -        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the thre=\r
1615 ad=20\r
1616 +        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the thre=\r
1617 ad\r
1618                      is not initialized.\r
1619          """\r
1620          if self._thread is None:\r
1621 @@ -231,14 +231,13 @@ class Thread(object):\r
1622          :returns: The number of all messages in the database\r
1623                    belonging to this thread. Contrast with\r
1624                    :meth:`get_matched_messages`.\r
1625 -        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the thre=\r
1626 ad=20\r
1627 +        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the thre=\r
1628 ad\r
1629                      is not initialized.\r
1630          """\r
1631          if self._thread is None:\r
1632              raise NotmuchError(STATUS.NOT_INITIALIZED)\r
1633          return nmlib.notmuch_thread_get_total_messages(self._thread)\r
1634 =20\r
1635 -\r
1636      def get_toplevel_messages(self):\r
1637          """Returns a :class:`Messages` iterator for the top-level messages=\r
1638  in\r
1639             'thread'\r
1640 @@ -246,7 +245,7 @@ class Thread(object):\r
1641             This iterator will not necessarily iterate over all of the mess=\r
1642 ages\r
1643             in the thread. It will only iterate over the messages in the th=\r
1644 read\r
1645             which are not replies to other messages in the thread.\r
1646 -=20\r
1647 +\r
1648             To iterate over all messages in the thread, the caller will nee=\r
1649 d to\r
1650             iterate over the result of :meth:`Message.get_replies` for each\r
1651             top-level message (and do that recursively for the resulting\r
1652 @@ -256,7 +255,7 @@ class Thread(object):\r
1653          :exception: :exc:`NotmuchError`\r
1654 =20\r
1655                        * STATUS.NOT_INITIALIZED if query is not inited\r
1656 -                      * STATUS.NULL_POINTER if search_messages failed=20\r
1657 +                      * STATUS.NULL_POINTER if search_messages failed\r
1658          """\r
1659          if self._thread is None:\r
1660              raise NotmuchError(STATUS.NOT_INITIALIZED)\r
1661 @@ -266,15 +265,15 @@ class Thread(object):\r
1662          if msgs_p is None:\r
1663              NotmuchError(STATUS.NULL_POINTER)\r
1664 =20\r
1665 -        return Messages(msgs_p,self)\r
1666 +        return Messages(msgs_p, self)\r
1667 =20\r
1668      def get_matched_messages(self):\r
1669          """Returns the number of messages in 'thread' that matched the que=\r
1670 ry\r
1671 =20\r
1672 -        :returns: The number of all messages belonging to this thread that=\r
1673 =20\r
1674 +        :returns: The number of all messages belonging to this thread that\r
1675                    matched the :class:`Query`from which this thread was cre=\r
1676 ated.\r
1677                    Contrast with :meth:`get_total_messages`.\r
1678 -        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the thre=\r
1679 ad=20\r
1680 +        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the thre=\r
1681 ad\r
1682                      is not initialized.\r
1683          """\r
1684          if self._thread is None:\r
1685 @@ -288,7 +287,7 @@ class Thread(object):\r
1686          authors of mail messages in the query results that belong to this\r
1687          thread.\r
1688 =20\r
1689 -        The returned string belongs to 'thread' and will only be valid for=\r
1690 =20\r
1691 +        The returned string belongs to 'thread' and will only be valid for\r
1692          as long as this Thread() is not deleted.\r
1693          """\r
1694          if self._thread is None:\r
1695 @@ -298,7 +297,7 @@ class Thread(object):\r
1696      def get_subject(self):\r
1697          """Returns the Subject of 'thread'\r
1698 =20\r
1699 -        The returned string belongs to 'thread' and will only be valid for=\r
1700 =20\r
1701 +        The returned string belongs to 'thread' and will only be valid for\r
1702          as long as this Thread() is not deleted.\r
1703          """\r
1704          if self._thread is None:\r
1705 @@ -310,7 +309,7 @@ class Thread(object):\r
1706 =20\r
1707          :returns: A time_t timestamp.\r
1708          :rtype: c_unit64\r
1709 -        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the mess=\r
1710 age=20\r
1711 +        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the mess=\r
1712 age\r
1713                      is not initialized.\r
1714          """\r
1715          if self._thread is None:\r
1716 @@ -322,7 +321,7 @@ class Thread(object):\r
1717 =20\r
1718          :returns: A time_t timestamp.\r
1719          :rtype: c_unit64\r
1720 -        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the mess=\r
1721 age=20\r
1722 +        :exception: :exc:`NotmuchError` STATUS.NOT_INITIALIZED if the mess=\r
1723 age\r
1724                      is not initialized.\r
1725          """\r
1726          if self._thread is None:\r
1727 @@ -337,14 +336,14 @@ class Thread(object):\r
1728          tags of the messages which matched the search and which belong to\r
1729          this thread.\r
1730 =20\r
1731 -        The :class:`Tags` object is owned by the thread and as such, will =\r
1732 only=20\r
1733 -        be valid for as long as this :class:`Thread` is valid (e.g. until =\r
1734 the=20\r
1735 +        The :class:`Tags` object is owned by the thread and as such, will =\r
1736 only\r
1737 +        be valid for as long as this :class:`Thread` is valid (e.g. until =\r
1738 the\r
1739          query from which it derived is explicitely deleted).\r
1740 =20\r
1741          :returns: A :class:`Tags` iterator.\r
1742          :exception: :exc:`NotmuchError`\r
1743 =20\r
1744 -                      * STATUS.NOT_INITIALIZED if the thread=20\r
1745 +                      * STATUS.NOT_INITIALIZED if the thread\r
1746                          is not initialized.\r
1747                        * STATUS.NULL_POINTER, on error\r
1748          """\r
1749 @@ -355,7 +354,7 @@ class Thread(object):\r
1750          if tags_p =3D=3D None:\r
1751              raise NotmuchError(STATUS.NULL_POINTER)\r
1752          return Tags(tags_p, self)\r
1753 -=20\r
1754 +\r
1755      def __str__(self):\r
1756          """A str(Thread()) is represented by a 1-line summary"""\r
1757          thread =3D {}\r
1758 @@ -374,9 +373,15 @@ class Thread(object):\r
1759          thread['subject'] =3D self.get_subject()\r
1760          thread['tags'] =3D self.get_tags()\r
1761 =20\r
1762 -        return "thread:%(id)s %(date)12s [%(matched)d/%(total)d] %(authors=\r
1763 )s; %(subject)s (%(tags)s)" % (thread)\r
1764 +        return "thread:%s %12s [%d/%d] %s; %s (%s)" % (thread['id'],\r
1765 +                                                       thread['date'],\r
1766 +                                                       thread['matched'],\r
1767 +                                                       thread['total'],\r
1768 +                                                       thread['authors'],\r
1769 +                                                       thread['subject'],\r
1770 +                                                       thread['tags'])\r
1771 =20\r
1772      def __del__(self):\r
1773          """Close and free the notmuch Thread"""\r
1774          if self._thread is not None:\r
1775 -            nmlib.notmuch_thread_destroy (self._thread)\r
1776 +            nmlib.notmuch_thread_destroy(self._thread)\r
1777 --=20\r
1778 1.7.4.1\r
1779 \r
1780 \r
1781 --hYooF8G/hrfVAmum\r
1782 Content-Type: text/x-diff; charset=us-ascii\r
1783 Content-Disposition: attachment; filename="0008-pep8-compliance-for-__init__.py.patch"\r
1784 Content-Transfer-Encoding: quoted-printable\r
1785 \r
1786 =46rom 3acb98be0151a6c7e310a4e6334d069a383a4459 Mon Sep 17 00:00:00 2001\r
1787 =46rom: pazz <patricktotzke@gmail.com>\r
1788 Date: Tue, 12 Jul 2011 21:23:37 +0100\r
1789 Subject: [PATCH 8/8] pep8 compliance for __init__.py\r
1790 \r
1791 ---\r
1792  bindings/python/notmuch/__init__.py |   11 ++++++-----\r
1793  1 files changed, 6 insertions(+), 5 deletions(-)\r
1794 \r
1795 diff --git a/bindings/python/notmuch/__init__.py b/bindings/python/notmuch/=\r
1796 __init__.py\r
1797 index 4331d9d..cb64f3c 100644\r
1798 --- a/bindings/python/notmuch/__init__.py\r
1799 +++ b/bindings/python/notmuch/__init__.py\r
1800 @@ -1,9 +1,10 @@\r
1801 -"""The :mod:`notmuch` module provides most of the functionality that a use=\r
1802 r is likely to need.\r
1803 +"""The :mod:`notmuch` module provides most of the functionality that a use=\r
1804 r is\r
1805 +likely to need.\r
1806 =20\r
1807  .. note:: The underlying notmuch library is build on a hierarchical\r
1808      memory allocator called talloc. All objects derive from a\r
1809      top-level :class:`Database` object.\r
1810 -   =20\r
1811 +\r
1812      This means that as soon as an object is deleted, all underlying\r
1813      derived objects such as Queries, Messages, Message, and Tags will\r
1814      be freed by the underlying library as well. Accessing these\r
1815 @@ -56,6 +57,6 @@ from notmuch.message import Messages, Message\r
1816  from notmuch.thread import Threads, Thread\r
1817  from notmuch.tag import Tags\r
1818  from notmuch.globals import nmlib, STATUS, NotmuchError\r
1819 -__LICENSE__=3D"GPL v3+"\r
1820 -__VERSION__=3D'0.6'\r
1821 -__AUTHOR__ =3D'Sebastian Spaeth <Sebastian@SSpaeth.de>'\r
1822 +__LICENSE__ =3D "GPL v3+"\r
1823 +__VERSION__ =3D '0.6'\r
1824 +__AUTHOR__ =3D 'Sebastian Spaeth <Sebastian@SSpaeth.de>'\r
1825 --=20\r
1826 1.7.4.1\r
1827 \r
1828 \r
1829 --hYooF8G/hrfVAmum--\r
1830 \r
1831 --g7w8+K/95kPelPD2\r
1832 Content-Type: application/pgp-signature; name="signature.asc"\r
1833 Content-Description: Digital signature\r
1834 \r
1835 -----BEGIN PGP SIGNATURE-----\r
1836 Version: GnuPG v1.4.11 (GNU/Linux)\r
1837 \r
1838 iEYEARECAAYFAk4csHEACgkQlDQDZ9fWxarsoQCdGVgyr1+euBL93S84tpt4LWTp\r
1839 cmgAoJmUYNDV52WRfj3Gz77IhxuduLvP\r
1840 =wITe\r
1841 -----END PGP SIGNATURE-----\r
1842 \r
1843 --g7w8+K/95kPelPD2--\r