Detect basic wildcard imports in ruff analyze graph (#13486)

## Summary

I guess we can just ignore the `*` entirely for now? This will add the
`__init__.py` for anything that's importing a package.
This commit is contained in:
Charlie Marsh 2024-09-23 18:09:00 -04:00 committed by GitHub
parent 96e7f3f96f
commit ff4b6d11fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 66 additions and 2 deletions

View file

@ -90,8 +90,10 @@ impl<'ast> SourceOrderVisitor<'ast> for Collector<'_> {
components.extend(module.split('.'));
}
// Add the alias name.
components.push(alias.name.as_str());
// Add the alias name, unless it's a wildcard import.
if alias.name.as_str() != "*" {
components.push(alias.name.as_str());
}
if let Some(module_name) = ModuleName::from_components(components) {
self.imports.push(CollectedImport::ImportFrom(module_name));