fix a few bugs and remove unused imports

This commit is contained in:
Alan Hamlett 2015-02-10 12:09:32 -08:00
parent b877310f02
commit d3a31fc72d
6 changed files with 3 additions and 7 deletions

View file

@ -12,7 +12,6 @@
import os
from . import TokenParser
from ..compat import u
FILES = {

View file

@ -30,7 +30,6 @@ class CustomEncoder(json.JSONEncoder):
try:
encoded = super(CustomEncoder, self).default(obj)
except UnicodeDecodeError:
encoding = sys.getfilesystemencoding()
obj = u(obj)
encoded = super(CustomEncoder, self).default(obj)
return encoded
@ -63,7 +62,7 @@ class JsonFormatter(logging.Formatter):
return CustomEncoder().encode(data)
def formatException(self, exc_info):
return exec_info[2].format_exc()
return sys.exec_info[2].format_exc()
def set_log_level(logger, args):

View file

@ -10,7 +10,6 @@
"""
import logging
import os
from .projects.git import Git
from .projects.mercurial import Mercurial

View file

@ -10,7 +10,6 @@
"""
import logging
import os
log = logging.getLogger('WakaTime')

View file

@ -34,7 +34,7 @@ class WakaTime(BaseProject):
with open(self.config, 'r', encoding='utf-8') as fh:
self._project_name = u(fh.readline().strip())
self._project_branch = u(fh.readline().strip())
except IOError as e:
except IOError:
log.exception("Exception:")
return True

View file

@ -65,7 +65,7 @@ def guess_language_from_extension(extension):
if extension in EXTENSIONS:
return EXTENSIONS[extension]
if extension.lower() in EXTENSIONS:
return mapping[EXTENSIONS.lower()]
return EXTENSIONS[extension.lower()]
return None