How to avoid unexpected argument warning using data classes

Question:

I have the following simple code.

@dataclass(frozen=True)
class Test:
    a: bool = True
    b: bool = True
    c: bool = True

    @classmethod
    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

||

Answers:

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