Skip to content

Commit

Permalink
Merge branch 'Effenberg0x0-337'
Browse files Browse the repository at this point in the history
  • Loading branch information
DamnWidget committed Aug 30, 2016
2 parents bf3e2fd + 6973ea1 commit b7e10f1
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions anaconda_lib/import_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,32 +65,31 @@ def _extract_imports(self):
buffer_found = []
in_docstring = False
for line in self.source.splitlines():
# skip if we detect docstring blocks
if not in_docstring:
in_docstring = self.__detect_docstring(line)
else:
if self.__detect_docstring(line):
if self.__detect_docstring(line):
if in_docstring:
in_docstring = False
else:
continue
l = line.strip()
if len(buffer_found) > 0:
if ')' in l:
buffer_found.append(l.replace(')', '').strip())
found.append((' '.join(buffer_found), lineno))
buffer_found = []
else:
buffer_found.append(l)
in_docstring = True
lineno += 1
continue
else:
if self.__detect_docstring(line):
continue
l = line.strip()
if len(buffer_found) > 0:
if ')' in l:
buffer_found.append(l.replace(')', '').strip())
found.append((' '.join(buffer_found), lineno))
buffer_found = []
else:
buffer_found.append(l)
else:
if self.__detect_docstring(line):
continue
if l.startswith('import ') or l.startswith('from '):
if '(' in l:
buffer_found.append(l.replace('(', '').strip())
else:
found.append((l, lineno))
lineno += 1

return found

def __detect_docstring(self, line):
Expand Down

0 comments on commit b7e10f1

Please sign in to comment.