You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This changes `return None` to `return` where it appears in
functions that are "conceptually void," i.e. cases where a function
always returns None, its purpose is never to provide a return value
to 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 consistency
improvement, as well as improving clarity by avoiding giving the
impression that "None" is significant in those cases.
Of course, functions that sometimes return values other than None
do 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.
0 commit comments