boolean (PyExpression key, PyExpression defaultValue) { if (isBothInstanceOf(key, defaultValue, PyNumericLiteralExpression.class) || isBothInstanceOf(key, defaultValue, PyPrefixExpression.class) || isBothInstanceOf(key, defaultValue, PyBinaryExpression.class) || isBothInstanceOf(key, defaultValue, PyNoneLiteralExpression.class) || isBothInstanceOf(key, defaultValue, PyBoolLiteralExpression.class)) { if (key.getText().equals(defaultValue.getText())) return true; } else if (key instanceof PyStringLiteralExpression && defaultValue instanceof PyStringLiteralExpression) { if (((PyStringLiteralExpression)key).getStringValue().equals(((PyStringLiteralExpression)defaultValue).getStringValue())) return true; } else if (key instanceof PyReferenceExpression && PyUtil.isPy2ReservedWord((PyReferenceExpression)key) && key.getText().equals(defaultValue.getText())) { return true; } else { PsiReference keyRef = key instanceof PyReferenceExpression ? ((PyReferenceExpression)key).getReference(getResolveContext()) : key.getReference(); PsiReference defRef = defaultValue instanceof PyReferenceExpression ? ((PyReferenceExpression)defaultValue).getReference(getResolveContext()) : defaultValue.getReference(); if (keyRef != null && defRef != null) { PsiElement keyResolve = keyRef.resolve(); PsiElement defResolve = defRef.resolve(); if (keyResolve != null && keyResolve.equals(defResolve)) { return true; } } } return false; }