boolean (@NotNull Project project, Editor editor, PsiFile file) { if (!(file instanceof PyFile)) { return false; } PyDictLiteralExpression dictExpression = PsiTreeUtil.getParentOfType(file.findElementAt(editor.getCaretModel().getOffset()), PyDictLiteralExpression.class); if (dictExpression != null) { PyKeyValueExpression[] elements = dictExpression.getElements(); for (PyKeyValueExpression element : elements) { PyExpression key = element.getKey(); if (!(key instanceof PyStringLiteralExpression)) return false; String str = ((PyStringLiteralExpression)key).getStringValue(); if (PyNames.isReserved(str)) return false; if (str.length() == 0 || Character.isDigit(str.charAt(0))) return false; if (!StringUtil.isJavaIdentifier(str)) return false; } return true; } return false; }