single-string-used-for-slots / C0205ΒΆ

Message emitted:

Class __slots__ should be a non-string iterable

Description:

Used when a class __slots__ is a simple string, rather than an iterable.

Problematic code:

class Fruit:  # [single-string-used-for-slots]
    __slots__ = "name"

    def __init__(self, name):
        self.name = name

Correct code:

class Fruit:
    __slots__ = ("name",)

    def __init__(self, name):
        self.name = name

Created by the classes checker.