hauntsaninja / no_implicit_optional

A codemod to make your implicit optional type hints PEP 484 compliant.
MIT License
79 stars 8 forks source link

Unneed import Optional #21

Closed xiaoyanli-lyft closed 10 months ago

xiaoyanli-lyft commented 10 months ago

Testing some python3.8 codebase, no_impilicit_optional still insert

from typing import Optional

when code has

from __future__ import annotations
hauntsaninja commented 10 months ago

Thanks for the issue! If I understand the situation correctly, the symbol still needs to be imported for mypy to be able to resolve it. It also needs to be imported if you have runtime evaluation of type annotations.