[FIX] Apply Ruff fixes to chainladder/utils. - #1290
Conversation
Pyright Type CompletenessView the full Project (full
Other symbols referenced but not exported by
Symbols without documentation:
Patch (exported symbols added or changed by this PR): 100.0% fully typed (1 / 1); 1 no longer exported
Patch symbol details
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1290 +/- ##
==========================================
- Coverage 91.68% 91.67% -0.01%
==========================================
Files 93 93
Lines 5445 5443 -2
Branches 704 704
==========================================
- Hits 4992 4990 -2
Misses 328 328
Partials 125 125
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 1850b44. Configure here.
|
Not sure what's going on with that codecov patch, I don't think I changed the lines in any meaningful way. We should also not go out of our way to test the dask or cupy files since they will be unsupported soon. |
|
does #1984 need to be stacked underneath this for the test_util changes? |

Summary of Changes
self._fit_OLS_thru_orig()- OLS to lowercase_check_X(X)since capital X is taken from scikit-learn.PTF_formulasince this is public-facing.Related GitHub Issue(s)
#1216
Additional Context for Reviewers
Checklist
uv run pytest) and documentation changes (uv run --directory docs jb build . --builder=custom --custom-builder=doctest)Note
Low Risk
Mostly style and lint; the CuPy/Dask exception narrowing slightly broadens fallback behavior when optional runtimes fail at probe time, which is generally safer than swallowing all errors.
Overview
Applies Ruff cleanup across
chainladder/utils(formatting, quotes, spacing,isinstancechecks) and drops the per-file Ruff ignores for those modules inpyproject.tomlnow that they comply.Behavioral tweaks: CuPy and Dask backend probes now catch
ImportErrorandRuntimeErrorinstead of a bareexcept, so a broken GPU/CUDA or Dask runtime falls back to NumPy with the existing warning when that backend was requested.WeightedRegressionprivate fit helpers are renamed to_fit_ols/_fit_ols_thru_orig(call sites updated in the same file).PatsyFormula._check_Xis a@staticmethodwith an explicitnoqafor the sklearn-styleXname; publicPTF_formulakeeps anoqafor naming. Unusedsparse.spimports are removed fromcupy.pyandtriangle_weight.py; Daskexpand_dimsusesslicesinstead ofl.Reviewed by Cursor Bugbot for commit 2054a10. Bugbot is set up for automated code reviews on this repo. Configure here.