unexpected-special-method-signature / E0302#

Message emitted:

The special method %r expects %s param(s), %d %s given

Description:

Emitted when a special method was defined with an invalid number of parameters. If it has too few or too many, it might not work at all.

Correct code:

class ContextManager:
    def __enter__(self):
        pass

    def __exit__(self, type, value, traceback):
        pass

Problematic code:

class ContextManager:
    def __enter__(self, context):  # [unexpected-special-method-signature]
        pass

    def __exit__(self, type):  # [unexpected-special-method-signature]
        pass

Created by the classes checker.