PsiElementVisitor (@NotNull ProblemsHolder holder, boolean isOnTheFly, @NotNull LocalInspectionToolSession session) { final PyUnusedLocalInspectionVisitor visitor = new PyUnusedLocalInspectionVisitor(holder, ignoreTupleUnpacking, ignoreLambdaParameters, ignoreLoopIterationVariables, ignoreVariablesStartingWithUnderscore, PyInspectionVisitor.getContext(session)); // buildVisitor() will be called on injected files in the same session - don't overwrite if we already have one final PyUnusedLocalInspectionVisitor existingVisitor = session.getUserData(KEY); if (existingVisitor == null) { session.putUserData(KEY, visitor); } return visitor; }