boolean (@NotNull ASTNode withStatement, @NotNull ASTNode node) { ASTNode openingParenthesis = withStatement.findChildByType(PyTokenTypes.LPAR); if (openingParenthesis == null) { return false; } if (node.getStartOffset() < openingParenthesis.getStartOffset()) { return false; } ASTNode closingParenthesis = withStatement.findChildByType(PyTokenTypes.RPAR); if (closingParenthesis != null) { return node.getStartOffset() <= closingParenthesis.getStartOffset(); } ASTNode afterParentheses = ObjectUtils.chooseNotNull(withStatement.findChildByType(PyTokenTypes.COLON), withStatement.findChildByType(PyElementTypes.STATEMENT_LIST)); return afterParentheses == null || node.getStartOffset() < afterParentheses.getStartOffset(); }