You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While translating some models implemented using Python's standard dataclass decorator into Pydantic dataclasses, mypy 0.931 started complaining about unexpected keyword arguments
The dataclass decorator is annotated as returning a Dataclass object, which defines the Pydantic dataclass additions, losing any information about the original class that is being decorated. The dataclass transformation defined in #2721 is only applied to ModelMetaclass, which is not the metaclass of dataclasses.
I know of no way to annotate correctly a decorator that modifies a class's methods and fields. You either do what Pydantic does or you annotate like your decorator does not change the class.
Bug
Output of
python -c "import pydantic.utils; print(pydantic.utils.version_info())"
:While translating some models implemented using Python's standard dataclass decorator into Pydantic dataclasses,
mypy 0.931
started complaining about unexpected keyword argumentsOutput of
mypy test.py
The text was updated successfully, but these errors were encountered: