Style: clean up flake8 and isort findings in hydro D8 modules#2727
Open
brendancol wants to merge 3 commits into
Open
Style: clean up flake8 and isort findings in hydro D8 modules#2727brendancol wants to merge 3 commits into
brendancol wants to merge 3 commits into
Conversation
Fixes reported by the project's own style tooling across the 13 D8-variant hydrology source files: - F401: drop two unused imports (flow_length_d8 function-local _compute_accum_seeds, snap_pour_point_d8 cuda_args) - E127/E128: align continuation lines to their opening delimiter - E302/E303: fix blank-line spacing in watershed_d8 - E501: wrap three over-length lines in snap_pour_point_d8 and one in flow_path_d8 - isort: reorder import blocks to match line_length=100 Style only. The two F401 removals drop dead names nothing references; no behavioural change.
brendancol
commented
May 29, 2026
Contributor
Author
brendancol
left a comment
There was a problem hiding this comment.
PR Review: Style cleanup of flake8 and isort findings in hydro D8 modules
Blockers (must fix before merge)
None.
Suggestions (should fix, not blocking)
None.
Nits (optional improvements)
flow_direction_d8.py:25-31: isort wants one blank line after the import block, while flake8 E302 wants two before the decorated function. The PR keeps one blank after imports and puts two blanks between the comment header and@ngjit, matching the spacing the other 12 files already use. Worth a glance, but it reads correctly as written.
What looks good
- Both F401 removals are genuinely dead.
_compute_accum_seedsin flow_length_d8 was a function-local import that was never called;cuda_argsin snap_pour_point_d8 was a module-level import with no use. Confirmed by grep that neither name appears anywhere else in its file. - The four E501 fixes only wrap existing ternary expressions in parentheses. The logic is untouched.
- The E127/E128 changes are all continuation-line re-indentation, mostly in multi-line def signatures. Nothing changed beyond whitespace.
- flake8 and isort both pass clean on all 13 files. The D8 hydro test suite passes (385 tests).
Checklist
- No algorithm change (style-only PR)
- No backend behaviour change; formatting applies uniformly across numpy / cupy / dask paths
- NaN handling untouched
- Existing edge-case tests still pass (385)
- Dask chunk handling untouched
- No premature materialization introduced
- Benchmark not needed
- README feature matrix not affected (no API change)
- Docstrings unchanged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2705
Runs the project's own
flake8andisort(both atmax-line-length = 100/line_length = 100) over the 13 D8-variant hydrology source files and clears everything they report.Categories addressed
flow_length_d8._compute_seeds as _compute_accum_seedswas a function-local import that nothing called;snap_pour_point_d8.cuda_argswas a module-level import that nothing used.defsignatures.watershed_d8.snap_pour_point_d8and one inflow_path_d8.Behaviour
Style only, no behavioural change intended. The E1xx / E3xx / E5xx and isort fixes are pure formatting. The two F401 removals drop dead names that nothing references. Confined to the 13 D8 files; the dinf and mfd variants are untouched.
Backend coverage
Formatting changes apply uniformly across the numpy / cupy / dask+numpy / dask+cupy paths.
Test plan
flake8clean on all 13 filesisort --check-onlyclean on all 13 filespytestD8 hydro suite: 385 passed