InfoHolder (final PsiElement position) { InfoHolder ret = new InfoHolder(); ret.myModuleReference = null; ret.myFromImportStatement = PsiTreeUtil.getParentOfType(position, PyFromImportStatement.class); PyPsiUtils.assertValid(ret.myFromImportStatement); if (ret.myFromImportStatement != null && !ret.myFromImportStatement.isFromFuture()) { ret.myRelativeLevel = ret.myFromImportStatement.getRelativeLevel(); ret.myModuleReference = ret.myFromImportStatement.getImportSource(); } if (ret.myModuleReference != null) { ret.myModuleName = PyPsiUtils.toPath(ret.myModuleReference); } return ret; }