diff --git a/wakatime/languages/unknown.py b/wakatime/languages/unknown.py index 9e9724e..bfd1cb0 100644 --- a/wakatime/languages/unknown.py +++ b/wakatime/languages/unknown.py @@ -12,7 +12,6 @@ import os from . import TokenParser -from ..compat import u FILES = { diff --git a/wakatime/log.py b/wakatime/log.py index b70d21b..7cec4a2 100644 --- a/wakatime/log.py +++ b/wakatime/log.py @@ -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): diff --git a/wakatime/project.py b/wakatime/project.py index 56a8657..949a76d 100644 --- a/wakatime/project.py +++ b/wakatime/project.py @@ -10,7 +10,6 @@ """ import logging -import os from .projects.git import Git from .projects.mercurial import Mercurial diff --git a/wakatime/projects/base.py b/wakatime/projects/base.py index d1af823..60c3ac4 100644 --- a/wakatime/projects/base.py +++ b/wakatime/projects/base.py @@ -10,7 +10,6 @@ """ import logging -import os log = logging.getLogger('WakaTime') diff --git a/wakatime/projects/wakatime.py b/wakatime/projects/wakatime.py index fa33f4f..41ec0d6 100644 --- a/wakatime/projects/wakatime.py +++ b/wakatime/projects/wakatime.py @@ -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 diff --git a/wakatime/stats.py b/wakatime/stats.py index 50ff4a4..830a39b 100644 --- a/wakatime/stats.py +++ b/wakatime/stats.py @@ -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