Skip to content

Style: clean up flake8 and isort findings in hydro D8 modules#2727

Open
brendancol wants to merge 3 commits into
mainfrom
deep-sweep-style-hydro-d8-2026-05-29
Open

Style: clean up flake8 and isort findings in hydro D8 modules#2727
brendancol wants to merge 3 commits into
mainfrom
deep-sweep-style-hydro-d8-2026-05-29

Conversation

@brendancol
Copy link
Copy Markdown
Contributor

Closes #2705

Runs the project's own flake8 and isort (both at max-line-length = 100 / line_length = 100) over the 13 D8-variant hydrology source files and clears everything they report.

Categories addressed

  • F401 (HIGH): two unused imports removed. flow_length_d8._compute_seeds as _compute_accum_seeds was a function-local import that nothing called; snap_pour_point_d8.cuda_args was a module-level import that nothing used.
  • E127 / E128 (continuation-line indentation): aligned continuation lines to their opening delimiter, mostly multi-line def signatures.
  • E302 / E303 (blank-line spacing): fixed stray 4-blank-line gaps in watershed_d8.
  • E501 (line length): wrapped three lines in snap_pour_point_d8 and one in flow_path_d8.
  • isort: reordered import blocks to match the project config.

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

  • flake8 clean on all 13 files
  • isort --check-only clean on all 13 files
  • all 13 modules import
  • pytest D8 hydro suite: 385 passed

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.
@github-actions github-actions Bot added the performance PR touches performance-sensitive code label May 29, 2026
Copy link
Copy Markdown
Contributor Author

@brendancol brendancol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_seeds in flow_length_d8 was a function-local import that was never called; cuda_args in 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance PR touches performance-sensitive code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Style: clean up flake8 and isort findings in hydro D8 modules

1 participant