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