boolean (@NotNull Project project, Editor editor, PsiFile file) { if (!(file instanceof PyFile)) { return false; } PyLambdaExpression lambdaExpression = PsiTreeUtil.getParentOfType(file.findElementAt(editor.getCaretModel().getOffset()), PyLambdaExpression.class); if (lambdaExpression != null) { if (lambdaExpression.getBody() != null) { final ControlFlow flow = ControlFlowCache.getControlFlow(lambdaExpression); final List<Instruction> graph = Arrays.asList(flow.getInstructions()); final List<PsiElement> elements = PyCodeFragmentUtil.getInputElements(graph, graph); if (elements.size() > 0) return false; return true; } } return false; }