]> git.madduck.net Git - etc/taskwarrior.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

LazyUUIDTaskSet: Add additional methods to simulate the set object
authorTomas Babej <tomasbabej@gmail.com>
Thu, 24 Dec 2015 14:56:07 +0000 (15:56 +0100)
committerTomas Babej <tomasbabej@gmail.com>
Thu, 24 Dec 2015 14:56:07 +0000 (15:56 +0100)
tasklib/lazy.py

index b26f96413a3347afd7875f534057f3c08f505b1f..543abf039af5da4006478979d2c9033995371e5a 100644 (file)
@@ -91,6 +91,9 @@ class LazyUUIDTaskSet(object):
     def __eq__(self, other):
         return set(t['uuid'] for t in other) == self._uuids
 
+    def __ne__(self, other):
+        return not (self == other)
+
     def __contains__(self, task):
         return task['uuid'] in self._uuids
 
@@ -101,6 +104,22 @@ class LazyUUIDTaskSet(object):
         for uuid in self._uuids:
             yield LazyUUIDTask(self._tw, uuid)
 
+    def __sub__(self, other):
+        return LazyUUIDTaskSet(self._tw,
+                               self._uuids - set(t['uuid'] for t in other))
+
+    def __isub__(self, other):
+        self._uuids -= set(t['uuid'] for t in other)
+        return self
+
+    def __or__(self, other):
+        return LazyUUIDTaskSet(self._tw,
+                               self._uuids | set(t['uuid'] for t in other))
+
+    def __ior__(self, other):
+        self._uuids |= set(t['uuid'] for t in other)
+        return self
+
     def replace(self):
         """
         Performs conversion to the regular TaskQuerySet object, referenced by