mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 21:34:57 +00:00
[ty] Add "list modules" implementation
The actual implementation wasn't too bad. It's not long but pretty fiddly. I copied over the tests from the existing module resolver and adapted them to work with this API. Then I added a number of my own tests as well.
This commit is contained in:
parent
ec7c2efef9
commit
4db20f459c
3 changed files with 1679 additions and 2 deletions
|
@ -7,8 +7,8 @@ use crate::suppression::{INVALID_IGNORE_COMMENT, UNKNOWN_RULE, UNUSED_IGNORE_COM
|
||||||
pub use db::Db;
|
pub use db::Db;
|
||||||
pub use module_name::ModuleName;
|
pub use module_name::ModuleName;
|
||||||
pub use module_resolver::{
|
pub use module_resolver::{
|
||||||
Module, SearchPathValidationError, SearchPaths, resolve_module, resolve_real_module,
|
Module, SearchPath, SearchPathValidationError, SearchPaths, list_modules, resolve_module,
|
||||||
system_module_search_paths,
|
resolve_real_module, system_module_search_paths,
|
||||||
};
|
};
|
||||||
pub use program::{
|
pub use program::{
|
||||||
Program, ProgramSettings, PythonVersionFileSource, PythonVersionSource,
|
Program, ProgramSettings, PythonVersionFileSource, PythonVersionSource,
|
||||||
|
|
1675
crates/ty_python_semantic/src/module_resolver/list.rs
Normal file
1675
crates/ty_python_semantic/src/module_resolver/list.rs
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,6 @@
|
||||||
use std::iter::FusedIterator;
|
use std::iter::FusedIterator;
|
||||||
|
|
||||||
|
pub use list::list_modules;
|
||||||
pub(crate) use module::KnownModule;
|
pub(crate) use module::KnownModule;
|
||||||
pub use module::Module;
|
pub use module::Module;
|
||||||
pub use path::SearchPathValidationError;
|
pub use path::SearchPathValidationError;
|
||||||
|
@ -12,6 +13,7 @@ use crate::Db;
|
||||||
use crate::module_resolver::resolver::{ModuleResolveMode, search_paths};
|
use crate::module_resolver::resolver::{ModuleResolveMode, search_paths};
|
||||||
use resolver::SearchPathIterator;
|
use resolver::SearchPathIterator;
|
||||||
|
|
||||||
|
mod list;
|
||||||
mod module;
|
mod module;
|
||||||
mod path;
|
mod path;
|
||||||
mod resolver;
|
mod resolver;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue