perf: improved `DocStatus` API and other minor improvements by sagarvora [frappe] PR#31389
From: https://github.com/frappe/frappe/pull/31389
Date: 2025-02-24 12:27:48+05:30
- perf: improved
DocStatusAPI and other minor improvements
Diagnostics
pre-commit failed for source commit: fcf657ba80d19520a2b51d8919473ac9d8fe2950
[WARNING] top-level `default_stages` uses deprecated stage names (commit) which will be removed in a future version. run: `pre-commit migrate-config` to automatically fix this.
frappe/model/base_document.py:659:5: RUF005 Consider `[*list(d.values()), name]` instead of concatenation
|
657 | doctype=self.doctype, values=", ".join("`" + c + "`=%s" for c in columns)
658 | ),
659 | list(d.values()) + [name],
| ^^^^^^^^^^^^^^^^^^^^^^^^^ RUF005
660 | )
661 | except Exception as e:
|
= help: Replace with `[*list(d.values()), name]`
frappe/model/workflow.py:122:15: RUF015 Prefer `next(...)` over single element slice
|
121 | # find settings for the next state
122 | next_state = [d for d in workflow.states if d.state == transition.next_state][0]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUF015
123 |
124 | # update any additional field
|
= help: Replace with `next(...)`
Found 2 errors.
No fixes available (2 hidden fixes can be enabled with the `--unsafe-fixes` option).
Checkout instructions
# Checkout locally
git fetch upstream
git switch ft-pr-31389
# Alternatively, re-take the changes
git switch develop
ft take ft-pr-31389
# Make changes then rebase
git rebase -i develop
# Fix or ignore conflicts
git checkout --theirs .
git rebase --continue
# Force-push changes
git push --force-with-lease