boolean (PyExpression condition) { if (condition instanceof PyParenthesizedExpression) { return isNameEqualsMain(((PyParenthesizedExpression)condition).getContainedExpression()); } if (condition instanceof PyBinaryExpression binaryExpression) { if (binaryExpression.getOperator() == PyTokenTypes.OR_KEYWORD) { return isNameEqualsMain(binaryExpression.getLeftExpression()) || isNameEqualsMain(binaryExpression.getRightExpression()); } if (binaryExpression.getRightExpression() instanceof PyStringLiteralExpression rhs) { return binaryExpression.getOperator() == PyTokenTypes.EQEQ && binaryExpression.getLeftExpression().getText().equals(PyNames.NAME) && rhs.getStringValue().equals("__main__"); } } return false; }