ruff/crates/ruff_python_semantic
David Salvisberg 8fcac0ff36
Recognize all symbols named TYPE_CHECKING for in_type_checking_block (#15719)
Closes #15681

## Summary

This changes `analyze::typing::is_type_checking_block` to recognize all
symbols named "TYPE_CHECKING".
This matches the current behavior of mypy and pyright as well as
`flake8-type-checking`.

It also drops support for detecting `if False:` and `if 0:` as type
checking blocks. This used to be an option for
providing backwards compatibility with Python versions that did not have
a `typing` module, but has since
been removed from the typing spec and is no longer supported by any of
the mainstream type checkers.

## Test Plan

`cargo nextest run`

---------

Co-authored-by: Micha Reiser <micha@reiser.io>
2025-02-06 14:45:12 +01:00
..
src Recognize all symbols named TYPE_CHECKING for in_type_checking_block (#15719) 2025-02-06 14:45:12 +01:00
Cargo.toml [flake8-type-checking] Improve flexibility of runtime-evaluated-decorators (#15204) 2024-12-31 16:28:10 +00:00