IDE incorrectly reports unexpected arguments to data class instance Follow
Hi,
I am using data classes with inheritance following the ideas of this SO post: https://stackoverflow.com/questions/51575931/class-inheritance-in-python-3-7-dataclasses (see top answer).
I have 5 classes. One abstract class (abc.ABC), three parent data classes, and one child class.
The editor believes the child class has no arguments in its __init__ and gives me a warning in the code. However, the Python console will happily show that the child class does have arguments in its constructor with the CMD+P command (on Mac).
The class hierarchy works like this:
@dataclass
class _AbstractFields:
data: bytes = None
class AbstractParent:
pass
@dataclass
class _ChildFields
name: str
@dataclass
class _ChildBase(_AbstractFields, _ChildFields):
pass
Child(_ChildBase, AbstractParent):
pass
Please sign in to leave a comment.
Hi,
It should be fixed in scope of https://youtrack.jetbrains.com/issue/PY-28506 in 2019.1
You can try our EAP build https://www.jetbrains.com/pycharm/nextversion/ if you like.
Please note, that you can have multiple PyCharm installations at the same time. So you don't need to uninstall current stable version to install EAP build.