Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork960
Commit5778b7a
committed
Use LBYL for imports where EAFP is a mypy type error
The conditional imports of Literal from either typing ortyping_extensions have to be done with if-else on the Pythonversion rather than with try-except, or it is a static type error.This makes that change, checking sys.version_info.(See discussion in#1861 and#1862 for broader context andbackground on why this logic, before and after this change, isrepeated across multiple modules.)This also reorders/regroups imports for consistency in some places,especially where a new import of the sys module (for version_info)would otherwise exacerbate inconsistency.Since the merge commit0b99041, the number of mypy errors hadincreased from 5 to 10. This fixes all the new mypy errors, so thecount is back to 5.1 parent74f3c2e commit5778b7a
5 files changed
+43
-42
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | | - | |
| 11 | + | |
11 | 12 | | |
12 | | - | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
7 | 11 | | |
8 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
9 | 16 | | |
10 | | - | |
11 | | - | |
12 | 17 | | |
| 18 | + | |
| 19 | + | |
13 | 20 | | |
14 | 21 | | |
15 | | - | |
16 | 22 | | |
17 | 23 | | |
18 | 24 | | |
19 | | - | |
20 | 25 | | |
21 | | - | |
22 | 26 | | |
| 27 | + | |
| 28 | + | |
23 | 29 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
40 | 41 | | |
41 | | - | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | | - | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
48 | | - | |
49 | | - | |
| 47 | + | |
50 | 48 | | |
51 | | - | |
| 49 | + | |
52 | 50 | | |
53 | 51 | | |
| 52 | + | |
| 53 | + | |
54 | 54 | | |
55 | | - | |
56 | 55 | | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
43 | 42 | | |
44 | 43 | | |
45 | 44 | | |
| |||
54 | 53 | | |
55 | 54 | | |
56 | 55 | | |
57 | | - | |
58 | | - | |
59 | | - | |
| 56 | + | |
60 | 57 | | |
61 | | - | |
| 58 | + | |
62 | 59 | | |
63 | 60 | | |
| 61 | + | |
| 62 | + | |
64 | 63 | | |
65 | 64 | | |
66 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
17 | 19 | | |
18 | 20 | | |
19 | | - | |
| 21 | + | |
20 | 22 | | |
21 | | - | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
| 7 | + | |
7 | 8 | | |
8 | | - | |
| 9 | + | |
9 | 10 | | |
10 | | - | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | 13 | | |
16 | | - | |
| 14 | + | |
| 15 | + | |
17 | 16 | | |
18 | 17 | | |
19 | 18 | | |
| |||
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | 31 | | |
33 | 32 | | |
34 | | - | |
35 | | - | |
36 | | - | |
| 33 | + | |
37 | 34 | | |
38 | | - | |
| 35 | + | |
39 | 36 | | |
40 | 37 | | |
| 38 | + | |
| 39 | + | |
41 | 40 | | |
42 | | - | |
43 | 41 | | |
| 42 | + | |
44 | 43 | | |
45 | 44 | | |
46 | 45 | | |
| |||
0 commit comments
Comments
(0)