[PATCH] emacs: make the remaining faces configurable.
[notmuch-archives.git] / aa / ddc53f4bafc66df4fb52bb5c82f642f49c6970
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 9FC09429E32\r
6         for <notmuch@notmuchmail.org>; Mon,  5 Dec 2011 13:13:04 -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.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 UYbloldiyXby for <notmuch@notmuchmail.org>;\r
17         Mon,  5 Dec 2011 13:13:00 -0800 (PST)\r
18 Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com\r
19  [74.125.83.53])        (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  A2CBD429E2F    for <notmuch@notmuchmail.org>; Mon,  5 Dec 2011 13:12:57 -0800\r
22  (PST)\r
23 Received: by eekb57 with SMTP id b57so1074011eek.26\r
24         for <notmuch@notmuchmail.org>; Mon, 05 Dec 2011 13:12:56 -0800 (PST)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
26         d=googlemail.com; s=gamma;\r
27         h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
28         bh=R1OmmnK56W/VWR1B8g3OKcFq9zezpqHCS/cqXZ8Da4w=;\r
29         b=BzV9BTiQsvk2TpZ3xh0yECawhTKwvsfR/9YEm1jrASLFRwPNbB4lsLky+QCqEN1PPp\r
30         kmhwb8n3LDPp4RZn/XLwKcXolqm0u1znmcmkqvLu3NG6EnDqLesiNp6YrK1A2FMTgNfo\r
31         eQv83DmNiAy+a2nWymyoNuMyF5w/i+C2X8AFw=\r
32 Received: by 10.14.9.13 with SMTP id 13mr1462321ees.90.1323119576376;\r
33         Mon, 05 Dec 2011 13:12:56 -0800 (PST)\r
34 Received: from localhost (cpc1-sgyl2-0-0-cust548.18-2.cable.virginmedia.com.\r
35         [82.41.10.37])\r
36         by mx.google.com with ESMTPS id a60sm63166312eeb.4.2011.12.05.13.12.54\r
37         (version=TLSv1/SSLv3 cipher=OTHER);\r
38         Mon, 05 Dec 2011 13:12:55 -0800 (PST)\r
39 From: Patrick Totzke <patricktotzke@googlemail.com>\r
40 To: notmuch@notmuchmail.org\r
41 Subject: [PATCH 1/3] pep8 fixes\r
42 Date: Mon,  5 Dec 2011 21:12:33 +0000\r
43 Message-Id: <1323119555-31416-2-git-send-email-patricktotzke@gmail.com>\r
44 X-Mailer: git-send-email 1.7.4.1\r
45 In-Reply-To: <1323119555-31416-1-git-send-email-patricktotzke@gmail.com>\r
46 References: <1323119555-31416-1-git-send-email-patricktotzke@gmail.com>\r
47 X-BeenThere: notmuch@notmuchmail.org\r
48 X-Mailman-Version: 2.1.13\r
49 Precedence: list\r
50 List-Id: "Use and development of the notmuch mail system."\r
51         <notmuch.notmuchmail.org>\r
52 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
53         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
54 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
55 List-Post: <mailto:notmuch@notmuchmail.org>\r
56 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
57 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
58         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
59 X-List-Received-Date: Mon, 05 Dec 2011 21:13:06 -0000\r
60 \r
61 no changes to the code, only fixed stuff denounced by `pep8 *py`\r
62 ---\r
63  bindings/python/notmuch/__init__.py |    2 +-\r
64  bindings/python/notmuch/database.py |   28 +++++++++++++++----------\r
65  bindings/python/notmuch/globals.py  |   38 +++++++++++++++++++++++++++++++---\r
66  bindings/python/notmuch/thread.py   |    1 -\r
67  4 files changed, 52 insertions(+), 17 deletions(-)\r
68 \r
69 diff --git a/bindings/python/notmuch/__init__.py b/bindings/python/notmuch/__init__.py\r
70 index 539afed..f3ff987 100644\r
71 --- a/bindings/python/notmuch/__init__.py\r
72 +++ b/bindings/python/notmuch/__init__.py\r
73 @@ -69,7 +69,7 @@ from notmuch.globals import (\r
74      TagTooLongError,\r
75      UnbalancedFreezeThawError,\r
76      UnbalancedAtomicError,\r
77 -    NotInitializedError\r
78 +    NotInitializedError,\r
79  )\r
80  from notmuch.version import __VERSION__\r
81  __LICENSE__ = "GPL v3+"\r
82 diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py\r
83 index 25b4b1b..ca17273 100644\r
84 --- a/bindings/python/notmuch/database.py\r
85 +++ b/bindings/python/notmuch/database.py\r
86 @@ -27,6 +27,7 @@ from notmuch.thread import Threads\r
87  from notmuch.message import Messages, Message\r
88  from notmuch.tag import Tags\r
89  \r
90 +\r
91  class Database(object):\r
92      """The :class:`Database` is the highest-level object that notmuch\r
93      provides. It references a notmuch database, and can be opened in\r
94 @@ -83,12 +84,14 @@ class Database(object):\r
95  \r
96      """ notmuch_database_find_message"""\r
97      _find_message = nmlib.notmuch_database_find_message\r
98 -    _find_message.argtypes = [NotmuchDatabaseP, c_char_p, POINTER(NotmuchMessageP)]\r
99 +    _find_message.argtypes = [NotmuchDatabaseP, c_char_p,\r
100 +                              POINTER(NotmuchMessageP)]\r
101      _find_message.restype = c_uint\r
102  \r
103      """notmuch_database_find_message_by_filename"""\r
104      _find_message_by_filename = nmlib.notmuch_database_find_message_by_filename\r
105 -    _find_message_by_filename.argtypes = [NotmuchDatabaseP, c_char_p, POINTER(NotmuchMessageP)]\r
106 +    _find_message_by_filename.argtypes = [NotmuchDatabaseP, c_char_p,\r
107 +                                          POINTER(NotmuchMessageP)]\r
108      _find_message_by_filename.restype = c_uint\r
109  \r
110      """notmuch_database_get_all_tags"""\r
111 @@ -177,8 +180,8 @@ class Database(object):\r
112          :param status: Open the database in read-only or read-write mode\r
113          :type status:  :attr:`MODE`\r
114          :returns: Nothing\r
115 -        :exception: Raises :exc:`NotmuchError` in case\r
116 -            of any failure (possibly after printing an error message on stderr).\r
117 +        :exception: Raises :exc:`NotmuchError` in case of any failure\r
118 +                    (possibly after printing an error message on stderr).\r
119          """\r
120          res = Database._open(_str(path), mode)\r
121  \r
122 @@ -293,12 +296,12 @@ class Database(object):\r
123          (creating it if it does not exist(?))\r
124  \r
125          .. warning:: This call needs a writeable database in\r
126 -           :attr:`Database.MODE`.READ_WRITE mode. The underlying library will exit the\r
127 -           program if this method is used on a read-only database!\r
128 +           :attr:`Database.MODE`.READ_WRITE mode. The underlying library will\r
129 +           exit the program if this method is used on a read-only database!\r
130  \r
131          :param path: An unicode string containing the path relative to the path\r
132 -              of database (see :meth:`get_path`), or else should be an absolute path\r
133 -              with initial components that match the path of 'database'.\r
134 +              of database (see :meth:`get_path`), or else should be an absolute\r
135 +              path with initial components that match the path of 'database'.\r
136          :returns: :class:`Directory` or raises an exception.\r
137          :exception:\r
138              :exc:`NotmuchError` with :attr:`STATUS`.FILE_ERROR\r
139 @@ -325,7 +328,8 @@ class Database(object):\r
140          return Directory(_str(abs_dirpath), dir_p, self)\r
141  \r
142      _add_message = nmlib.notmuch_database_add_message\r
143 -    _add_message.argtypes = [NotmuchDatabaseP, c_char_p, POINTER(NotmuchMessageP)]\r
144 +    _add_message.argtypes = [NotmuchDatabaseP, c_char_p,\r
145 +                             POINTER(NotmuchMessageP)]\r
146      _add_message.restype = c_uint\r
147  \r
148      def add_message(self, filename, sync_maildir_flags=False):\r
149 @@ -490,7 +494,8 @@ class Database(object):\r
150          """Returns :class:`Tags` with a list of all tags found in the database\r
151  \r
152          :returns: :class:`Tags`\r
153 -        :execption: :exc:`NotmuchError` with :attr:`STATUS`.NULL_POINTER on error\r
154 +        :execption: :exc:`NotmuchError` with :attr:`STATUS`.NULL_POINTER\r
155 +                    on error\r
156          """\r
157          self._assert_db_is_initialized()\r
158          tags_p = Database._get_all_tags(self._db)\r
159 @@ -748,7 +753,8 @@ class Directory(object):\r
160      _get_child_directories.restype = NotmuchFilenamesP\r
161  \r
162      def _assert_dir_is_initialized(self):\r
163 -        """Raises a NotmuchError(:attr:`STATUS`.NOT_INITIALIZED) if dir_p is None"""\r
164 +        """Raises a NotmuchError(:attr:`STATUS`.NOT_INITIALIZED)\r
165 +        if dir_p is None"""\r
166          if self._dir_p is None:\r
167              raise NotmuchError(STATUS.NOT_INITIALIZED)\r
168  \r
169 diff --git a/bindings/python/notmuch/globals.py b/bindings/python/notmuch/globals.py\r
170 index 36354fc..f5c8d52 100644\r
171 --- a/bindings/python/notmuch/globals.py\r
172 +++ b/bindings/python/notmuch/globals.py\r
173 @@ -89,6 +89,7 @@ Invoke the class method `notmuch.STATUS.status2str` with a status value as\r
174  argument to receive a human readable string"""\r
175  STATUS.__name__ = 'STATUS'\r
176  \r
177 +\r
178  class NotmuchError(Exception):\r
179      """Is initiated with a (notmuch.STATUS[, message=None]). It will not\r
180      return an instance of the class NotmuchError, but a derived instance\r
181 @@ -97,7 +98,8 @@ class NotmuchError(Exception):\r
182  \r
183      @classmethod\r
184      def get_exc_subclass(cls, status):\r
185 -        """Returns a fine grained Exception() type,detailing the error status"""\r
186 +        """Returns a fine grained Exception() type,\r
187 +        detailing the error status"""\r
188          subclasses = {\r
189              STATUS.OUT_OF_MEMORY: OutOfMemoryError,\r
190              STATUS.READ_ONLY_DATABASE: ReadOnlyDatabaseError,\r
191 @@ -109,7 +111,7 @@ class NotmuchError(Exception):\r
192              STATUS.TAG_TOO_LONG: TagTooLongError,\r
193              STATUS.UNBALANCED_FREEZE_THAW: UnbalancedFreezeThawError,\r
194              STATUS.UNBALANCED_ATOMIC: UnbalancedAtomicError,\r
195 -            STATUS.NOT_INITIALIZED: NotInitializedError\r
196 +            STATUS.NOT_INITIALIZED: NotInitializedError,\r
197          }\r
198          assert 0 < status <= len(subclasses)\r
199          return subclasses[status]\r
200 @@ -125,7 +127,7 @@ class NotmuchError(Exception):\r
201          # no 'status' or cls is subclass already, return 'cls' instance\r
202          if not status or cls != NotmuchError:\r
203              return super(NotmuchError, cls).__new__(cls)\r
204 -        subclass = cls.get_exc_subclass(status) # which class to use?\r
205 +        subclass = cls.get_exc_subclass(status)  # which class to use?\r
206          return subclass.__new__(subclass, *args, **kwargs)\r
207  \r
208      def __init__(self, status=None, message=None):\r
209 @@ -140,28 +142,49 @@ class NotmuchError(Exception):\r
210          else:\r
211              return 'Unknown error'\r
212  \r
213 +\r
214  # List of Subclassed exceptions that correspond to STATUS values and are\r
215  # subclasses of NotmuchError.\r
216  class OutOfMemoryError(NotmuchError):\r
217      status = STATUS.OUT_OF_MEMORY\r
218 +\r
219 +\r
220  class ReadOnlyDatabaseError(NotmuchError):\r
221      status = STATUS.READ_ONLY_DATABASE\r
222 +\r
223 +\r
224  class XapianError(NotmuchError):\r
225      status = STATUS.XAPIAN_EXCEPTION\r
226 +\r
227 +\r
228  class FileError(NotmuchError):\r
229      status = STATUS.FILE_ERROR\r
230 +\r
231 +\r
232  class FileNotEmailError(NotmuchError):\r
233      status = STATUS.FILE_NOT_EMAIL\r
234 +\r
235 +\r
236  class DuplicateMessageIdError(NotmuchError):\r
237      status = STATUS.DUPLICATE_MESSAGE_ID\r
238 +\r
239 +\r
240  class NullPointerError(NotmuchError):\r
241      status = STATUS.NULL_POINTER\r
242 +\r
243 +\r
244  class TagTooLongError(NotmuchError):\r
245      status = STATUS.TAG_TOO_LONG\r
246 +\r
247 +\r
248  class UnbalancedFreezeThawError(NotmuchError):\r
249      status = STATUS.UNBALANCED_FREEZE_THAW\r
250 +\r
251 +\r
252  class UnbalancedAtomicError(NotmuchError):\r
253      status = STATUS.UNBALANCED_ATOMIC\r
254 +\r
255 +\r
256  class NotInitializedError(NotmuchError):\r
257      """Derived from NotmuchError, this occurs if the underlying data\r
258      structure (e.g. database is not initialized (yet) or an iterator has\r
259 @@ -170,7 +193,6 @@ class NotInitializedError(NotmuchError):\r
260      status = STATUS.NOT_INITIALIZED\r
261  \r
262  \r
263 -\r
264  def _str(value):\r
265      """Ensure a nicely utf-8 encoded string to pass to libnotmuch\r
266  \r
267 @@ -187,34 +209,42 @@ class NotmuchDatabaseS(Structure):\r
268      pass\r
269  NotmuchDatabaseP = POINTER(NotmuchDatabaseS)\r
270  \r
271 +\r
272  class NotmuchQueryS(Structure):\r
273      pass\r
274  NotmuchQueryP = POINTER(NotmuchQueryS)\r
275  \r
276 +\r
277  class NotmuchThreadsS(Structure):\r
278      pass\r
279  NotmuchThreadsP = POINTER(NotmuchThreadsS)\r
280  \r
281 +\r
282  class NotmuchThreadS(Structure):\r
283      pass\r
284  NotmuchThreadP = POINTER(NotmuchThreadS)\r
285  \r
286 +\r
287  class NotmuchMessagesS(Structure):\r
288      pass\r
289  NotmuchMessagesP = POINTER(NotmuchMessagesS)\r
290  \r
291 +\r
292  class NotmuchMessageS(Structure):\r
293      pass\r
294  NotmuchMessageP = POINTER(NotmuchMessageS)\r
295  \r
296 +\r
297  class NotmuchTagsS(Structure):\r
298      pass\r
299  NotmuchTagsP = POINTER(NotmuchTagsS)\r
300  \r
301 +\r
302  class NotmuchDirectoryS(Structure):\r
303      pass\r
304  NotmuchDirectoryP = POINTER(NotmuchDirectoryS)\r
305  \r
306 +\r
307  class NotmuchFilenamesS(Structure):\r
308      pass\r
309  NotmuchFilenamesP = POINTER(NotmuchFilenamesS)\r
310 diff --git a/bindings/python/notmuch/thread.py b/bindings/python/notmuch/thread.py\r
311 index d903c76..dbd6c0f 100644\r
312 --- a/bindings/python/notmuch/thread.py\r
313 +++ b/bindings/python/notmuch/thread.py\r
314 @@ -247,7 +247,6 @@ class Thread(object):\r
315              raise NotmuchError(STATUS.NOT_INITIALIZED)\r
316          return Thread._get_thread_id(self._thread)\r
317  \r
318 -\r
319      _get_total_messages = nmlib.notmuch_thread_get_total_messages\r
320      _get_total_messages.argtypes = [NotmuchThreadP]\r
321      _get_total_messages.restype = c_int\r
322 -- \r
323 1.7.4.1\r
324 \r