Improved static analysis for imports.

This commit is contained in:
Dave Halter
2015-04-23 02:43:49 +02:00
parent f4f30841ec
commit 039579b391
2 changed files with 5 additions and 4 deletions

View File

@@ -104,11 +104,12 @@ class ImportWrapper(pr.Base):
if from_import_name is not None:
types = list(chain.from_iterable(
self._evaluator.find_types(s, from_import_name, is_goto=is_goto)
self._evaluator.find_types(s, unicode(from_import_name),
is_goto=is_goto)
for s in types))
if not types:
importer = get_importer(self._evaluator,
tuple(import_path + [from_import_name]),
path = import_path + [from_import_name]
importer = get_importer(self._evaluator, tuple(path),
module, self._import.level)
types = importer.follow_file_system()
# goto only accepts `Name`

View File

@@ -14,7 +14,7 @@ date.today
#! 5 attribute-error
date.not_existing_attribute
#! 26 import-error
#! 14 import-error
from datetime.date import today
#! 16 import-error