void (@NotNull PyImportElement importElement) { myUsedImports.add(importElement.getVisibleName()); final PyIfStatement ifParent = PsiTreeUtil.getParentOfType(importElement, PyIfStatement.class); if (ifParent != null) return; final PyTryExceptStatement tryExceptStatement = PsiTreeUtil.getParentOfType(importElement, PyTryExceptStatement.class); if (tryExceptStatement != null) { for (PyExceptPart part : tryExceptStatement.getExceptParts()) { final PyExpression exceptClass = part.getExceptClass(); if (exceptClass != null && exceptClass.getText().equals("ImportError")) { return; } } } final QualifiedName qName = getImportedFullyQName(importElement); if (qName != null && !qName.matches("builtins") && !qName.matches("__builtin__")) { if (COMPATIBILITY_LIBS.contains(qName.getFirstComponent())) { myFromCompatibilityLibs.add(qName.getLastComponent()); } final String moduleName = qName.toString(); registerForAllMatchingVersions(level -> UnsupportedFeaturesUtil.MODULES.get(level).contains(moduleName) && !BACKPORTED_PACKAGES.contains(moduleName), PyPsiBundle.message("INSP.compatibility.feature.have.module", moduleName), importElement); } }