Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork944
Commita36b8a5
committed
Always use a
This stops listing Ruff rule `E731` ("Do not assign a `lambda`expression, use a `def`") as ignored, and fixes all occurrences ofit:- Spacing is manually adjusted so that readability is not harmed, while still satisfying the current formatting conventions.- Although the affected test modules do not currently use type annotations, the non-test modules do. Some of the lambdas already had type annotations, by annotating the variable itself with an expression formed by subscripting `Callable`. This change preserves them, converting them to paramter and return type annotations in the resulting `def`. Where such type annotations were absent (in lambdas in non-test modules), or partly absent, all missing annotations are added to the `def`.- Unused paramters are prefixed with a `_`.- `IndexFile.checkout` assigned a lambda to `make_exc`, whose body was somewhat difficult to read. Separately from converting it to a `def`, this refactors the expression in the `return` statement to use code like `(x, *ys)` in place of `(x,) + tuple(ys)`.This change does not appear to have introduced (nor fixed) any`mypy` errors.This only affects lambdas that were assigned directly to variables.Other lambda expressions remain unchanged.def
instead of assigning alambda
1 parent6f4f7f5 commita36b8a5
File tree
6 files changed
+36
-10
lines changed- git
- index
- objects
- test
6 files changed
+36
-10
lines changedLines changed: 15 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
530 | 530 |
| |
531 | 531 |
| |
532 | 532 |
| |
533 |
| - | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
534 | 537 |
| |
535 | 538 |
| |
536 | 539 |
| |
| |||
690 | 693 |
| |
691 | 694 |
| |
692 | 695 |
| |
| 696 | + | |
693 | 697 |
| |
694 | 698 |
| |
695 | 699 |
| |
696 |
| - | |
| 700 | + | |
| 701 | + | |
697 | 702 |
| |
698 |
| - | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
699 | 707 |
| |
700 | 708 |
| |
701 | 709 |
| |
| |||
1336 | 1344 |
| |
1337 | 1345 |
| |
1338 | 1346 |
| |
| 1347 | + | |
1339 | 1348 |
| |
1340 |
| - | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
1341 | 1352 |
| |
1342 | 1353 |
| |
1343 | 1354 |
| |
|
Lines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
50 | 50 |
| |
51 | 51 |
| |
52 | 52 |
| |
53 |
| - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
54 | 56 |
| |
55 | 57 |
| |
56 | 58 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
66 | 66 |
| |
67 | 67 |
| |
68 | 68 |
| |
69 |
| - | |
| 69 | + | |
70 | 70 |
| |
71 | 71 |
| |
72 | 72 |
| |
|
Lines changed: 5 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
243 | 243 |
| |
244 | 244 |
| |
245 | 245 |
| |
| 246 | + | |
246 | 247 |
| |
247 | 248 |
| |
248 | 249 |
| |
| |||
251 | 252 |
| |
252 | 253 |
| |
253 | 254 |
| |
254 |
| - | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
255 | 259 |
| |
256 | 260 |
| |
257 | 261 |
| |
|
Lines changed: 4 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
330 | 330 |
| |
331 | 331 |
| |
332 | 332 |
| |
333 |
| - | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
334 | 337 |
| |
335 | 338 |
| |
336 | 339 |
| |
|
Lines changed: 8 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
126 | 126 |
| |
127 | 127 |
| |
128 | 128 |
| |
129 |
| - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
130 | 133 |
| |
131 | 134 |
| |
132 | 135 |
| |
133 | 136 |
| |
134 |
| - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
135 | 141 |
| |
136 | 142 |
| |
137 | 143 |
| |
|
0 commit comments
Comments
(0)