1313
1414from __future__ import unicode_literals
1515
16- import itertools
1716import requests
18- import six
1917
20- from calendar import monthrange
2118from datetime import date , datetime
2219from django .utils .dateparse import parse_datetime , parse_date
23- from six .moves .urllib .parse import quote
2420
2521
2622class Tempo (object ):
@@ -77,37 +73,32 @@ def get_accounts(self):
7773 """
7874 return { x ["key" ]: x for x in self ._list ("/accounts" ) }
7975
80-
81-
8276 def get_account_categories (self ):
8377 """
8478 Retrieve existing account categories.
8579 """
8680 return { x ["key" ]: x for x in self ._list ("/account-categories" ) }
8781
88-
8982 def get_account_category_types (self ):
9083 """
9184 Retrieve all periods for a given date range
9285 """
9386 return list (self ._list ("/account-category-types" ))
9487
95-
9688 def get_periods (self , date_from , date_to ):
9789 """
9890 Retrieve periods.
9991 """
100- params = {
101- "from" : self ._resolve_date (date_from ).isoformat (),
92+ params = {
93+ "from" : self ._resolve_date (date_from ).isoformat (),
10294 "to" : self ._resolve_date (date_to ).isoformat ()
10395 }
10496
10597 return list (self ._list ("/periods" , ** params ) )
10698
107-
10899 def get_work_attributes (self ):
109100 """
110- Returns work attributeslogs inside ```date_from``` and ```date_to```,
101+ Returns work attributeslogs inside ```date_from``` and ```date_to```,
111102 for particular ```user```, adding work attributes if ```add_work_attributes```.
112103 """
113104 return { x ["key" ]: x for x in self ._list ("/work-attributes" ) }
@@ -116,12 +107,12 @@ def _process_worklogs(self, worklogs):
116107 for worklog in worklogs :
117108 attributes = (worklog .get ("attributes" ) or {}).get ("values" ) or {}
118109 resolved_attributes = {}
119-
110+
120111 for attribute in attributes :
121112 key = attribute ["key" ]
122113 name = self .work_attributes .get (key , {}).get ("name" , key )
123114 resolved_attributes [name ] = attribute ["value" ]
124-
115+
125116 worklog ["attributes" ] = resolved_attributes
126117 yield worklog
127118
@@ -135,7 +126,7 @@ def get_all_worklogs(self, date_from, date_to):
135126
136127 def get_user_worklogs (self , date_from , date_to , userid ):
137128 """
138- Returns worklogs inside ```date_from``` and ```date_to```,
129+ Returns worklogs inside ```date_from``` and ```date_to```,
139130 for particular ```user```.
140131 """
141132
@@ -148,7 +139,7 @@ def get_user_worklogs(self, date_from, date_to, userid):
148139
149140 def get_team_worklogs (self , date_from , date_to , teamid ):
150141 """
151- Returns worklogs inside ```date_from``` and ```date_to```,
142+ Returns worklogs inside ```date_from``` and ```date_to```,
152143 for particular ```team```.
153144 """
154145
@@ -161,7 +152,7 @@ def get_team_worklogs(self, date_from, date_to, teamid):
161152
162153 def get_user_schedule (self , date_from , date_to , user = None ):
163154 """
164- Returns user schedule inside ```date_from``` and ```date_to```,
155+ Returns user schedule inside ```date_from``` and ```date_to```,
165156 for particular ```user```.
166157 """
167158 date_from = self ._resolve_date (date_from ).isoformat ()
0 commit comments