PyAssignmentStatement (Project project, String assignmentText, PsiElement anchor) { final PyFunction container = PsiTreeUtil.getParentOfType(anchor, PyFunction.class); String selfName = PyUtil.getFirstParameterName(container); final LanguageLevel langLevel = LanguageLevel.forElement(anchor); return PyElementGenerator.getInstance(project).createFromText(langLevel, PyAssignmentStatement.class, selfName + "." + assignmentText); }