ruff
565ddebb - Improve detection of `TYPE_CHECKING` blocks imported from `typing_extensions` or `_typeshed` (#8429)

Commit
2 years ago
Improve detection of `TYPE_CHECKING` blocks imported from `typing_extensions` or `_typeshed` (#8429) ~Improves detection of types imported from `typing_extensions`. Removes the hard-coded list of supported types in `typing_extensions`; instead assuming all types could be imported from `typing`, `_typeshed`, or `typing_extensions`.~ ~The typing extensions package appears to re-export types even if they do not need modification.~ Adds detection of `if typing_extensions.TYPE_CHECKING` blocks. Avoids inserting a new `if TYPE_CHECKING` block and `from typing import TYPE_CHECKING` if `typing_extensions.TYPE_CHECKING` is used (closes https://github.com/astral-sh/ruff/issues/8427) --------- Co-authored-by: Charlie Marsh <charlie.r.marsh@gmail.com>
Author
Parents
Loading