From: Tomas Babej Date: Mon, 21 Dec 2015 00:57:21 +0000 (+0100) Subject: SerializingObject: Perform more efficient deserialization of dependencies X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/commitdiff_plain/92e0ed0f1fdf6ac1f69c8b30e18a503022f57c9f?ds=inline;hp=8e002355e9a62b8bf3f22607de1e8efb934d015c SerializingObject: Perform more efficient deserialization of dependencies --- diff --git a/tasklib/serializing.py b/tasklib/serializing.py index 767f7df..a9b33ee 100644 --- a/tasklib/serializing.py +++ b/tasklib/serializing.py @@ -186,6 +186,9 @@ class SerializingObject(object): def deserialize_depends(self, raw_uuids): raw_uuids = raw_uuids or [] # Convert None to empty list + if not raw_uuids: + return set() + # TW 2.4.4 encodes list of dependencies as a single string if type(raw_uuids) is not list: uuids = raw_uuids.split(',') @@ -193,7 +196,7 @@ class SerializingObject(object): else: uuids = raw_uuids - return set(self.backend.tasks.get(uuid=uuid) for uuid in uuids if uuid) + return set(self.backend.tasks.filter(' '.join(uuids))) def datetime_normalizer(self, value): """