mirror of https://github.com/astral-sh/ruff
[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
|
|
@ -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,
|
||||||
|
|
|
||||||
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…
Reference in New Issue