Commit 83fed5a
authored
Skip more method bodies in third-party libraries (#19586)
A while ago we started stripping function bodies when checking
third-party libraries. This PR pushes this idea further:
* Tighten the check in `fastparse.py` to only consider `foo.bar` as
possible self attribute definition.
* Do not type-check bodies where we didn't find any `self` attribute
_definitions_ during semantic analysis.
* Skip method override checks in third-party libraries.
In total this makes e.g. `mypy -c 'import torch'` ~10% faster.
Surprisingly, this also has some visible impact on self-check.1 parent 3387d6f commit 83fed5a
4 files changed
+27
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
832 | 832 | | |
833 | 833 | | |
834 | 834 | | |
835 | | - | |
836 | | - | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
837 | 839 | | |
838 | 840 | | |
839 | 841 | | |
| |||
1444 | 1446 | | |
1445 | 1447 | | |
1446 | 1448 | | |
1447 | | - | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
1448 | 1462 | | |
1449 | 1463 | | |
1450 | 1464 | | |
| |||
2127 | 2141 | | |
2128 | 2142 | | |
2129 | 2143 | | |
| 2144 | + | |
| 2145 | + | |
| 2146 | + | |
2130 | 2147 | | |
2131 | 2148 | | |
2132 | 2149 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2234 | 2234 | | |
2235 | 2235 | | |
2236 | 2236 | | |
2237 | | - | |
| 2237 | + | |
2238 | 2238 | | |
2239 | 2239 | | |
2240 | 2240 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
818 | 818 | | |
819 | 819 | | |
820 | 820 | | |
| 821 | + | |
821 | 822 | | |
822 | 823 | | |
823 | 824 | | |
| |||
856 | 857 | | |
857 | 858 | | |
858 | 859 | | |
| 860 | + | |
| 861 | + | |
859 | 862 | | |
860 | 863 | | |
861 | 864 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4570 | 4570 | | |
4571 | 4571 | | |
4572 | 4572 | | |
| 4573 | + | |
| 4574 | + | |
| 4575 | + | |
4573 | 4576 | | |
4574 | 4577 | | |
4575 | 4578 | | |
| |||
0 commit comments