mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-17 22:08:28 +00:00
[ty] Implement stdlib stub mapping (#19529)
by using essentially the same logic for system site-packages, on the assumption that system site-packages are always a subdir of the stdlib we were looking for.
This commit is contained in:
parent
0ec4801b0d
commit
7cc3f1ebe9
7 changed files with 495 additions and 31 deletions
|
@ -9,7 +9,7 @@ pub use resolver::{resolve_module, resolve_real_module};
|
|||
use ruff_db::system::SystemPath;
|
||||
|
||||
use crate::Db;
|
||||
use crate::module_resolver::resolver::search_paths;
|
||||
use crate::module_resolver::resolver::{ModuleResolveMode, search_paths};
|
||||
use resolver::SearchPathIterator;
|
||||
|
||||
mod module;
|
||||
|
@ -23,7 +23,9 @@ mod testing;
|
|||
/// Returns an iterator over all search paths pointing to a system path
|
||||
pub fn system_module_search_paths(db: &dyn Db) -> SystemModuleSearchPathsIter<'_> {
|
||||
SystemModuleSearchPathsIter {
|
||||
inner: search_paths(db),
|
||||
// Always run in `StubsAllowed` mode because we want to include as much as possible
|
||||
// and we don't care about the "real" stdlib
|
||||
inner: search_paths(db, ModuleResolveMode::StubsAllowed),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue