Ref<PyExpression> (@NotNull PyArgumentList argumentList) { final Ref<PyExpression> valueExprRef = getKeyValueFromArguments(argumentList); final String indexElement = myChunk instanceof NewStyleSubstitutionChunk ? ((NewStyleSubstitutionChunk)myChunk).getMappingKeyElementIndex() : null; if (valueExprRef != null && !valueExprRef.isNull() && indexElement != null) { final PyExpression valueExpr = PyPsiUtils.flattenParens(valueExprRef.get()); assert valueExpr != null; try { final Integer index = Integer.valueOf(indexElement); final Ref<PyExpression> resolvedRef = resolveNumericIndex(valueExpr, index); if (resolvedRef != null) return resolvedRef; } catch (NumberFormatException e) { final Ref<PyExpression> resolvedRef = resolveStringIndex(valueExpr, indexElement); if (resolvedRef != null) return resolvedRef; } } // valueExprRef is null only if there's no corresponding keyword argument and no star arguments return valueExprRef == null ? Ref.create() : valueExprRef; }