prevent logging __future__ python dependency

This commit is contained in:
Alan Hamlett 2016-08-31 17:30:49 +02:00
parent 694205ebee
commit 3dd5e12d06
3 changed files with 8 additions and 8 deletions

View file

@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# vim: set filetype=python
from __future__ import print_statement
import os, sys
import django.forms.monstertruck

View file

@ -79,7 +79,7 @@ class DependenciesTestCase(utils.TestCase):
heartbeat = {
'language': u('Python'),
'lines': 36,
'lines': 37,
'entity': os.path.realpath(entity),
'project': u(os.path.basename(os.path.realpath('.'))),
'time': float(now),
@ -90,7 +90,7 @@ class DependenciesTestCase(utils.TestCase):
u('dependencies'): [],
u('language'): u('Python'),
u('lineno'): None,
u('lines'): 36,
u('lines'): 37,
}
expected_dependencies = []
@ -138,7 +138,7 @@ class DependenciesTestCase(utils.TestCase):
heartbeat = {
'language': None,
'lines': 36,
'lines': 37,
'dependencies': [],
'entity': os.path.realpath(entity),
'project': u(os.path.basename(os.path.realpath('.'))),
@ -149,7 +149,7 @@ class DependenciesTestCase(utils.TestCase):
u('cursorpos'): None,
u('language'): None,
u('lineno'): None,
u('lines'): 36,
u('lines'): 37,
u('dependencies'): [],
}
@ -185,7 +185,7 @@ class DependenciesTestCase(utils.TestCase):
heartbeat = {
'language': u('Python'),
'lines': 36,
'lines': 37,
'entity': os.path.realpath(entity),
'project': u(os.path.basename(os.path.realpath('.'))),
'dependencies': ANY,
@ -197,7 +197,7 @@ class DependenciesTestCase(utils.TestCase):
u('dependencies'): ANY,
u('language'): u('Python'),
u('lineno'): None,
u('lines'): 36,
u('lines'): 37,
}
expected_dependencies = [
'app',

View file

@ -20,6 +20,7 @@ class PythonParser(TokenParser):
r'^os$',
r'^sys$',
r'^sys\.',
r'^__future__$',
]
def parse(self):
@ -72,8 +73,6 @@ class PythonParser(TokenParser):
if self.state == 'from':
self.append(content, truncate=True, truncate_to=1)
self.state = 'from-2'
elif self.state == 'from-2' and content != 'import':
self.append(content, truncate=True, truncate_to=1)
elif self.state == 'import':
self.append(content, truncate=True, truncate_to=1)
self.state = 'import-2'