Commit 91f2d36
Plugin to typecheck attrs-generated classes (#4397)
See http://www.attrs.org/en/stable/how-does-it-work.html for
information on how attrs works.
The plugin walks the class declaration (including superclasses) looking
for "attributes" then depending on how the decorator was called, makes
modification to the classes as follows:
* init=True adds an __init__ method.
* cmp=True adds all of the necessary __cmp__ methods.
* frozen=True turns all attributes into properties to make the class read only.
* Remove any @x.default and @y.validator decorators which are only part
of class creation.
Fixes #20881 parent b993693 commit 91f2d36
File tree
12 files changed
+1611
-3
lines changed- mypy
- plugins
- test
- test-data/unit
- fixtures
- lib-stub
12 files changed
+1611
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1993 | 1993 | | |
1994 | 1994 | | |
1995 | 1995 | | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
1996 | 2000 | | |
1997 | 2001 | | |
1998 | 2002 | | |
| |||
2016 | 2020 | | |
2017 | 2021 | | |
2018 | 2022 | | |
| 2023 | + | |
2019 | 2024 | | |
2020 | 2025 | | |
2021 | 2026 | | |
| |||
2218 | 2223 | | |
2219 | 2224 | | |
2220 | 2225 | | |
| 2226 | + | |
2221 | 2227 | | |
2222 | 2228 | | |
2223 | 2229 | | |
| |||
2244 | 2250 | | |
2245 | 2251 | | |
2246 | 2252 | | |
| 2253 | + | |
2247 | 2254 | | |
2248 | 2255 | | |
2249 | 2256 | | |
| |||
2612 | 2619 | | |
2613 | 2620 | | |
2614 | 2621 | | |
| 2622 | + | |
| 2623 | + | |
| 2624 | + | |
| 2625 | + | |
| 2626 | + | |
| 2627 | + | |
| 2628 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | 3 | | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
8 | 13 | | |
9 | | - | |
| 14 | + | |
10 | 15 | | |
11 | 16 | | |
12 | 17 | | |
| |||
56 | 61 | | |
57 | 62 | | |
58 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
59 | 67 | | |
60 | 68 | | |
61 | 69 | | |
| |||
69 | 77 | | |
70 | 78 | | |
71 | 79 | | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
72 | 96 | | |
73 | 97 | | |
74 | 98 | | |
| |||
262 | 286 | | |
263 | 287 | | |
264 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
265 | 300 | | |
266 | 301 | | |
267 | 302 | | |
| |||
Whitespace-only changes.
0 commit comments