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 5FD06431FD0 for ; Sat, 24 Dec 2011 01:44:54 -0800 (PST) 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 3nL75edUxOpI for ; Sat, 24 Dec 2011 01:44:53 -0800 (PST) Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com [74.125.83.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 8CE1C431FB6 for ; Sat, 24 Dec 2011 01:44:53 -0800 (PST) Received: by eekd41 with SMTP id d41so11917994eek.26 for ; Sat, 24 Dec 2011 01:44:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=message-id:content-type:mime-version:content-transfer-encoding:to :from:subject:date; bh=ovP8dasaK99hPg2+CLvj6PzPokE5IMGrff2UVB+PRxg=; b=uOCdwE8+l5pUHXZjOicf9NhBTGMTElLOloyvBoLIbpADfH31QVYsj2ffoqlYhJhfSR EtSi+Fpx7LT6MyDZbGmZbG+X/QoycyHpcOIN4CWbK/WjKDgRA4NIu0TZrINTwyg9I1j6 t8Lj1heT2Zc0Ru/x3aerwcYqANS8bOQyR/NxI= Received: by 10.14.100.193 with SMTP id z41mr7224111eef.113.1324719890845; Sat, 24 Dec 2011 01:44:50 -0800 (PST) Received: from localhost (g224022183.adsl.alicedsl.de. [92.224.22.183]) by mx.google.com with ESMTPS id b49sm29320584eec.9.2011.12.24.01.44.49 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 24 Dec 2011 01:44:49 -0800 (PST) Message-ID: <4ef59f11.c9330e0a.78cb.324c@mx.google.com> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: Notmuch Mailing List From: Patrick Totzke Subject: [python] Threads/Messages inconsistencies Date: Sat, 24 Dec 2011 09:44:47 +0000 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: Sat, 24 Dec 2011 09:44:54 -0000 Hi, I noticed some inconsistencies in the way the bindings treat Threads and Messages which in my opinion should look and behave alike. 1. There is no Query.count_threads as an equivalent to Query.count_messages, although there seems to be a function `notmuch_query_count_threads` offered by the library 2. The docstring of Query.count_messages falsely states it's return value is a Messages object, when it in fact returns a long. 3. The docstring of Threads contains a line = "number_of_msgs =3D len(threads)" which should be "number_of_threads =3D len(threads)" 4. Threads.__len__ smells wrong: I have 10 messages in 9 threads in my inbo= x, pazz@brick:~$ python Python 2.7.2+ (default, Oct 4 2011, 20:06:09) = [GCC 4.6.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import notmuch >>> d=3Dnotmuch.Database() >>> q=3Dd.create_query('is:inbox and not is:killed') >>> = >>> q.count_messages() 10L >>> len(list(q.search_messages())) 10 >>> = >>> len(q.search_threads()) 10 >>> list(q.search_threads()) Traceback (most recent call last): File "", line 1, in File "/home/pazz/.local/lib/python2.7/site-packages/notmuch/thread.py"= , line 121, in next raise NotmuchError(STATUS.NOT_INITIALIZED) notmuch.globals.NotInitializedError: Operation on uninitialized object i= mpossible. >>> = The python session above speaks for itself I believe but this is what I = consider bad behaviour, just to make sure: * why does list(q.search_messages() go through and list(q.search_threads= () fails? * why does len(q.search_threads()) return 10 and not 9 as expected? I have corrected the docstrings myself and copied the code from Query.count= _messages to provide a Query.count_threads. The two patches can be pulled from pazz.g= ithub.org/notmuch. The count_threads patch doesn't work however, which is really surprising as= the code is straightforward. When I do a import notmuch after applying the patch, I = get: AttributeError: /usr/local/lib/libnotmuch.so.2: undefined symbol: notmuch= _query_count_threads Best, /p