use os.path.splitext everywhere

This commit is contained in:
Alan Hamlett 2015-08-10 18:32:17 -07:00
parent 2da75aa119
commit e8f2d75927
2 changed files with 3 additions and 6 deletions

View file

@ -320,11 +320,8 @@ def send_heartbeat(project=None, branch=None, hostname=None, stats={}, key=None,
'type': 'file', 'type': 'file',
} }
if hidefilenames and targetFile is not None and not notfile: if hidefilenames and targetFile is not None and not notfile:
data['entity'] = data['entity'].rsplit('/', 1)[-1].rsplit('\\', 1)[-1] extension = u(os.path.splitext(data['entity'])[1])
if len(data['entity'].strip('.').split('.', 1)) > 1: data['entity'] = u('HIDDEN{0}').format(extension)
data['entity'] = u('HIDDEN.{ext}').format(ext=u(data['entity'].strip('.').rsplit('.', 1)[-1]))
else:
data['entity'] = u('HIDDEN')
if stats.get('lines'): if stats.get('lines'):
data['lines'] = stats['lines'] data['lines'] = stats['lines']
if stats.get('language'): if stats.get('language'):

View file

@ -83,7 +83,7 @@ class DependencyParser(object):
self.lexer = lexer self.lexer = lexer
if self.lexer: if self.lexer:
module_name = self.lexer.__module__.split('.')[-1] module_name = self.lexer.__module__.rsplit('.', 1)[-1]
class_name = self.lexer.__class__.__name__.replace('Lexer', 'Parser', 1) class_name = self.lexer.__class__.__name__.replace('Lexer', 'Parser', 1)
else: else:
module_name = 'unknown' module_name = 'unknown'