boolean (@NotNull PsiElement element) { if (LanguageLevel.forElement(element).isAtLeast(LanguageLevel.PYTHON310)) return true; PsiFile file = element.getContainingFile(); if (file instanceof PyFile && ((PyFile)file).hasImportFromFuture(FutureFeature.ANNOTATIONS)) { return file == element || PsiTreeUtil.getParentOfType(element, PyAnnotation.class, false, PyStatement.class) != null; } return false; }