LanguageLevel (@NotNull PsiElement anchor) { final InspectionProfile profile = InspectionProfileManager.getInstance(anchor.getProject()).getCurrentProfile(); final PyCompatibilityInspection inspection = (PyCompatibilityInspection)profile.getUnwrappedTool(getCompatibilityInspectionShortName(), anchor); assert inspection != null; final JDOMExternalizableStringList versions = inspection.ourVersions; if (versions.isEmpty()) { return null; } return StreamEx.of(versions) .map(LanguageLevel::fromPythonVersion) .max(Comparator.naturalOrder()) .orElse(null); }