How to avoid unexpected argument warning using data classes


I have the following simple code.

class Test:
    a: bool = True
    b: bool = True
    c: bool = True

    def create_default(cls) -> 'Test':
        return cls(a=False, b=False, c=False)

I don’t understand why PyCharm highlight the line:
return cls(a=False, b=False, c=False) with unexpected argument

Am I doing smth wrong?

Asked By: indigo153



This is a bug in Pycharm that has been already fixed. Update to the latest version (2018.2.4 when this answer was written)

Answered By: DeepSpace