upgrade wakatime-cli to v3.0.1

This commit is contained in:
Alan Hamlett 2014-12-23 05:36:34 -06:00
parent 8eb0ca0ce5
commit dcafa11324
3 changed files with 19 additions and 10 deletions

View file

@ -3,6 +3,12 @@ History
-------
3.0.1 (2014-12-23)
++++++++++++++++++
- handle unknown language when parsing dependencies
3.0.0 (2014-12-23)
++++++++++++++++++

View file

@ -13,7 +13,7 @@
from __future__ import print_function
__title__ = 'wakatime'
__version__ = '3.0.0'
__version__ = '3.0.1'
__author__ = 'Alan Hamlett'
__license__ = 'BSD'
__copyright__ = 'Copyright 2014 Alan Hamlett'

View file

@ -42,8 +42,10 @@ class TokenParser(object):
self._save_dependency(dep, truncate=truncate)
def _extract_tokens(self):
if self.lexer:
with open(self.source_file, 'r', encoding='utf-8') as fh:
return self.lexer.get_tokens_unprocessed(fh.read(512000))
return []
def _save_dependency(self, dep, truncate=True):
dep = dep.strip().split('.')[0].strip() if truncate else dep.strip()
@ -60,6 +62,7 @@ class DependencyParser(object):
self.source_file = source_file
self.lexer = lexer
if self.lexer:
try:
module_name = self.lexer.__module__.split('.')[-1]
class_name = self.lexer.__class__.__name__.replace('Lexer', 'Parser', 1)