Collection<String> (@Nullable Module module, boolean addContentRoots, boolean addSourceRoots) { Collection<String> pythonPathList = new LinkedHashSet<>(); if (module != null) { Set<Module> dependencies = new HashSet<>(); ModuleUtilCore.getDependencies(module, dependencies); if (addContentRoots) { addRoots(pythonPathList, ModuleRootManager.getInstance(module).getContentRoots()); for (Module dependency : dependencies) { addRoots(pythonPathList, ModuleRootManager.getInstance(dependency).getContentRoots()); } } if (addSourceRoots) { addRoots(pythonPathList, ModuleRootManager.getInstance(module).getSourceRoots()); for (Module dependency : dependencies) { addRoots(pythonPathList, ModuleRootManager.getInstance(dependency).getSourceRoots()); } } addLibrariesFromModule(module, pythonPathList); addRootsFromModule(module, pythonPathList); for (Module dependency : dependencies) { addLibrariesFromModule(dependency, pythonPathList); addRootsFromModule(dependency, pythonPathList); } } return pythonPathList; }