extensions: Make extensions conform with PEP8

This commit is contained in:
Thomas Lauf 2017-03-01 20:42:32 +01:00
parent 339b849fff
commit 75be890476

View file

@ -1,5 +1,5 @@
#!/usr/bin/env python
################################################################################
###############################################################################
#
# Copyright 2015 - 2016, Paul Beckingham, Federico Hernandez.
#
@ -23,7 +23,7 @@
#
# http://www.opensource.org/licenses/mit-license.php
#
################################################################################
###############################################################################
import sys
import json
@ -45,28 +45,28 @@ print(json.dumps(new))
tags = [new['description']]
if 'project' in new:
project = new['project']
tags.append(project)
if '.' in project:
tags.extend([tag for tag in project.split('.')])
project = new['project']
tags.append(project)
if '.' in project:
tags.extend([tag for tag in project.split('.')])
if 'tags' in new:
tags.extend(new['tags'])
tags.extend(new['tags'])
combined = ' '.join(['"%s"' % tag for tag in tags]).encode('utf-8').strip()
# Started task.
if 'start' in new and not 'start' in old:
os.system('timew start ' + combined.decode() + ' :yes')
os.system('timew start ' + combined.decode() + ' :yes')
# Stopped task.
elif not 'start' in new and 'start' in old:
os.system('timew stop ' + combined.decode() + ' :yes')
os.system('timew stop ' + combined.decode() + ' :yes')
# TI-51 - in the taskwarrior hook, deleting a task doesn't stop the watch
#
# Broadened to: Any task that is active, with a non-pending status should not
# be tracked.
elif 'start' in new and new['status'] != 'pending':
os.system('timew stop ' + combined.decode() + ' :yes')
os.system('timew stop ' + combined.decode() + ' :yes')