Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mypy plugin support for dataclasses (#966)
* mypy plugin support for dataclassesv * fix styles and types * - change type-hint for `Config` - change name of an expected file - update documents * fix broken a reference of a document. * - update unittest - update documents * fix a document link * Update docs/mypy_plugin.md Co-Authored-By: Samuel Colvin <samcolvin@gmail.com> * Update docs/mypy_plugin.md Co-Authored-By: Samuel Colvin <samcolvin@gmail.com> * Update docs/mypy_plugin.md Co-Authored-By: Samuel Colvin <samcolvin@gmail.com> * remove extra whitespaces on mypy test results * fix output file name of mypy test * Update docs/usage/dataclasses.md Co-Authored-By: Samuel Colvin <samcolvin@gmail.com> * use TypeVar for DataclassType
- Loading branch information
1 parent
0e8f886
commit 33b3dc1
Showing
13 changed files
with
146 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Mypy plugin support for dataclasses |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
121: error: Unexpected keyword argument "name" for "AddProject" [call-arg] | ||
121: error: Unexpected keyword argument "slug" for "AddProject" [call-arg] | ||
121: error: Unexpected keyword argument "description" for "AddProject" [call-arg] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,35 @@ | ||
23: error: Unexpected keyword argument "z" for "Model" [call-arg] | ||
24: error: Missing named argument "y" for "Model" [call-arg] | ||
25: error: Property "y" defined in "Model" is read-only [misc] | ||
26: error: "Model" does not have orm_mode=True [pydantic-orm] | ||
35: error: Unexpected keyword argument "x" for "ForbidExtraModel" [call-arg] | ||
46: error: Unexpected keyword argument "x" for "ForbidExtraModel2" [call-arg] | ||
52: error: Invalid value for "Config.extra" [pydantic-config] | ||
57: error: Invalid value for "Config.orm_mode" [pydantic-config] | ||
62: error: Invalid value for "Config.orm_mode" [pydantic-config] | ||
73: error: Incompatible types in assignment (expression has type "ellipsis", variable has type "int") [assignment] | ||
76: error: Untyped fields disallowed [pydantic-field] | ||
83: error: Untyped fields disallowed [pydantic-field] | ||
86: error: Missing named argument "a" for "DefaultTestingModel" [call-arg] | ||
86: error: Missing named argument "b" for "DefaultTestingModel" [call-arg] | ||
86: error: Missing named argument "c" for "DefaultTestingModel" [call-arg] | ||
86: error: Missing named argument "d" for "DefaultTestingModel" [call-arg] | ||
86: error: Missing named argument "e" for "DefaultTestingModel" [call-arg] | ||
90: error: Name 'Undefined' is not defined [name-defined] | ||
93: error: Missing named argument "undefined" for "UndefinedAnnotationModel" [call-arg] | ||
100: error: Missing named argument "y" for "construct" of "Model" [call-arg] | ||
102: error: Argument "x" to "construct" of "Model" has incompatible type "str"; expected "int" [arg-type] | ||
107: error: Argument "x" to "InheritingModel" has incompatible type "str"; expected "int" [arg-type] | ||
108: error: Argument "x" to "Settings" has incompatible type "str"; expected "int" [arg-type] | ||
109: error: Argument "x" to "Model" has incompatible type "str"; expected "int" [arg-type] | ||
126: error: Argument "data" to "Response" has incompatible type "int"; expected "Model" [arg-type] | ||
134: error: Argument "y" to "AliasModel" has incompatible type "int"; expected "str" [arg-type] | ||
140: error: Required dynamic aliases disallowed [pydantic-alias] | ||
144: error: Argument "z" to "DynamicAliasModel" has incompatible type "str"; expected "int" [arg-type] | ||
155: error: Unexpected keyword argument "y" for "DynamicAliasModel2" [call-arg] | ||
162: error: Required dynamic aliases disallowed [pydantic-alias] | ||
180: error: Untyped fields disallowed [pydantic-field] | ||
184: error: Unexpected keyword argument "x" for "AliasGeneratorModel2" [call-arg] | ||
185: error: Unexpected keyword argument "z" for "AliasGeneratorModel2" [call-arg] | ||
188: error: Name 'Missing' is not defined [name-defined] | ||
24: error: Unexpected keyword argument "z" for "Model" [call-arg] | ||
25: error: Missing named argument "y" for "Model" [call-arg] | ||
26: error: Property "y" defined in "Model" is read-only [misc] | ||
27: error: "Model" does not have orm_mode=True [pydantic-orm] | ||
36: error: Unexpected keyword argument "x" for "ForbidExtraModel" [call-arg] | ||
47: error: Unexpected keyword argument "x" for "ForbidExtraModel2" [call-arg] | ||
53: error: Invalid value for "Config.extra" [pydantic-config] | ||
58: error: Invalid value for "Config.orm_mode" [pydantic-config] | ||
63: error: Invalid value for "Config.orm_mode" [pydantic-config] | ||
74: error: Incompatible types in assignment (expression has type "ellipsis", variable has type "int") [assignment] | ||
77: error: Untyped fields disallowed [pydantic-field] | ||
84: error: Untyped fields disallowed [pydantic-field] | ||
87: error: Missing named argument "a" for "DefaultTestingModel" [call-arg] | ||
87: error: Missing named argument "b" for "DefaultTestingModel" [call-arg] | ||
87: error: Missing named argument "c" for "DefaultTestingModel" [call-arg] | ||
87: error: Missing named argument "d" for "DefaultTestingModel" [call-arg] | ||
87: error: Missing named argument "e" for "DefaultTestingModel" [call-arg] | ||
91: error: Name 'Undefined' is not defined [name-defined] | ||
94: error: Missing named argument "undefined" for "UndefinedAnnotationModel" [call-arg] | ||
101: error: Missing named argument "y" for "construct" of "Model" [call-arg] | ||
103: error: Argument "x" to "construct" of "Model" has incompatible type "str"; expected "int" [arg-type] | ||
108: error: Argument "x" to "InheritingModel" has incompatible type "str"; expected "int" [arg-type] | ||
109: error: Argument "x" to "Settings" has incompatible type "str"; expected "int" [arg-type] | ||
110: error: Argument "x" to "Model" has incompatible type "str"; expected "int" [arg-type] | ||
127: error: Argument "data" to "Response" has incompatible type "int"; expected "Model" [arg-type] | ||
135: error: Argument "y" to "AliasModel" has incompatible type "int"; expected "str" [arg-type] | ||
141: error: Required dynamic aliases disallowed [pydantic-alias] | ||
145: error: Argument "z" to "DynamicAliasModel" has incompatible type "str"; expected "int" [arg-type] | ||
156: error: Unexpected keyword argument "y" for "DynamicAliasModel2" [call-arg] | ||
163: error: Required dynamic aliases disallowed [pydantic-alias] | ||
181: error: Untyped fields disallowed [pydantic-field] | ||
185: error: Unexpected keyword argument "x" for "AliasGeneratorModel2" [call-arg] | ||
186: error: Unexpected keyword argument "z" for "AliasGeneratorModel2" [call-arg] | ||
189: error: Name 'Missing' is not defined [name-defined] | ||
197: error: Argument "config" to "dataclass" has incompatible type "Dict[<nothing>, <nothing>]"; expected "Optional[Type[Any]]" [arg-type] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
23: error: Unexpected keyword argument "z" for "Model" [call-arg] | ||
24: error: Missing named argument "y" for "Model" [call-arg] | ||
25: error: Property "y" defined in "Model" is read-only [misc] | ||
26: error: "Model" does not have orm_mode=True [pydantic-orm] | ||
35: error: Unexpected keyword argument "x" for "ForbidExtraModel" [call-arg] | ||
46: error: Unexpected keyword argument "x" for "ForbidExtraModel2" [call-arg] | ||
52: error: Invalid value for "Config.extra" [pydantic-config] | ||
57: error: Invalid value for "Config.orm_mode" [pydantic-config] | ||
62: error: Invalid value for "Config.orm_mode" [pydantic-config] | ||
73: error: Incompatible types in assignment (expression has type "ellipsis", variable has type "int") [assignment] | ||
86: error: Missing named argument "a" for "DefaultTestingModel" [call-arg] | ||
86: error: Missing named argument "b" for "DefaultTestingModel" [call-arg] | ||
86: error: Missing named argument "c" for "DefaultTestingModel" [call-arg] | ||
86: error: Missing named argument "d" for "DefaultTestingModel" [call-arg] | ||
86: error: Missing named argument "e" for "DefaultTestingModel" [call-arg] | ||
90: error: Name 'Undefined' is not defined [name-defined] | ||
93: error: Missing named argument "undefined" for "UndefinedAnnotationModel" [call-arg] | ||
100: error: Missing named argument "y" for "construct" of "Model" [call-arg] | ||
102: error: Argument "x" to "construct" of "Model" has incompatible type "str"; expected "int" [arg-type] | ||
155: error: Missing named argument "x" for "DynamicAliasModel2" [call-arg] | ||
174: error: unused 'type: ignore' comment | ||
181: error: unused 'type: ignore' comment | ||
188: error: Name 'Missing' is not defined [name-defined] | ||
24: error: Unexpected keyword argument "z" for "Model" [call-arg] | ||
25: error: Missing named argument "y" for "Model" [call-arg] | ||
26: error: Property "y" defined in "Model" is read-only [misc] | ||
27: error: "Model" does not have orm_mode=True [pydantic-orm] | ||
36: error: Unexpected keyword argument "x" for "ForbidExtraModel" [call-arg] | ||
47: error: Unexpected keyword argument "x" for "ForbidExtraModel2" [call-arg] | ||
53: error: Invalid value for "Config.extra" [pydantic-config] | ||
58: error: Invalid value for "Config.orm_mode" [pydantic-config] | ||
63: error: Invalid value for "Config.orm_mode" [pydantic-config] | ||
74: error: Incompatible types in assignment (expression has type "ellipsis", variable has type "int") [assignment] | ||
87: error: Missing named argument "a" for "DefaultTestingModel" [call-arg] | ||
87: error: Missing named argument "b" for "DefaultTestingModel" [call-arg] | ||
87: error: Missing named argument "c" for "DefaultTestingModel" [call-arg] | ||
87: error: Missing named argument "d" for "DefaultTestingModel" [call-arg] | ||
87: error: Missing named argument "e" for "DefaultTestingModel" [call-arg] | ||
91: error: Name 'Undefined' is not defined [name-defined] | ||
94: error: Missing named argument "undefined" for "UndefinedAnnotationModel" [call-arg] | ||
101: error: Missing named argument "y" for "construct" of "Model" [call-arg] | ||
103: error: Argument "x" to "construct" of "Model" has incompatible type "str"; expected "int" [arg-type] | ||
156: error: Missing named argument "x" for "DynamicAliasModel2" [call-arg] | ||
175: error: unused 'type: ignore' comment | ||
182: error: unused 'type: ignore' comment | ||
189: error: Name 'Missing' is not defined [name-defined] | ||
197: error: Argument "config" to "dataclass" has incompatible type "Dict[<nothing>, <nothing>]"; expected "Optional[Type[Any]]" [arg-type] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
28: error: Unexpected keyword argument "z" for "Model" [call-arg] | ||
63: error: Untyped fields disallowed [pydantic-field] | ||
78: error: Argument "x" to "OverrideModel" has incompatible type "float"; expected "int" [arg-type] | ||
29: error: Unexpected keyword argument "z" for "Model" [call-arg] | ||
64: error: Untyped fields disallowed [pydantic-field] | ||
79: error: Argument "x" to "OverrideModel" has incompatible type "float"; expected "int" [arg-type] |
Oops, something went wrong.