Warnings on nested dataclass instantiation

PyCharm static code analyzer shows warning about wrong parameter type passed to inner dataclass __init__ in such case:

  

from dataclasses import dataclass


class Outer:
@dataclass
class Inner:
a: int


# Passing int instead of test.Outer. Is this intentional?
instance = Outer.Inner(1)

0
1 comment

Hello, 

 

This is a known issue please see https://youtrack.jetbrains.com/issue/PY-35698 and vote for it in order to increase its priority. 

 

Apologies for the inconvenience. 

0

Please sign in to leave a comment.