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 stops listing Ruff rule `E731` ("Do not assign a `lambda`
expression, use a `def`") as ignored, and fixes all occurrences of
it:
- 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.
0 commit comments