-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
'Revert "F821: Fix false negatives in .py files when `from __future__…
- Loading branch information
1 parent
9b3c732
commit c62184d
Showing
6 changed files
with
50 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
crates/ruff_linter/resources/test/fixtures/pyflakes/F821_29.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"""Regression test for #10451. | ||
Annotations in a class are allowed to be forward references | ||
if `from __future__ import annotations` is active, | ||
even if they're in a class included in | ||
`lint.flake8-type-checking.runtime-evaluated-base-classes`. | ||
They're not allowed to refer to symbols that cannot be *resolved* | ||
at runtime, however. | ||
""" | ||
|
||
from __future__ import annotations | ||
|
||
from sqlalchemy.orm import DeclarativeBase, Mapped | ||
|
||
|
||
class Base(DeclarativeBase): | ||
some_mapping: Mapped[list[Bar]] | None = None # Should not trigger F821 (resolveable forward reference) | ||
simplified: list[Bar] | None = None # Should not trigger F821 (resolveable forward reference) | ||
|
||
|
||
class Bar: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
...er/src/rules/pyflakes/snapshots/ruff_linter__rules__pyflakes__tests__F821_F821_29.py.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
source: crates/ruff_linter/src/rules/pyflakes/mod.rs | ||
--- | ||
|