unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* New Python bindings (notmuch2 module) fail to exclude tags
@ 2020-11-20 15:54 Jorge P. de Morais Neto
  2020-11-20 18:02 ` David Bremner
  2020-11-20 18:17 ` Floris Bruynooghe
  0 siblings, 2 replies; 6+ messages in thread
From: Jorge P. de Morais Neto @ 2020-11-20 15:54 UTC (permalink / raw)
  To: notmuch

Hi.  I am trying to migrate my Python3 script to the new Python bindings
(notmuch2 module).  However, I cannot obtain a count of messages
matching a query excluding messages that have an exclude tag.  From the
command line:
    $ notmuch count 'is:.bf_spam'
    0

The CLI command correctly counts zero messages having '.bf_spam' tag,
because all such messages also have the excluded 'spam' tag.  But from
Python:

$ python3
Python 3.7.3 (default, Jul 25 2020, 13:03:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import notmuch2
>>> nm_db=notmuch2.Database()
>>> nm_db.count_messages('is:.bf_spam', exclude_tags=('spam',))
379
>>> nm_db.count_messages('is:.bf_spam', exclude_tags=('spam',), omit_excluded=nm_db.EXCLUDE.FALSE)
379
>>> nm_db.count_messages('is:.bf_spam', exclude_tags=('spam',), omit_excluded=nm_db.EXCLUDE.TRUE)
379
>>> nm_db.count_messages('is:.bf_spam', exclude_tags=('spam',), omit_excluded=nm_db.EXCLUDE.ALL)
379
>>> nm_db.count_messages('is:.bf_spam', exclude_tags=('spam',), omit_excluded=nm_db.EXCLUDE.FLAG)
379

Am I doing something wrong?

Regards

-- 
- <https://jorgemorais.gitlab.io/justice-for-rms/>
- If an email of mine arrives at your spam box, please notify me.
- Please adopt free/libre formats like PDF, ODF, Org, LaTeX, Opus, WebM and 7z.
- Free/libre software for Replicant, LineageOS and Android: https://f-droid.org
- [[https://www.gnu.org/philosophy/free-sw.html][What is free software?]]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-11-25 11:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-20 15:54 New Python bindings (notmuch2 module) fail to exclude tags Jorge P. de Morais Neto
2020-11-20 18:02 ` David Bremner
2020-11-20 18:17 ` Floris Bruynooghe
2020-11-21 21:51   ` Jorge P. de Morais Neto
2020-11-24 22:33     ` Floris Bruynooghe
2020-11-25 11:07       ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).