upgrade wakatime-cli to v10.0.3

This commit is contained in:
Alan Hamlett 2017-11-22 13:14:18 -08:00
parent dcf63042ed
commit ec42f31900
2 changed files with 24 additions and 9 deletions

View file

@ -1,7 +1,7 @@
__title__ = 'wakatime' __title__ = 'wakatime'
__description__ = 'Common interface to the WakaTime api.' __description__ = 'Common interface to the WakaTime api.'
__url__ = 'https://github.com/wakatime/wakatime' __url__ = 'https://github.com/wakatime/wakatime'
__version_info__ = ('10', '0', '2') __version_info__ = ('10', '0', '3')
__version__ = '.'.join(__version_info__) __version__ = '.'.join(__version_info__)
__author__ = 'Alan Hamlett' __author__ = 'Alan Hamlett'
__author_email__ = 'alan@wakatime.com' __author_email__ = 'alan@wakatime.com'

View file

@ -141,27 +141,42 @@ class Heartbeat(object):
def dict(self): def dict(self):
return { return {
'time': self.time, 'time': self.time,
'entity': self.entity, 'entity': self._unicode(self.entity),
'type': self.type, 'type': self.type,
'is_write': self.is_write, 'is_write': self.is_write,
'project': self.project, 'project': self._unicode(self.project),
'branch': self.branch, 'branch': self._unicode(self.branch),
'language': self.language, 'language': self._unicode(self.language),
'dependencies': self.dependencies, 'dependencies': self._unicode_list(self.dependencies),
'lines': self.lines, 'lines': self.lines,
'lineno': self.lineno, 'lineno': self.lineno,
'cursorpos': self.cursorpos, 'cursorpos': self.cursorpos,
'user_agent': self.user_agent, 'user_agent': self._unicode(self.user_agent),
} }
def items(self): def items(self):
return self.dict().items() return self.dict().items()
def get_id(self): def get_id(self):
return u('{h.time}-{h.type}-{h.project}-{h.branch}-{h.entity}-{h.is_write}').format( return u('{time}-{type}-{project}-{branch}-{entity}-{is_write}').format(
h=self, time=self.time,
type=self.type,
project=self._unicode(self.project),
branch=self._unicode(self.branch),
entity=self._unicode(self.entity),
is_write=self.is_write,
) )
def _unicode(self, value):
if value is None:
return None
return u(value)
def _unicode_list(self, values):
if values is None:
return None
return [self._unicode(value) for value in values]
def _excluded_by_pattern(self): def _excluded_by_pattern(self):
return should_exclude(self.entity, self.args.include, self.args.exclude) return should_exclude(self.entity, self.args.include, self.args.exclude)