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 -*- # -*- coding: utf-8 -*-
# vim: set filetype=python # vim: set filetype=python
from __future__ import print_statement
import os, sys import os, sys
import django.forms.monstertruck import django.forms.monstertruck

View file

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

View file

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