Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork938
Commit39e2dff
committed
Don't return with operand when conceptually void
This changes `return None` to `return` where it appears infunctions that are "conceptually void," i.e. cases where a functionalways returns None, its purpose is never to provide a return valueto the caller, and it would be a bug (or at least confusing style)to use the return value or have the call as a subexpression.This is already the prevailing style, so this is a consistencyimprovement, as well as improving clarity by avoiding giving theimpression that "None" is significant in those cases.Of course, functions that sometimes return values other than Nonedo not have "return None" replaced with a bare "return" statement.Those are left alone (when they return None, it means something).For the most part this is straightforward, but:- The handle_stderr local function in IndexFile.checkout is also slightly further refactored to better express what the early return is doing.- The "None" operand is removed as usual in GitConfigParser.read, even though a superclass has a same-named method with a return type that is not None. Usually when this happens, the superclass method returns something like Optional[Something], and it is a case of return type covariance, in which case the None operands should still be written. Here, however, the overriding method does not intend to be an override: it has an incompatible signature and cannot be called as if it were the superclass method, nor is its return type compatible.- The "None" operand is *retained* in git.cmd.handle_process_output even though the return type is annotated as None, because the function also returns the expression `finalizer(process)`. The argument `finalizer` is itself annotated to return None, but it looks like the intent may be to play along with the strange case that `finalizer` returns a non-None value, and forward it.1 parentb8ee9be commit39e2dff
7 files changed
+16
-15
lines changedLines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
528 | 528 |
| |
529 | 529 |
| |
530 | 530 |
| |
531 |
| - | |
| 531 | + | |
532 | 532 |
| |
533 | 533 |
| |
534 | 534 |
| |
535 | 535 |
| |
536 | 536 |
| |
537 |
| - | |
| 537 | + | |
538 | 538 |
| |
539 | 539 |
| |
540 | 540 |
| |
|
Lines changed: 5 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
203 | 203 |
| |
204 | 204 |
| |
205 | 205 |
| |
206 |
| - | |
| 206 | + | |
| 207 | + | |
207 | 208 |
| |
208 | 209 |
| |
209 | 210 |
| |
| |||
579 | 580 |
| |
580 | 581 |
| |
581 | 582 |
| |
582 |
| - | |
| 583 | + | |
583 | 584 |
| |
584 | 585 |
| |
585 | 586 |
| |
| |||
697 | 698 |
| |
698 | 699 |
| |
699 | 700 |
| |
700 |
| - | |
| 701 | + | |
701 | 702 |
| |
702 | 703 |
| |
703 | 704 |
| |
| |||
711 | 712 |
| |
712 | 713 |
| |
713 | 714 |
| |
714 |
| - | |
| 715 | + | |
715 | 716 |
| |
716 | 717 |
| |
717 | 718 |
| |
|
Lines changed: 4 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
166 | 166 |
| |
167 | 167 |
| |
168 | 168 |
| |
169 |
| - | |
| 169 | + | |
170 | 170 |
| |
171 | 171 |
| |
172 | 172 |
| |
| |||
1210 | 1210 |
| |
1211 | 1211 |
| |
1212 | 1212 |
| |
1213 |
| - | |
1214 |
| - | |
1215 |
| - | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
1216 | 1216 |
| |
1217 | 1217 |
| |
1218 | 1218 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
83 | 83 |
| |
84 | 84 |
| |
85 | 85 |
| |
86 |
| - | |
| 86 | + | |
87 | 87 |
| |
88 | 88 |
| |
89 | 89 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
68 | 68 |
| |
69 | 69 |
| |
70 | 70 |
| |
71 |
| - | |
| 71 | + | |
72 | 72 |
| |
73 | 73 |
| |
74 | 74 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
500 | 500 |
| |
501 | 501 |
| |
502 | 502 |
| |
503 |
| - | |
504 |
| - | |
| 503 | + | |
| 504 | + | |
505 | 505 |
| |
506 | 506 |
| |
507 | 507 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
644 | 644 |
| |
645 | 645 |
| |
646 | 646 |
| |
647 |
| - | |
| 647 | + | |
648 | 648 |
| |
649 | 649 |
| |
650 | 650 |
| |
|
0 commit comments
Comments
(0)