mirror of https://github.com/astral-sh/ruff
This commit is contained in:
parent
6d4949bae1
commit
c8c915de00
|
|
@ -318,7 +318,7 @@ impl ModuleName {
|
||||||
db: &dyn Db,
|
db: &dyn Db,
|
||||||
importing_file: File,
|
importing_file: File,
|
||||||
) -> Result<Self, ModuleNameResolutionError> {
|
) -> Result<Self, ModuleNameResolutionError> {
|
||||||
relative_module_name(db, importing_file, None, NonZeroU32::new(1).unwrap())
|
Self::from_identifier_parts(db, importing_file, None, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1555,11 +1555,11 @@ impl<'ast> Visitor<'ast> for SemanticIndexBuilder<'_, 'ast> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.imported_modules.extend(
|
for name in module_name.ancestors() {
|
||||||
module_name
|
self.imported_modules
|
||||||
.ancestors()
|
.entry(name)
|
||||||
.zip(std::iter::repeat(ImportKind::ImportFrom)),
|
.or_insert(ImportKind::ImportFrom);
|
||||||
);
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13244,13 +13244,9 @@ impl<'db> ModuleLiteralType<'db> {
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.flat_map(|file| imported_modules(db, file))
|
.flat_map(|file| imported_modules(db, file))
|
||||||
.filter_map(|(submodule_name, kind)| {
|
.filter_map(|(submodule_name, kind)| {
|
||||||
Some((submodule_name.relative_to(self.module(db).name(db))?, kind))
|
let relative_name = submodule_name.relative_to(self.module(db).name(db))?;
|
||||||
})
|
let available_attribute = relative_name.components().next()?;
|
||||||
.filter_map(|(relative_submodule, kind)| {
|
Some((Name::from(available_attribute), *kind))
|
||||||
relative_submodule
|
|
||||||
.components()
|
|
||||||
.next()
|
|
||||||
.map(|module| (Name::from(module), *kind))
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue