-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
The new rule RUF013 doesn’t properly handle string annotations.
I would expect the following to be fine:
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from datetime import datetime
def last_value(timestamp: 'datetime | None'=None) -> float ...but with the latest version, I get: RUF013 [*] PEP 484 prohibits implicit `Optional` and the --fix version will replace it by:
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from datetime import datetime
def last_value(timestamp: 'datetime | None' |None=None) -> float ...which is not valid and will give me:
TypeError: unsupported operand type(s) for |: 'str' and 'NoneType'
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working