void (final PsiFile file, final PsiElement operand, final CompletionResultSet result) { Collection<PySubscriptionExpression> subscriptionExpressions = PsiTreeUtil.findChildrenOfType(file, PySubscriptionExpression.class); for (PySubscriptionExpression expr : subscriptionExpressions) { if (expr.getOperand().getText().equals(operand.getText())) { final PsiElement parent = expr.getParent(); if (parent instanceof PyAssignmentStatement) { if (expr.equals(((PyAssignmentStatement)parent).getLeftHandSideExpression())) { PyExpression key = expr.getIndexExpression(); if (key != null) { boolean addHandler = PsiTreeUtil.findElementOfClassAtRange(file, key.getTextRange().getStartOffset(), key.getTextRange().getEndOffset(), PyStringLiteralExpression.class) != null; result.addElement(createElement(key.getText(), addHandler)); } } } } } }