void (@NotNull PyWithStatement node) { final PsiElement lpar = PyPsiUtils.getFirstChildOfType(node, PyTokenTypes.LPAR); final PsiElement rpar = PyPsiUtils.getFirstChildOfType(node, PyTokenTypes.RPAR); if (lpar == null && rpar == null) { return; } // Context expressions such as "(foo(), bar())" or "(foo(),)" are valid in Python < 3.9, but most likely indicate an error anyway PyWithItem[] withItems = node.getWithItems(); boolean canBeParsedAsSingleParenthesizedExpression = ( withItems.length == 1 && PyPsiUtils.getFirstChildOfType(withItems[0], PyTokenTypes.AS_KEYWORD) == null && PyPsiUtils.getFirstChildOfType(node, PyTokenTypes.COMMA) == null ); if (canBeParsedAsSingleParenthesizedExpression) { return; } for (PsiElement parenthesis : ContainerUtil.packNullables(lpar, rpar)) { registerForAllMatchingVersions(level -> level.isOlderThan(LanguageLevel.PYTHON39) && registerForLanguageLevel(level), PyPsiBundle.message("INSP.compatibility.feature.support.parenthesized.context.expressions"), parenthesis); } }