upgrade wakatime-cli to v6.0.6
This commit is contained in:
parent
73710edd4a
commit
2701f8a381
4 changed files with 15 additions and 12 deletions
|
@ -1,7 +1,7 @@
|
||||||
__title__ = 'wakatime'
|
__title__ = 'wakatime'
|
||||||
__description__ = 'Common interface to the WakaTime api.'
|
__description__ = 'Common interface to the WakaTime api.'
|
||||||
__url__ = 'https://github.com/wakatime/wakatime'
|
__url__ = 'https://github.com/wakatime/wakatime'
|
||||||
__version_info__ = ('6', '0', '5')
|
__version_info__ = ('6', '0', '6')
|
||||||
__version__ = '.'.join(__version_info__)
|
__version__ = '.'.join(__version_info__)
|
||||||
__author__ = 'Alan Hamlett'
|
__author__ = 'Alan Hamlett'
|
||||||
__author_email__ = 'alan@wakatime.com'
|
__author_email__ = 'alan@wakatime.com'
|
||||||
|
|
|
@ -73,11 +73,15 @@ class JsonFormatter(logging.Formatter):
|
||||||
|
|
||||||
|
|
||||||
def traceback_formatter(*args, **kwargs):
|
def traceback_formatter(*args, **kwargs):
|
||||||
if 'level' in kwargs and (kwargs['level'].lower() == 'warn' or kwargs['level'].lower() == 'warning'):
|
try:
|
||||||
|
level = kwargs.get('level', args[0]).lower()
|
||||||
|
except:
|
||||||
|
level = None
|
||||||
|
if level == 'warn' or level == 'warning':
|
||||||
logging.getLogger('WakaTime').warning(traceback.format_exc())
|
logging.getLogger('WakaTime').warning(traceback.format_exc())
|
||||||
elif 'level' in kwargs and kwargs['level'].lower() == 'info':
|
elif level == 'info':
|
||||||
logging.getLogger('WakaTime').info(traceback.format_exc())
|
logging.getLogger('WakaTime').info(traceback.format_exc())
|
||||||
elif 'level' in kwargs and kwargs['level'].lower() == 'debug':
|
elif level == 'debug':
|
||||||
logging.getLogger('WakaTime').debug(traceback.format_exc())
|
logging.getLogger('WakaTime').debug(traceback.format_exc())
|
||||||
else:
|
else:
|
||||||
logging.getLogger('WakaTime').error(traceback.format_exc())
|
logging.getLogger('WakaTime').error(traceback.format_exc())
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import traceback
|
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -70,7 +69,7 @@ class Queue(object):
|
||||||
conn.commit()
|
conn.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
except sqlite3.Error:
|
except sqlite3.Error:
|
||||||
log.error(traceback.format_exc())
|
log.traceback()
|
||||||
|
|
||||||
def pop(self):
|
def pop(self):
|
||||||
if not HAS_SQL: # pragma: nocover
|
if not HAS_SQL: # pragma: nocover
|
||||||
|
@ -81,7 +80,7 @@ class Queue(object):
|
||||||
try:
|
try:
|
||||||
conn, c = self.connect()
|
conn, c = self.connect()
|
||||||
except sqlite3.Error:
|
except sqlite3.Error:
|
||||||
log.debug(traceback.format_exc())
|
log.traceback('debug')
|
||||||
return None
|
return None
|
||||||
loop = True
|
loop = True
|
||||||
while loop and tries > -1:
|
while loop and tries > -1:
|
||||||
|
@ -119,11 +118,11 @@ class Queue(object):
|
||||||
}
|
}
|
||||||
loop = False
|
loop = False
|
||||||
except sqlite3.Error: # pragma: nocover
|
except sqlite3.Error: # pragma: nocover
|
||||||
log.debug(traceback.format_exc())
|
log.traceback('debug')
|
||||||
sleep(wait)
|
sleep(wait)
|
||||||
tries -= 1
|
tries -= 1
|
||||||
try:
|
try:
|
||||||
conn.close()
|
conn.close()
|
||||||
except sqlite3.Error: # pragma: nocover
|
except sqlite3.Error: # pragma: nocover
|
||||||
log.debug(traceback.format_exc())
|
log.traceback('debug')
|
||||||
return heartbeat
|
return heartbeat
|
||||||
|
|
|
@ -20,8 +20,8 @@ from .packages import (
|
||||||
get_lexer_by_name,
|
get_lexer_by_name,
|
||||||
guess_lexer_for_filename,
|
guess_lexer_for_filename,
|
||||||
get_filetype_from_buffer,
|
get_filetype_from_buffer,
|
||||||
ClassNotFound,
|
|
||||||
)
|
)
|
||||||
|
from .packages.pygments.lexers import ClassNotFound
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from .packages import simplejson as json # pragma: nocover
|
from .packages import simplejson as json # pragma: nocover
|
||||||
|
@ -108,7 +108,7 @@ def guess_lexer_using_modeline(text):
|
||||||
if file_type is not None:
|
if file_type is not None:
|
||||||
try:
|
try:
|
||||||
lexer = get_lexer_by_name(file_type)
|
lexer = get_lexer_by_name(file_type)
|
||||||
except: # pragma: nocover
|
except ClassNotFound:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if lexer is not None:
|
if lexer is not None:
|
||||||
|
@ -231,7 +231,7 @@ def get_file_head(file_name):
|
||||||
try:
|
try:
|
||||||
with open(file_name, 'r', encoding='utf-8') as fh:
|
with open(file_name, 'r', encoding='utf-8') as fh:
|
||||||
text = fh.read(512000)
|
text = fh.read(512000)
|
||||||
except: # pragma: nocover
|
except:
|
||||||
try:
|
try:
|
||||||
with open(file_name, 'r', encoding=sys.getfilesystemencoding()) as fh:
|
with open(file_name, 'r', encoding=sys.getfilesystemencoding()) as fh:
|
||||||
text = fh.read(512000)
|
text = fh.read(512000)
|
||||||
|
|
Loading…
Reference in a new issue