Repository navigation
Commit cb67d18
committed
Return an
The function returned a `tuple[bool, bool]`, which callers matched on with
one `case` per combination. mypy can't narrow tuple items across `case`
clauses (python/mypy#12364), so it can't tell whether such a `match` covers
every combination, and a missing case would go unnoticed. This is about to
matter, as the next `frequenz-repo-config` enables mypy's `exhaustive-match`
error code, which reports these two `match` statements.
Return a four-valued enum instead, which mypy does check exhaustively, and
which also reads better: `(True, False)` gave no hint about which of the two
bounds it referred to.
The two call sites in `_matryoshka.py` only cared about one combination, so
they become plain `if` statements.
Both matches also get an `assert_never()` case, to fail early if an
unexpected value ever reaches them: type hints are not enforced at runtime.
Signed-off-by: Leandro Lucarella <[email protected]>ExclusionOverlap from check_exclusion_bounds_overlap()
1 parent 900fa0e commit cb67d18
2 files changed
Lines changed: 66 additions & 30 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
10 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
11 | 35 | | |
12 | 36 | | |
13 | 37 | | |
14 | 38 | | |
15 | | - | |
| 39 | + | |
16 | 40 | | |
17 | 41 | | |
18 | 42 | | |
| |||
29 | 53 | | |
30 | 54 | | |
31 | 55 | | |
32 | | - | |
33 | | - | |
| 56 | + | |
| 57 | + | |
34 | 58 | | |
35 | 59 | | |
36 | 60 | | |
37 | 61 | | |
38 | 62 | | |
39 | 63 | | |
40 | 64 | | |
41 | | - | |
42 | | - | |
43 | | - | |
| 65 | + | |
44 | 66 | | |
45 | 67 | | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
| 68 | + | |
50 | 69 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 70 | + | |
| 71 | + | |
55 | 72 | | |
56 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
57 | 80 | | |
58 | 81 | | |
59 | 82 | | |
| |||
80 | 103 | | |
81 | 104 | | |
82 | 105 | | |
83 | | - | |
| 106 | + | |
84 | 107 | | |
85 | | - | |
| 108 | + | |
86 | 109 | | |
87 | | - | |
| 110 | + | |
88 | 111 | | |
89 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
90 | 116 | | |
91 | 117 | | |
92 | 118 | | |
| |||
123 | 149 | | |
124 | 150 | | |
125 | 151 | | |
126 | | - | |
| 152 | + | |
127 | 153 | | |
128 | | - | |
| 154 | + | |
129 | 155 | | |
130 | 156 | | |
131 | | - | |
| 157 | + | |
132 | 158 | | |
133 | 159 | | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
134 | 166 | | |
135 | 167 | | |
136 | 168 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
115 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
116 | 119 | | |
117 | | - | |
118 | | - | |
| 120 | + | |
119 | 121 | | |
120 | 122 | | |
121 | 123 | | |
| |||
275 | 277 | | |
276 | 278 | | |
277 | 279 | | |
278 | | - | |
279 | | - | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
280 | 285 | | |
281 | | - | |
282 | | - | |
| 286 | + | |
283 | 287 | | |
284 | 288 | | |
285 | 289 | | |
| |||
0 commit comments