boolean (@NotNull PyBinaryExpression expr, @NotNull Collection<String> literals) { final String leftExpressionText = expr.getLeftExpression().getText(); final PyExpression rightExpression = expr.getRightExpression(); final String rightExpressionText = rightExpression != null ? rightExpression.getText() : null; for (String literal : literals) { if (literal.equals(leftExpressionText) || literal.equals(rightExpressionText)) { return true; } } return false; }