-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
I have a class, whose slots are formed by concatenating other literal tuples via RUF005 style. Below B
is reported to violate PLE0237, which is a false positive, I also tried a few variants of B
:
C
: IfB
is a subclass of any other class, PLE0237 seems to work fineD
: IfB
slots has no other literal items, PLE0237 seems to work fineE
: IfB
slots uses tuple concatenation, which violates RUF005, but PLE0237 seems to work fine
class A:
pass
class B:
names = ("x",)
__slots__ = (*names, "a")
def __init__(self) -> None:
self.x = 1 # PLE0237: Attribute `x` is not defined in class's `__slots__`
class C(A):
names = ("x",)
__slots__ = (*names, "a")
def __init__(self) -> None:
self.x = 1
class D:
names = ("x",)
__slots__ = (*names,)
def __init__(self) -> None:
self.x = 1
class E:
names = ("x",)
__slots__ = names + ("a",) # RUF005: Consider `(*names, "a")` instead of concatenation
def __init__(self) -> None:
self.x = 1
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working