Revert: [pyflakes] Avoid false positives in @no_type_check contexts (F821, F722) (#14615) (#14726)

This commit is contained in:
Micha Reiser 2024-12-02 14:28:27 +01:00 committed by GitHub
parent 76d2e56501
commit f96dfc179f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 3 additions and 135 deletions

View file

@ -1717,11 +1717,6 @@ impl<'a> SemanticModel<'a> {
self.flags.intersects(SemanticModelFlags::ANNOTATION)
}
/// Return `true` if the model is in a `@no_type_check` context.
pub const fn in_no_type_check(&self) -> bool {
self.flags.intersects(SemanticModelFlags::NO_TYPE_CHECK)
}
/// Return `true` if the model is in a typing-only type annotation.
pub const fn in_typing_only_annotation(&self) -> bool {
self.flags
@ -2403,22 +2398,6 @@ bitflags! {
/// [PEP 257]: https://peps.python.org/pep-0257/#what-is-a-docstring
const ATTRIBUTE_DOCSTRING = 1 << 25;
/// The model is in a [no_type_check] context.
///
/// This is used to skip type checking when the `@no_type_check` decorator is found.
///
/// For example (adapted from [#13824]):
/// ```python
/// from typing import no_type_check
///
/// @no_type_check
/// def fn(arg: "A") -> "R":
/// pass
/// ```
///
/// [no_type_check]: https://docs.python.org/3/library/typing.html#typing.no_type_check
/// [#13824]: https://github.com/astral-sh/ruff/issues/13824
const NO_TYPE_CHECK = 1 << 26;
/// The model is in the value expression of a [PEP 613] explicit type alias.
///
/// For example: