mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 20:10:09 +00:00
Treat .pyi files as __future__ annotations-enabled (#1616)
This commit is contained in:
parent
60359c6adf
commit
0d27c0be27
4 changed files with 11 additions and 1 deletions
3
resources/test/fixtures/pyflakes/F821_8.pyi
vendored
Normal file
3
resources/test/fixtures/pyflakes/F821_8.pyi
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
class Pool:
|
||||
@classmethod
|
||||
def create(cls) -> Pool: ...
|
|
@ -151,7 +151,7 @@ impl<'a> Checker<'a> {
|
|||
in_subscript: false,
|
||||
seen_import_boundary: false,
|
||||
futures_allowed: true,
|
||||
annotations_future_enabled: false,
|
||||
annotations_future_enabled: path.extension().map_or(false, |ext| ext == "pyi"),
|
||||
except_handlers: vec![],
|
||||
// Check-specific state.
|
||||
flake8_bugbear_seen: vec![],
|
||||
|
|
|
@ -98,6 +98,7 @@ mod tests {
|
|||
#[test_case(CheckCode::F821, Path::new("F821_5.py"); "F821_5")]
|
||||
#[test_case(CheckCode::F821, Path::new("F821_6.py"); "F821_6")]
|
||||
#[test_case(CheckCode::F821, Path::new("F821_7.py"); "F821_7")]
|
||||
#[test_case(CheckCode::F821, Path::new("F821_8.pyi"); "F821_8")]
|
||||
#[test_case(CheckCode::F822, Path::new("F822.py"); "F822")]
|
||||
#[test_case(CheckCode::F823, Path::new("F823.py"); "F823")]
|
||||
#[test_case(CheckCode::F841, Path::new("F841_0.py"); "F841_0")]
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
source: src/pyflakes/mod.rs
|
||||
expression: checks
|
||||
---
|
||||
[]
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue