Currently, an import in the form of:
will trigger F401, but this idiom is in widespread use as a type checker-friendly alternative to __all__ which does not alter star import semantics. Type checkers which support flagging unused imports will ignore re-exported symbols, i.e. symbols where the as target is identical to the original name:
# pyright: strict
from os import environ # Pyright reports this as unused
from os import environ as foo # Likewise
from os import environb as environb # No error
Thanks for ruff!
Currently, an import in the form of:
will trigger F401, but this idiom is in widespread use as a type checker-friendly alternative to
__all__which does not alter star import semantics. Type checkers which support flagging unused imports will ignore re-exported symbols, i.e. symbols where theastarget is identical to the original name:Thanks for ruff!