55import logging
66import os
77import re
8- import six
98import subprocess
9+ from functools import lru_cache
1010
1111from .task import Task , TaskQuerySet , ReadOnlyDictView
1212from .filters import TaskWarriorFilter
@@ -84,15 +84,15 @@ class TaskWarriorException(Exception):
8484
8585class TaskWarrior (Backend ):
8686
87- VERSION_2_1_0 = six . u ( '2.1.0' )
88- VERSION_2_2_0 = six . u ( '2.2.0' )
89- VERSION_2_3_0 = six . u ( '2.3.0' )
90- VERSION_2_4_0 = six . u ( '2.4.0' )
91- VERSION_2_4_1 = six . u ( '2.4.1' )
92- VERSION_2_4_2 = six . u ( '2.4.2' )
93- VERSION_2_4_3 = six . u ( '2.4.3' )
94- VERSION_2_4_4 = six . u ( '2.4.4' )
95- VERSION_2_4_5 = six . u ( '2.4.5' )
87+ VERSION_2_1_0 = '2.1.0'
88+ VERSION_2_2_0 = '2.2.0'
89+ VERSION_2_3_0 = '2.3.0'
90+ VERSION_2_4_0 = '2.4.0'
91+ VERSION_2_4_1 = '2.4.1'
92+ VERSION_2_4_2 = '2.4.2'
93+ VERSION_2_4_3 = '2.4.3'
94+ VERSION_2_4_4 = '2.4.4'
95+ VERSION_2_4_5 = '2.4.5'
9696
9797 def __init__ (self , data_location = None , create = True ,
9898 taskrc_location = None , task_command = 'task' ,
@@ -142,8 +142,8 @@ def _get_command_args(self, args, config_override=None):
142142 for item in overrides .items ():
143143 command_args .append ('rc.{0}={1}' .format (* item ))
144144 command_args .extend ([
145- x .decode ('utf-8' ) if isinstance (x , six . binary_type )
146- else six . text_type (x ) for x in args
145+ x .decode ('utf-8' ) if isinstance (x , bytes )
146+ else str (x ) for x in args
147147 ])
148148 return command_args
149149
@@ -168,10 +168,10 @@ def add_field(field):
168168 if serialized_value == '' :
169169 escaped_serialized_value = ''
170170 else :
171- escaped_serialized_value = six . u ( "'{0}'" ) .format (
171+ escaped_serialized_value = "'{0}'" .format (
172172 serialized_value )
173173
174- format_default = lambda task : six . u ( "{0}:{1}" ) .format (
174+ format_default = lambda task : "{0}:{1}" .format (
175175 field , escaped_serialized_value )
176176
177177 format_func = getattr (self , 'format_{0}' .format (field ),
@@ -223,7 +223,7 @@ def format_description(self, task):
223223 if self .version < self .VERSION_2_4_0 :
224224 return task ._data ['description' ]
225225 else :
226- return six . u ( "description:'{0}'" ) .format (
226+ return "description:'{0}'" .format (
227227 task ._data ['description' ] or '' ,
228228 )
229229
@@ -321,6 +321,10 @@ def merge_with(self, path, push=False):
321321 def undo (self ):
322322 self .execute_command (['undo' ])
323323
324+ @lru_cache (maxsize = 128 )
325+ def get_task (self , uuid ):
326+ return self .tasks .get (uuid = uuid )
327+
324328 # Backend interface implementation
325329
326330 def filter_tasks (self , filter_obj ):
0 commit comments