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
|
.mr.developer.cfg
|
||||||
.project
|
.project
|
||||||
.pydevproject
|
.pydevproject
|
||||||
|
|
||||||
|
virtualenv
|
||||||
|
venv
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
__title__ = 'wakatime'
|
__title__ = 'wakatime'
|
||||||
__version__ = '2.0.1'
|
__version__ = '2.0.2'
|
||||||
__author__ = 'Alan Hamlett'
|
__author__ = 'Alan Hamlett'
|
||||||
__license__ = 'BSD'
|
__license__ = 'BSD'
|
||||||
__copyright__ = 'Copyright 2014 Alan Hamlett'
|
__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.dirname(os.path.abspath(__file__)))
|
||||||
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'packages'))
|
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), 'packages'))
|
||||||
|
|
||||||
from .queue import Queue
|
from .queue import Queue
|
||||||
from .log import setup_logging
|
from .log import setup_logging
|
||||||
from .project import find_project
|
from .project import find_project
|
||||||
from .stats import get_file_stats
|
from .stats import get_file_stats
|
||||||
from .packages import argparse
|
from .packages import argparse
|
||||||
from .packages import simplejson as json
|
from .packages import simplejson as json
|
||||||
from .packages import tzlocal
|
try:
|
||||||
|
from .packages import tzlocal
|
||||||
|
except:
|
||||||
|
from .packages import tzlocal3
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
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]')
|
#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
|
# This is required because u() will mangle the string and ur'' isn't valid
|
||||||
# python3 syntax
|
# 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'([\\"]|[^\ -~])')
|
ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])')
|
||||||
HAS_UTF8 = re.compile(r'[\x80-\xff]')
|
HAS_UTF8 = re.compile(r'[\x80-\xff]')
|
||||||
ESCAPE_DCT = {
|
ESCAPE_DCT = {
|
||||||
|
@ -265,7 +265,7 @@ class JSONEncoder(object):
|
||||||
if self.ensure_ascii:
|
if self.ensure_ascii:
|
||||||
return ''.join(chunks)
|
return ''.join(chunks)
|
||||||
else:
|
else:
|
||||||
return u''.join(chunks)
|
return u('').join(chunks)
|
||||||
|
|
||||||
def iterencode(self, o, _one_shot=False):
|
def iterencode(self, o, _one_shot=False):
|
||||||
"""Encode the given object and yield each string
|
"""Encode the given object and yield each string
|
||||||
|
@ -358,7 +358,7 @@ class JSONEncoderForHTML(JSONEncoder):
|
||||||
if self.ensure_ascii:
|
if self.ensure_ascii:
|
||||||
return ''.join(chunks)
|
return ''.join(chunks)
|
||||||
else:
|
else:
|
||||||
return u''.join(chunks)
|
return u('').join(chunks)
|
||||||
|
|
||||||
def iterencode(self, o, _one_shot=False):
|
def iterencode(self, o, _one_shot=False):
|
||||||
chunks = super(JSONEncoderForHTML, self).iterencode(o, _one_shot)
|
chunks = super(JSONEncoderForHTML, self).iterencode(o, _one_shot)
|
||||||
|
|
|
@ -13,9 +13,13 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sqlite3
|
|
||||||
import traceback
|
import traceback
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
try:
|
||||||
|
import sqlite3
|
||||||
|
HAS_SQL = True
|
||||||
|
except ImportError:
|
||||||
|
HAS_SQL = False
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
@ -41,6 +45,8 @@ class Queue(object):
|
||||||
|
|
||||||
|
|
||||||
def push(self, data, plugin):
|
def push(self, data, plugin):
|
||||||
|
if not HAS_SQL:
|
||||||
|
return
|
||||||
try:
|
try:
|
||||||
conn, c = self.connect()
|
conn, c = self.connect()
|
||||||
action = {
|
action = {
|
||||||
|
@ -61,6 +67,8 @@ class Queue(object):
|
||||||
|
|
||||||
|
|
||||||
def pop(self):
|
def pop(self):
|
||||||
|
if not HAS_SQL:
|
||||||
|
return None
|
||||||
tries = 3
|
tries = 3
|
||||||
wait = 0.1
|
wait = 0.1
|
||||||
action = None
|
action = None
|
||||||
|
@ -87,9 +95,9 @@ class Queue(object):
|
||||||
clauses.append('{0} IS NULL'.format(row_name))
|
clauses.append('{0} IS NULL'.format(row_name))
|
||||||
index += 1
|
index += 1
|
||||||
if len(values) > 0:
|
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:
|
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()
|
conn.commit()
|
||||||
if row is not None:
|
if row is not None:
|
||||||
action = {
|
action = {
|
||||||
|
|
Loading…
Reference in a new issue