mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-30 08:23:53 +00:00
Avoid using typing.Self
in stub files pre-Python 3.11 (#14230)
## Summary See: https://github.com/astral-sh/ruff/pull/14217#discussion_r1835340869. This means we're recommending `typing_extensions` in non-stubs pre-3.11, which may not be a valid project dependency, but that's a separate issue (https://github.com/astral-sh/ruff/issues/9761).
This commit is contained in:
parent
ce3af27f59
commit
1279c20ee1
1 changed files with 1 additions and 1 deletions
|
@ -191,7 +191,7 @@ fn add_diagnostic(
|
|||
/// Return an [`Edit`] that imports `typing.Self` from `typing` or `typing_extensions`.
|
||||
fn import_self(checker: &Checker, range: TextRange) -> Option<Edit> {
|
||||
let target_version = checker.settings.target_version.as_tuple();
|
||||
let source_module = if checker.source_type.is_stub() || target_version >= (3, 11) {
|
||||
let source_module = if target_version >= (3, 11) {
|
||||
"typing"
|
||||
} else {
|
||||
"typing_extensions"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue