PyType (@NotNull TypeEvalContext context, @NotNull TypeEvalContext.Key key) { if (isOperator("and") || isOperator("or")) { final PyExpression left = getLeftExpression(); final PyType leftType = left != null ? context.getType(left) : null; final PyExpression right = getRightExpression(); final PyType rightType = right != null ? context.getType(right) : null; if (leftType == null && rightType == null) { return null; } return PyUnionType.union(leftType, rightType); } final String referencedName = getReferencedName(); if (PyNames.CONTAINS.equals(referencedName)) { return PyBuiltinCache.getInstance(this).getBoolType(); } PyType callResultType = PyCallExpressionHelper.getCallType(this, context, key); if (callResultType != null) { boolean bothOperandsAreKnown = operandIsKnown(getLeftExpression(), context) && operandIsKnown(getRightExpression(), context); return bothOperandsAreKnown ? callResultType : PyUnionType.createWeakType(callResultType); } if (referencedName != null && PyNames.COMPARISON_OPERATORS.contains(referencedName)) { return PyBuiltinCache.getInstance(this).getBoolType(); } return null; }