@Override
  public void afterRootsChanged(final @NotNull Project project) {
    final Map<Module, Sdk> moduleSdks = getPythonModuleSdks(project);
    final boolean needToReparseOpenFiles = ContainerUtil.exists(moduleSdks.entrySet(), entry -> {
      final Module module = entry.getKey();
      final Sdk newSdk = entry.getValue();
      final Sdk oldSdk = myModuleSdks.get(module);
      return myModuleSdks.containsKey(module) && newSdk != oldSdk;
    });

    myModuleSdks.putAll(moduleSdks);
    resetProjectLanguageLevel(project);
    updateSdkLanguageLevels(project, moduleSdks);

    if (needToReparseOpenFiles) {
      ApplicationManager.getApplication().invokeLater(() -> {
        if (project.isDisposed()) {
          return;
        }
        PythonCodeStyleService.getInstance().reparseOpenEditorFiles(project);
      });
    }
  }
@Override
  public void afterRootsChanged(final @NotNull Project project)