upgrade wakatime package to v2.0.2
This commit is contained in:
parent
5d7956a6f3
commit
113dd03348
4 changed files with 23 additions and 8 deletions
3
plugin/packages/wakatime/.gitignore
vendored
3
plugin/packages/wakatime/.gitignore
vendored
|
@ -33,3 +33,6 @@ nosetests.xml
|
|||
.mr.developer.cfg
|
||||
.project
|
||||
.pydevproject
|
||||
|
||||
virtualenv
|
||||
venv
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
from __future__ import print_function
|
||||
|
||||
__title__ = 'wakatime'
|
||||
__version__ = '2.0.1'
|
||||
__version__ = '2.0.2'
|
||||
__author__ = 'Alan Hamlett'
|
||||
__license__ = 'BSD'
|
||||
__copyright__ = 'Copyright 2014 Alan Hamlett'
|
||||
|
@ -39,13 +39,17 @@ except ImportError:
|
|||
|
||||
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'packages'))
|
||||
|
||||
from .queue import Queue
|
||||
from .log import setup_logging
|
||||
from .project import find_project
|
||||
from .stats import get_file_stats
|
||||
from .packages import argparse
|
||||
from .packages import simplejson as json
|
||||
from .packages import tzlocal
|
||||
try:
|
||||
from .packages import tzlocal
|
||||
except:
|
||||
from .packages import tzlocal3
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
|
|
@ -18,7 +18,7 @@ from simplejson.decoder import PosInf
|
|||
#ESCAPE = re.compile(ur'[\x00-\x1f\\"\b\f\n\r\t\u2028\u2029]')
|
||||
# This is required because u() will mangle the string and ur'' isn't valid
|
||||
# python3 syntax
|
||||
ESCAPE = re.compile(u'[\\x00-\\x1f\\\\"\\b\\f\\n\\r\\t\u2028\u2029]')
|
||||
ESCAPE = re.compile(u('[\\x00-\\x1f\\\\"\\b\\f\\n\\r\\t\u2028\u2029]'))
|
||||
ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])')
|
||||
HAS_UTF8 = re.compile(r'[\x80-\xff]')
|
||||
ESCAPE_DCT = {
|
||||
|
@ -265,7 +265,7 @@ class JSONEncoder(object):
|
|||
if self.ensure_ascii:
|
||||
return ''.join(chunks)
|
||||
else:
|
||||
return u''.join(chunks)
|
||||
return u('').join(chunks)
|
||||
|
||||
def iterencode(self, o, _one_shot=False):
|
||||
"""Encode the given object and yield each string
|
||||
|
@ -358,7 +358,7 @@ class JSONEncoderForHTML(JSONEncoder):
|
|||
if self.ensure_ascii:
|
||||
return ''.join(chunks)
|
||||
else:
|
||||
return u''.join(chunks)
|
||||
return u('').join(chunks)
|
||||
|
||||
def iterencode(self, o, _one_shot=False):
|
||||
chunks = super(JSONEncoderForHTML, self).iterencode(o, _one_shot)
|
||||
|
|
|
@ -13,9 +13,13 @@
|
|||
|
||||
import logging
|
||||
import os
|
||||
import sqlite3
|
||||
import traceback
|
||||
from time import sleep
|
||||
try:
|
||||
import sqlite3
|
||||
HAS_SQL = True
|
||||
except ImportError:
|
||||
HAS_SQL = False
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -41,6 +45,8 @@ class Queue(object):
|
|||
|
||||
|
||||
def push(self, data, plugin):
|
||||
if not HAS_SQL:
|
||||
return
|
||||
try:
|
||||
conn, c = self.connect()
|
||||
action = {
|
||||
|
@ -61,6 +67,8 @@ class Queue(object):
|
|||
|
||||
|
||||
def pop(self):
|
||||
if not HAS_SQL:
|
||||
return None
|
||||
tries = 3
|
||||
wait = 0.1
|
||||
action = None
|
||||
|
@ -87,9 +95,9 @@ class Queue(object):
|
|||
clauses.append('{0} IS NULL'.format(row_name))
|
||||
index += 1
|
||||
if len(values) > 0:
|
||||
c.execute('DELETE FROM action WHERE {0}'.format(u' AND '.join(clauses)), values)
|
||||
c.execute('DELETE FROM action WHERE {0}'.format(' AND '.join(clauses)), values)
|
||||
else:
|
||||
c.execute('DELETE FROM action WHERE {0}'.format(u' AND '.join(clauses)))
|
||||
c.execute('DELETE FROM action WHERE {0}'.format(' AND '.join(clauses)))
|
||||
conn.commit()
|
||||
if row is not None:
|
||||
action = {
|
||||
|
|
Loading…
Reference in a new issue