Mercurial > getan
changeset 311:349b4571e120
Fix codingstyle for pep8
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Fri, 11 Oct 2013 12:06:42 +0200 |
parents | 2667bdef021f |
children | dc92981ec591 |
files | getan/project.py |
diffstat | 1 files changed, 16 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/getan/project.py Fri Oct 11 11:40:56 2013 +0200 +++ b/getan/project.py Fri Oct 11 12:06:42 2013 +0200 @@ -12,20 +12,21 @@ from datetime import datetime + class Project(object): def __init__(self, id, key, desc, total): - self.id = id - self.key = key - self.desc = desc + self.id = id + self.key = key + self.desc = desc self.entries = [] - self.total = total - self.start = None - self.stop = None + self.total = total + self.start = None + self.stop = None def year(self): total = 0 - now = datetime.now() + now = datetime.now() for entry in self.entries: start = entry.start if start.year == now.year: @@ -34,7 +35,7 @@ def month(self): total = 0 - now = datetime.now() + now = datetime.now() for entry in self.entries: start = entry.start if start.month == now.month and start.year == now.year: @@ -43,7 +44,7 @@ def week(self): total = 0 - now = datetime.now() + now = datetime.now() tweek = now.strftime('%W') for entry in self.entries: start = entry.start @@ -53,11 +54,11 @@ def day(self): total = 0 - now = datetime.now() + now = datetime.now() for entry in self.entries: start = entry.start if start.month == now.month and start.year == now.year \ - and start.day == now.day: + and start.day == now.day: total += (entry.end - start).seconds return total @@ -65,11 +66,11 @@ class Entry(object): def __init__(self, id, project_id, start, end, desc): - self.id = id + self.id = id self.project_id = project_id - self.start = start - self.end = end - self.desc = desc + self.start = start + self.end = end + self.desc = desc # carefully handle non unicode string # urwid seems to have some issue with plain str