non-str-assignment-to-dunder-name / W1115ΒΆ

Message emitted:

Non-string value assigned to __name__

Description:

Emitted when a non-string value is assigned to __name__

Problematic code:

class Fruit:
    pass


Fruit.__name__ = 1  # [non-str-assignment-to-dunder-name]

Correct code:

class Fruit:
    pass


Fruit.__name__ = "FRUIT"

Created by the typecheck checker.