mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-18 01:20:24 +00:00
Add fix for future-required-type-annotation
(#8711)
## Summary We already support inserting imports for `I002` -- this PR just adds the same fix for `FA102`, which is explicitly about `from __future__ import annotations`. Closes https://github.com/astral-sh/ruff/issues/8682.
This commit is contained in:
parent
cd29761b9c
commit
a59172528c
7 changed files with 131 additions and 26 deletions
|
@ -248,6 +248,12 @@ impl<'a> Definitions<'a> {
|
|||
|
||||
ContextualizedDefinitions(definitions.raw)
|
||||
}
|
||||
|
||||
/// Returns a reference to the Python AST.
|
||||
pub fn python_ast(&self) -> Option<&'a [Stmt]> {
|
||||
let module = self[DefinitionId::module()].as_module()?;
|
||||
Some(module.python_ast)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> Deref for Definitions<'a> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue