ruff
4b066691 - F821, F822: fix false positive for `.pyi` files; add more test coverage for `.pyi` files (#10341)

Commit
1 year ago
F821, F822: fix false positive for `.pyi` files; add more test coverage for `.pyi` files (#10341) This PR fixes the following false positive in a `.pyi` stub file: ```py x: int y = x # F821 currently emitted here, but shouldn't be in a stub file ``` In a `.py` file, this is invalid regardless of whether `from __future__ import annotations` is enabled or not. In a `.pyi` stub file, however, it's always valid, as an annotation counts as a binding in a stub file even if no value is assigned to the variable. I also added more test coverage for `.pyi` stub files in various edge cases where ruff's behaviour is currently correct, but where `.pyi` stub files do slightly different things to `.py` files.
Author
Parents
Loading