truncate to first element

This commit is contained in:
Alan Hamlett 2015-09-16 12:59:52 -07:00
parent 1127e5c8da
commit 72b6c992c2

View file

@ -56,13 +56,13 @@ class PythonParser(TokenParser):
self.nonpackage = False self.nonpackage = False
else: else:
if self.state == 'from': if self.state == 'from':
self.append(content, truncate=True, truncate_to=0) self.append(content, truncate=True, truncate_to=1)
if self.state == 'from-2' and content != 'import': if self.state == 'from-2' and content != 'import':
self.append(content, truncate=True, truncate_to=0) self.append(content, truncate=True, truncate_to=1)
elif self.state == 'import': elif self.state == 'import':
self.append(content, truncate=True, truncate_to=0) self.append(content, truncate=True, truncate_to=1)
elif self.state == 'import-2': elif self.state == 'import-2':
self.append(content, truncate=True, truncate_to=0) self.append(content, truncate=True, truncate_to=1)
else: else:
self.state = None self.state = None
@ -72,13 +72,13 @@ class PythonParser(TokenParser):
self.nonpackage = False self.nonpackage = False
else: else:
if self.state == 'from': if self.state == 'from':
self.append(content, truncate=True, truncate_to=0) self.append(content, truncate=True, truncate_to=1)
if self.state == 'from-2' and content != 'import': if self.state == 'from-2' and content != 'import':
self.append(content, truncate=True, truncate_to=0) self.append(content, truncate=True, truncate_to=1)
elif self.state == 'import': elif self.state == 'import':
self.append(content, truncate=True, truncate_to=0) self.append(content, truncate=True, truncate_to=1)
elif self.state == 'import-2': elif self.state == 'import-2':
self.append(content, truncate=True, truncate_to=0) self.append(content, truncate=True, truncate_to=1)
else: else:
self.state = None self.state = None
@ -106,15 +106,15 @@ class PythonParser(TokenParser):
def _process_import(self, token, content): def _process_import(self, token, content):
if not self.nonpackage: if not self.nonpackage:
if self.state == 'from': if self.state == 'from':
self.append(content, truncate=True, truncate_to=0) self.append(content, truncate=True, truncate_to=1)
self.state = 'from-2' self.state = 'from-2'
elif self.state == 'from-2' and content != 'import': elif self.state == 'from-2' and content != 'import':
self.append(content, truncate=True, truncate_to=0) self.append(content, truncate=True, truncate_to=1)
elif self.state == 'import': elif self.state == 'import':
self.append(content, truncate=True, truncate_to=0) self.append(content, truncate=True, truncate_to=1)
self.state = 'import-2' self.state = 'import-2'
elif self.state == 'import-2': elif self.state == 'import-2':
self.append(content, truncate=True, truncate_to=0) self.append(content, truncate=True, truncate_to=1)
else: else:
self.state = None self.state = None
self.nonpackage = False self.nonpackage = False