False Positive F811 Redfinition on class member if global variable with same name is unused.
Version: 0.7.1
In the following code snippet the class member is marked as redefinition
https://play.ruff.rs/ce10f9c6-0895-4146-932c-89c3aea05159
from queue import Empty
class Types:
INVALID = 0
UINT = 1
HEX = 2
Empty = 3 # <-- reported as redefinition
# q = Empty() <- this disables the error, if uncommented
Pyflakes flags this, so I'm inclined to say it's working as expected.
Looking at this more closely, it does seem consistent with how we handle redefinitions in function bodies.
https://play.ruff.rs/39ccfb6f-b0d6-4674-9fa1-6982797166fc
Thank you for looking at it. True, it is a redefinition I guess a warning is then helpfull.
I am then only confused about the variable usage of it that disables the error: https://play.ruff.rs/47aeefef-757c-47ec-afb0-7952478d0aeb
q = Empty() # <- this disables the error, if uncommented
The reason that the usage disables the warning is that F811 only warns about symbols that get redefined but are never used. Adding q = Empty() adds a use to Empty: It's still redefined, but no longer unused.