Skip to content

Commit de17dfc

Browse files
committed
backends: Drop compatibility with Taskwarrior releases prior to 2.4.0
1 parent 813176a commit de17dfc

1 file changed

Lines changed: 9 additions & 30 deletions

File tree

tasklib/backends.py

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ class TaskWarriorException(Exception):
8484

8585
class TaskWarrior(Backend):
8686

87-
VERSION_2_1_0 = '2.1.0'
88-
VERSION_2_2_0 = '2.2.0'
89-
VERSION_2_3_0 = '2.3.0'
9087
VERSION_2_4_0 = '2.4.0'
9188
VERSION_2_4_1 = '2.4.1'
9289
VERSION_2_4_2 = '2.4.2'
@@ -218,31 +215,17 @@ def format_depends(self, task):
218215
)
219216

220217
def format_description(self, task):
221-
# Task version older than 2.4.0 ignores first word of the
222-
# task description if description: prefix is used
223-
if self.version < self.VERSION_2_4_0:
224-
return task._data['description']
225-
else:
226-
return "description:'{0}'".format(
227-
task._data['description'] or '',
228-
)
218+
return "description:'{0}'".format(
219+
task._data['description'] or '',
220+
)
229221

230222
def convert_datetime_string(self, value):
231-
232-
if self.version >= self.VERSION_2_4_0:
233-
# For strings, use 'calc' to evaluate the string to datetime
234-
# available since TW 2.4.0
235-
args = value.split()
236-
result = self.execute_command(['calc'] + args)
237-
naive = datetime.datetime.strptime(result[0], DATE_FORMAT_CALC)
238-
localized = local_zone.localize(naive)
239-
else:
240-
raise ValueError(
241-
'Provided value could not be converted to '
242-
'datetime, its type is not supported: {}'
243-
.format(type(value)),
244-
)
245-
223+
# For strings, use 'calc' to evaluate the string to datetime
224+
# available since TW 2.4.0
225+
args = value.split()
226+
result = self.execute_command(['calc'] + args)
227+
naive = datetime.datetime.strptime(result[0], DATE_FORMAT_CALC)
228+
localized = local_zone.localize(naive)
246229
return localized
247230

248231
@property
@@ -387,10 +370,6 @@ def stop_task(self, task):
387370
self.execute_command([task['uuid'], 'stop'])
388371

389372
def complete_task(self, task):
390-
# Older versions of TW do not stop active task at completion
391-
if self.version < self.VERSION_2_4_0 and task.active:
392-
task.stop()
393-
394373
self.execute_command([task['uuid'], 'done'])
395374

396375
def annotate_task(self, task, annotation):

0 commit comments

Comments
 (0)