Skip to content

Commit 685aee7

Browse files
committed
upgrade wakatime-cli to v11.0.0
1 parent 6c21f85 commit 685aee7

4 files changed

Lines changed: 16 additions & 16 deletions

File tree

packages/wakatime/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
__title__ = 'wakatime'
22
__description__ = 'Common interface to the WakaTime api.'
33
__url__ = 'https://github.com/wakatime/wakatime'
4-
__version_info__ = ('10', '9', '0')
4+
__version_info__ = ('11', '0', '0')
55
__version__ = '.'.join(__version_info__)
66
__author__ = 'Alan Hamlett'
77
__author_email__ = 'alan@wakatime.com'

packages/wakatime/api.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def send_heartbeats(heartbeats, args, configs, use_ntlm_proxy=False):
163163
return AUTH_ERROR if code == 401 else API_ERROR
164164

165165

166-
def get_coding_time(start, end, args, use_ntlm_proxy=False):
166+
def get_time_today(args, use_ntlm_proxy=False):
167167
"""Get coding time from WakaTime API for given time range.
168168
169169
Returns total time as string or `None` when unable to fetch summary from
@@ -207,8 +207,8 @@ def get_coding_time(start, end, args, use_ntlm_proxy=False):
207207
ssl_verify = args.ssl_certs_file
208208

209209
params = {
210-
'start': start,
211-
'end': end,
210+
'start': 'today',
211+
'end': 'today',
212212
}
213213

214214
# send request to api
@@ -219,7 +219,7 @@ def get_coding_time(start, end, args, use_ntlm_proxy=False):
219219
verify=ssl_verify)
220220
except RequestException:
221221
if should_try_ntlm:
222-
return get_coding_time(start, end, args, use_ntlm_proxy=True)
222+
return get_time_today(args, use_ntlm_proxy=True)
223223

224224
session_cache.delete()
225225
if log.isEnabledFor(logging.DEBUG):
@@ -228,12 +228,12 @@ def get_coding_time(start, end, args, use_ntlm_proxy=False):
228228
'traceback': traceback.format_exc(),
229229
}
230230
log.error(exception_data)
231-
return '{}: {}'.format(sys.exc_info()[0].__name__, u(sys.exc_info()[1])), API_ERROR
231+
return '{0}: {1}'.format(sys.exc_info()[0].__name__, u(sys.exc_info()[1])), API_ERROR
232232
return None, API_ERROR
233233

234234
except: # delete cached session when requests raises unknown exception
235235
if should_try_ntlm:
236-
return get_coding_time(start, end, args, use_ntlm_proxy=True)
236+
return get_time_today(args, use_ntlm_proxy=True)
237237

238238
session_cache.delete()
239239
if log.isEnabledFor(logging.DEBUG):
@@ -242,7 +242,7 @@ def get_coding_time(start, end, args, use_ntlm_proxy=False):
242242
'traceback': traceback.format_exc(),
243243
}
244244
log.error(exception_data)
245-
return '{}: {}'.format(sys.exc_info()[0].__name__, u(sys.exc_info()[1])), API_ERROR
245+
return '{0}: {1}'.format(sys.exc_info()[0].__name__, u(sys.exc_info()[1])), API_ERROR
246246
return None, API_ERROR
247247

248248
code = response.status_code if response is not None else None
@@ -260,19 +260,19 @@ def get_coding_time(start, end, args, use_ntlm_proxy=False):
260260
'traceback': traceback.format_exc(),
261261
}
262262
log.error(exception_data)
263-
return '{}: {}'.format(sys.exc_info()[0].__name__, u(sys.exc_info()[1])), API_ERROR
263+
return '{0}: {1}'.format(sys.exc_info()[0].__name__, u(sys.exc_info()[1])), API_ERROR
264264
return None, API_ERROR
265265
else:
266266
if should_try_ntlm:
267-
return get_coding_time(start, end, args, use_ntlm_proxy=True)
267+
return get_time_today(args, use_ntlm_proxy=True)
268268

269269
session_cache.delete()
270270
log.debug({
271271
'response_code': code,
272272
'response_text': content,
273273
})
274274
if log.isEnabledFor(logging.DEBUG):
275-
return 'Error: {}'.format(code), API_ERROR
275+
return 'Error: {0}'.format(code), API_ERROR
276276
return None, API_ERROR
277277

278278

packages/wakatime/arguments.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def parse_arguments():
201201
'online 5 offline heartbeats are synced. Can ' +
202202
'be used without --entity to only sync offline ' +
203203
'activity without generating new heartbeats.')
204-
parser.add_argument('--show-time-today', dest='show_time_today',
204+
parser.add_argument('--today', dest='today',
205205
action='store_true',
206206
help='Prints dashboard time for Today, then exits.')
207207
parser.add_argument('--config', dest='config', action=StoreWithoutQuotes,
@@ -248,7 +248,7 @@ def parse_arguments():
248248
if not args.entity:
249249
if args.file:
250250
args.entity = args.file
251-
elif (not args.sync_offline_activity or args.sync_offline_activity == 'none') and not args.show_time_today:
251+
elif (not args.sync_offline_activity or args.sync_offline_activity == 'none') and not args.today:
252252
parser.error('argument --entity is required')
253253

254254
if not args.sync_offline_activity:

packages/wakatime/main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
sys.path.insert(0, os.path.join(pwd, 'packages'))
2323

2424
from .__about__ import __version__
25-
from .api import send_heartbeats, get_coding_time
25+
from .api import send_heartbeats, get_time_today
2626
from .arguments import parse_arguments
2727
from .compat import u, json
2828
from .constants import SUCCESS, UNKNOWN_ERROR, HEARTBEATS_PER_REQUEST
@@ -42,8 +42,8 @@ def execute(argv=None):
4242

4343
setup_logging(args, __version__)
4444

45-
if args.show_time_today:
46-
text, retval = get_coding_time('today', 'today', args)
45+
if args.today:
46+
text, retval = get_time_today(args)
4747
if text:
4848
print(text)
4949
return retval

0 commit comments

Comments
 (0)