PyImportReference (PyReferenceExpressionImpl expression, PsiElement importParent, PyResolveContext context) { if (importParent instanceof PyImportElement) { final PyImportStatementBase importStatement = PsiTreeUtil.getParentOfType(importParent, PyImportStatementBase.class); if (importStatement instanceof PyFromImportStatement) { return new PyFromImportNameReference(expression, context); } return new PyImportReference(expression, context); } return new PyFromImportSourceReference(expression, context); }