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',
}
if hidefilenames and targetFile is not None and not notfile:
data['entity'] = data['entity'].rsplit('/', 1)[-1].rsplit('\\', 1)[-1]
if len(data['entity'].strip('.').split('.', 1)) > 1:
data['entity'] = u('HIDDEN.{ext}').format(ext=u(data['entity'].strip('.').rsplit('.', 1)[-1]))
else:
data['entity'] = u('HIDDEN')
extension = u(os.path.splitext(data['entity'])[1])
data['entity'] = u('HIDDEN{0}').format(extension)
if stats.get('lines'):
data['lines'] = stats['lines']
if stats.get('language'):

View file

@ -83,7 +83,7 @@ class DependencyParser(object):
self.lexer = 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)
else:
module_name = 'unknown'