From ab46d65dd5da1db7b7ea90e312560151d8fec38b Mon Sep 17 00:00:00 2001 From: Thibaut Horel Date: Tue, 12 Aug 2014 00:43:54 +2000 Subject: [PATCH] [PATCH] python: Add binding for notmuch_query_add_tag_exclude --- ee/4d621fcd498ebc90a9d0a37a8729da597bfdf8 | 130 ++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 ee/4d621fcd498ebc90a9d0a37a8729da597bfdf8 diff --git a/ee/4d621fcd498ebc90a9d0a37a8729da597bfdf8 b/ee/4d621fcd498ebc90a9d0a37a8729da597bfdf8 new file mode 100644 index 000000000..16bf1d1cc --- /dev/null +++ b/ee/4d621fcd498ebc90a9d0a37a8729da597bfdf8 @@ -0,0 +1,130 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id C1340431FAF + for ; Sun, 10 Aug 2014 21:44:17 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.799 +X-Spam-Level: +X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id K0bkou9R0w38 for ; + Sun, 10 Aug 2014 21:44:11 -0700 (PDT) +Received: from mail-qa0-f54.google.com (mail-qa0-f54.google.com + [209.85.216.54]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id C122B431FAE + for ; Sun, 10 Aug 2014 21:44:11 -0700 (PDT) +Received: by mail-qa0-f54.google.com with SMTP id k15so7619139qaq.27 + for ; Sun, 10 Aug 2014 21:44:11 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=date:from:to:subject:message-id:mime-version:content-type + :content-disposition:user-agent; + bh=GhmovSHkbVaoQZWnbj2K9ymH9Kqr2i89DPLskRApGuw=; + b=hVFq1gbW9HGbc+TSTAV0zJWEKG7udACeRFZiikG6KeEVhovHiI+wjmo0HBwWip3Jgh + fKtB5XfyuA4MZDDQs/Mf7OdyJc0hIM7y7xBDKsEZo3MQjTTU+Ps4cq+QvJ3S8G1cLAtl + JkhZitdL/JbkZx/T78EOookH+3WfIH0g1IUsWNRKq9BWHDWWGEC0Aj1Pk2+I3BNGu6NX + 6LXqsp4vf+9yjUxzpxz7g279f89uGOyTfJxvzyijCsFpDgeMIEfflLw/ov1NfUt2iczQ + 7oj/swcmTeN8dFIIze+LXKuIRVJ0NsFc4qT9Q/DkF3c+Gm9quvSst9dZh2aPUXM9OGAv + OaBw== +X-Received: by 10.140.22.69 with SMTP id 63mr45538863qgm.23.1407732249090; + Sun, 10 Aug 2014 21:44:09 -0700 (PDT) +Received: from localhost (wrls-140-247-19-103.wrls.harvard.edu. + [140.247.19.103]) by mx.google.com with ESMTPSA id + n20sm19372053qar.38.2014.08.10.21.44.07 for + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Sun, 10 Aug 2014 21:44:08 -0700 (PDT) +Date: Mon, 11 Aug 2014 00:43:54 -0400 +From: Thibaut Horel +To: notmuch@notmuchmail.org +Subject: [PATCH] python: Add binding for notmuch_query_add_tag_exclude +Message-ID: <20140811044354.GA18790@spoon.client.fas.harvard.edu> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii; format=flowed +Content-Disposition: inline +User-Agent: Mutt/1.5.23 (2014-03-12) +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 11 Aug 2014 04:44:17 -0000 + +Implemented as the method `exclude_tag` of the class `Query`. This method takes +one argument, a string containing the name of the tag to exclude. +--- + NEWS | 5 +++++ + bindings/python/docs/source/query.rst | 2 ++ + bindings/python/notmuch/query.py | 15 +++++++++++++++ + 3 files changed, 22 insertions(+) + +diff --git a/NEWS b/NEWS +index f7aaedf..2d85090 100644 +--- a/NEWS ++++ b/NEWS +@@ -22,6 +22,11 @@ from the config file. Use something like: + ... + }, + ++Python Bindings ++--------------- ++ ++Add support for `notmuch_query_add_tag_exclude` ++ + Notmuch 0.18.1 (2014-06-25) + =========================== + +diff --git a/bindings/python/docs/source/query.rst b/bindings/python/docs/source/query.rst +index ddfc348..044b573 100644 +--- a/bindings/python/docs/source/query.rst ++++ b/bindings/python/docs/source/query.rst +@@ -32,6 +32,8 @@ + :attr:`Query.SORT`) if explicitely specified via + :meth:`set_sort`. By default it is set to `None`. + ++ .. automethod:: exclude_tag ++ + .. automethod:: search_threads + + .. automethod:: search_messages +diff --git a/bindings/python/notmuch/query.py b/bindings/python/notmuch/query.py +index b11a399..94773ac 100644 +--- a/bindings/python/notmuch/query.py ++++ b/bindings/python/notmuch/query.py +@@ -118,6 +118,21 @@ class Query(object): + self.sort = sort + self._set_sort(self._query, sort) + ++ _exclude_tag = nmlib.notmuch_query_add_tag_exclude ++ _exclude_tag.argtypes = [NotmuchQueryP, c_char_p] ++ _exclude_tag.resttype = None ++ ++ def exclude_tag(self, tagname): ++ """Add a tag that will be excluded from the query results by default. ++ ++ This exclusion will be overridden if this tag appears explicitly in the ++ query. ++ ++ :param tagname: Name of the tag to be excluded ++ """ ++ self._assert_query_is_initialized() ++ self._exclude_tag(self._query, _str(tagname)) ++ + """notmuch_query_search_threads""" + _search_threads = nmlib.notmuch_query_search_threads + _search_threads.argtypes = [NotmuchQueryP] +-- +2.0.4 + -- 2.26.2