Commit 9d940c8
committed
processing: extract progress reporting from business logic
While trying to update pyright, it started complaining about
potentially unbound variables[^1]. These are not actual correctness
issues, but signals some code smell due to conditionally configured
variables.
The progress bar handling got extracted from `_process_task`, and got
converted to a context manager, so its lifetime management became
simpler. To eliminate if conditions sprinkled everywhere, a
`NullProgressDisplay` is also added for the case where we want to do
nothing.
[^1]:
```
/home/vlaci/devel/git/github.com/onekey-sec/unblob/unblob/processing.py
/home/vlaci/devel/git/github.com/onekey-sec/unblob/unblob/processing.py:163:36 - error: "progress_display" is possibly unbound (reportUnboundVariable)
/home/vlaci/devel/git/github.com/onekey-sec/unblob/unblob/processing.py:164:13 - error: "progress_display" is possibly unbound (reportUnboundVariable)
/home/vlaci/devel/git/github.com/onekey-sec/unblob/unblob/processing.py:165:17 - error: "overall_progress_task" is possibly unbound (reportUnboundVariable)
/home/vlaci/devel/git/github.com/onekey-sec/unblob/unblob/processing.py:167:23 - error: "progress_display" is possibly unbound (reportUnboundVariable)
/home/vlaci/devel/git/github.com/onekey-sec/unblob/unblob/processing.py:184:9 - error: "progress_display" is possibly unbound (reportUnboundVariable)
/home/vlaci/devel/git/github.com/onekey-sec/unblob/unblob/processing.py:184:38 - error: "overall_progress_task" is possibly unbound (reportUnboundVariable)
/home/vlaci/devel/git/github.com/onekey-sec/unblob/unblob/processing.py:185:9 - error: "progress_display" is possibly unbound (reportUnboundVariable)
7 errors, 0 warnings, 0 informations
```1 parent 861d76b commit 9d940c8
4 files changed
+115
-34
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
14 | 19 | | |
15 | 20 | | |
16 | 21 | | |
| |||
174 | 179 | | |
175 | 180 | | |
176 | 181 | | |
177 | | - | |
| 182 | + | |
178 | 183 | | |
179 | | - | |
180 | 184 | | |
181 | | - | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
182 | 222 | | |
183 | | - | |
184 | 223 | | |
185 | | - | |
| 224 | + | |
186 | 225 | | |
187 | | - | |
188 | | - | |
189 | 226 | | |
190 | 227 | | |
191 | 228 | | |
| |||
194 | 231 | | |
195 | 232 | | |
196 | 233 | | |
| 234 | + | |
197 | 235 | | |
198 | 236 | | |
199 | 237 | | |
| |||
225 | 263 | | |
226 | 264 | | |
227 | 265 | | |
| 266 | + | |
228 | 267 | | |
229 | 268 | | |
230 | 269 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
258 | 259 | | |
259 | 260 | | |
260 | 261 | | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
261 | 265 | | |
262 | 266 | | |
263 | 267 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | 10 | | |
13 | 11 | | |
14 | 12 | | |
| |||
45 | 43 | | |
46 | 44 | | |
47 | 45 | | |
| 46 | + | |
48 | 47 | | |
49 | 48 | | |
50 | 49 | | |
| |||
94 | 93 | | |
95 | 94 | | |
96 | 95 | | |
| 96 | + | |
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
| 149 | + | |
161 | 150 | | |
162 | 151 | | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
| 152 | + | |
| 153 | + | |
169 | 154 | | |
170 | 155 | | |
171 | 156 | | |
| |||
176 | 161 | | |
177 | 162 | | |
178 | 163 | | |
179 | | - | |
| 164 | + | |
180 | 165 | | |
181 | 166 | | |
182 | 167 | | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | 168 | | |
188 | 169 | | |
189 | 170 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
0 commit comments