void (@NotNull PyTryExceptStatement node) { PyExceptPart[] exceptParts = node.getExceptParts(); if (exceptParts.length > 1) { Set<PyClass> exceptClasses = new HashSet<>(); for (PyExceptPart exceptPart : exceptParts) { PyExpression exceptClass = exceptPart.getExceptClass(); if (exceptClass instanceof PyReferenceExpression) { PsiElement element = ((PyReferenceExpression) exceptClass).followAssignmentsChain(getResolveContext()).getElement(); if (element instanceof PyClass pyClass) { if (exceptClasses.contains(pyClass)) { registerProblem(exceptClass, PyPsiBundle.message("INSP.bad.except.exception.class.already.caught", pyClass.getName())); } else { for (PyClass superClass: pyClass.getSuperClasses(null)) { if (exceptClasses.contains(superClass)) { registerProblem(exceptClass, PyPsiBundle .message("INSP.bad.except.superclass.of.exception.class.already.caught", superClass.getName(), pyClass.getName()), new PyMoveExceptQuickFix()); } } } exceptClasses.add(pyClass); } } } } }