ruff
ruff copied to clipboard
False positive PLC0132 for NewType wrapped in Annotated
Ruff 0.3.5 false positive PLC0132 for NewType wrapped in Annotated
MyIds = Annotated[NewType("WrongName", str), int] # PLC0132 doesn't work
MyId = NewType("Id", str) # NewType` name `Id` does not match assigned variable name `MyId` PLC0132
Keywords: Annotated, NewType, PLC0132
Thanks!
@erictraut say's that it is not a bug, so maybe this issuer need to be closed without fix/code.
Pyright is working correctly here. When you wrap a
NewTypewithAnnotated, the resulting object is no longer aNewType. It's a type alias. It's name does not need to match that of the (anonymous) NewType that was created.
Related task in pyright repo: 7645
Ah ok, thanks for following up!