private void collectReferencesAndOtherData(@NotNull PyReferenceExpression oldImportSource) {
      String qualifierName = getQualifierName(myImportElement);
      PsiElement referee = oldImportSource.getReference().resolve();
      myHasModuleReference = false;
      if (referee != null && qualifierName != null) {
        PsiTreeUtil.processElements(oldImportSource.getContainingFile(), new PsiElementProcessor<>() {
          @Override
          public boolean execute(@NotNull PsiElement element) {
            if (element instanceof PyReferenceExpression ref && PsiTreeUtil.getParentOfType(element, PyImportElement.class) == null) {
              if (qualifierName.equals(PyPsiUtils.toPath(ref))) {  // filter out other names that might resolve to our target
                if (ref.getParent() instanceof PyReferenceExpression) { // really qualified by us, not just referencing?
                  final PsiElement resolved = ref.getReference().resolve();
                  if (resolved == referee) myReferences.add(ref);
                }
                else {
                  myHasModuleReference = true;
                }
              }
            }
            return true;
          }
        });
      }
    }
private void collectReferencesAndOtherData(@NotNull PyReferenceExpression oldImportSource)