PyMoveSymbolResult () { final PsiElement oldElementBody = PyMoveModuleMembersHelper.expandNamedElementBody(myMovedElement); if (oldElementBody != null) { PyClassRefactoringUtil.rememberNamedReferences(oldElementBody); final PsiElement newElementBody = addElementToFile(oldElementBody); final PsiNamedElement newElement = PyMoveModuleMembersHelper.extractNamedElement(newElementBody); assert newElement != null; for (UsageInfo usage : myUsages) { final PsiElement usageElement = usage.getElement(); if (usageElement != null) { updateSingleUsage(usageElement, newElement); } } final PsiElement[] unwrappedElements = ContainerUtil.mapNotNull(myAllMovedElements, SmartPsiElementPointer::getElement).toArray(PsiElement.EMPTY_ARRAY); PyClassRefactoringUtil.restoreNamedReferences(newElementBody, myMovedElement, unwrappedElements); final PyTrailingBlankLinesPostFormatProcessor postFormatProcessor = new PyTrailingBlankLinesPostFormatProcessor(); if (PsiTreeUtil.nextVisibleLeaf(newElementBody) == null) { PyUtil.updateDocumentUnblockedAndCommitted(myDestinationFile, document -> { PsiDocumentManager.getInstance(newElementBody.getProject()).commitDocument(document); postFormatProcessor.processElement(newElementBody, CodeStyle.getSettings(myDestinationFile)); }); } deleteElement(); } return new PyMoveSymbolResult(myFilesWithStarUsages); }