diff options
| author | Floris Bruynooghe <flub@devork.be> | 2020-06-14 20:33:55 +0200 |
|---|---|---|
| committer | David Bremner <david@tethera.net> | 2020-06-15 07:14:11 -0300 |
| commit | a00f3a1f7a646d9834a5de57a29cf3e900dbdcdf (patch) | |
| tree | d6ae4d86a64ed4c1dd36f05362196daebee88781 /bindings/python-cffi/notmuch2 | |
| parent | 963e363a234f1c8bdf1ae68956f80a2538bee7dc (diff) | |
Add missing set methods to tagsets
Even though we use collections.abc.Set which implements all these
methods under their operator names, the actual named variations of
these methods are shockingly missing. So let's add them manually.
Diffstat (limited to 'bindings/python-cffi/notmuch2')
| -rw-r--r-- | bindings/python-cffi/notmuch2/_tags.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/bindings/python-cffi/notmuch2/_tags.py b/bindings/python-cffi/notmuch2/_tags.py index 212852a8..3b14c981 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())) |
