X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=bindings%2Fpython-cffi%2Fnotmuch2%2F_tags.py;h=ee5d2a34b2c210540b131539c3b0d159ee942a82;hb=59edcfd702072a172fbc975faa38ac65218c1d3e;hp=fe422a7944882d568eeaf81e2a3b7f8099db2bf9;hpb=e2df30f7a98f91543d0b3561dbb366eb4b3d812c;p=notmuch diff --git a/bindings/python-cffi/notmuch2/_tags.py b/bindings/python-cffi/notmuch2/_tags.py index fe422a79..ee5d2a34 100644 --- a/bindings/python-cffi/notmuch2/_tags.py +++ b/bindings/python-cffi/notmuch2/_tags.py @@ -110,6 +110,27 @@ class ImmutableTagSet(base.NotmuchObject, collections.abc.Set): def __eq__(self, other): return tuple(sorted(self.iter())) == tuple(sorted(other.iter())) + def issubset(self, other): + return self <= other + + def issuperset(self, other): + return self >= other + + def union(self, other): + return self | other + + def intersection(self, other): + return self & other + + def difference(self, other): + return self - other + + def symmetric_difference(self, other): + return self ^ other + + def copy(self): + return set(self) + def __hash__(self): return hash(tuple(self.iter())) @@ -140,7 +161,7 @@ class MutableTagSet(ImmutableTagSet, collections.abc.MutableSet): """ # Since we subclass ImmutableTagSet we inherit a __hash__. But we - # are mutable, setting it to None will make the Python machinary + # are mutable, setting it to None will make the Python machinery # recognise us as unhashable. __hash__ = None @@ -158,7 +179,7 @@ class MutableTagSet(ImmutableTagSet, collections.abc.MutableSet): :raises TypeError: If the tag is not a valid type. :raises TagTooLongError: If the added tag exceeds the maximum - lenght, see ``notmuch_cffi.NOTMUCH_TAG_MAX``. + length, see ``notmuch_cffi.NOTMUCH_TAG_MAX``. :raises ReadOnlyDatabaseError: If the database is opened in read-only mode. """ @@ -183,7 +204,7 @@ class MutableTagSet(ImmutableTagSet, collections.abc.MutableSet): :raises TypeError: If the tag is not a valid type. :raises TagTooLongError: If the tag exceeds the maximum - lenght, see ``notmuch_cffi.NOTMUCH_TAG_MAX``. + length, see ``notmuch_cffi.NOTMUCH_TAG_MAX``. :raises ReadOnlyDatabaseError: If the database is opened in read-only mode. """ @@ -265,7 +286,7 @@ class MutableTagSet(ImmutableTagSet, collections.abc.MutableSet): class TagsIter(base.NotmuchObject, collections.abc.Iterator): """Iterator over tags. - This is only an interator, not a container so calling + This is only an iterator, not a container so calling :meth:`__iter__` does not return a new, replenished iterator but only itself. @@ -277,7 +298,7 @@ class TagsIter(base.NotmuchObject, collections.abc.Iterator): :param errors: If using a codec, this is the error handler. See :func:`str.decode` to which this is passed on. - :raises ObjectDestoryedError: if used after destroyed. + :raises ObjectDestroyedError: if used after destroyed. """ _tags_p = base.MemoryPointer()