Skip to content

morphology: remove unused imports and dead local, fix import order#3413

Open
brendancol wants to merge 1 commit into
mainfrom
deep-sweep-style-morphology-2026-06-20
Open

morphology: remove unused imports and dead local, fix import order#3413
brendancol wants to merge 1 commit into
mainfrom
deep-sweep-style-morphology-2026-06-20

Conversation

@brendancol

Copy link
Copy Markdown
Contributor

Closes #3400.

Style sweep cleanup for xrspatial/morphology.py. Findings came from the project tooling (flake8, isort) under the setup.cfg config (max-line-length=100, line_length=100).

Categories addressed:

  • Cat 3 (F401, F841): removed three unused imports and one dead local.
    • F401: xarray as xr (only DataArray is used and it is imported on its own line), has_cuda_and_cupy, not_implemented_func.
    • F841: size in _circle_kernel (computed, never read).
  • Cat 4 (isort): normalized import ordering.

No behavior change. None of the removed names are re-exported. xrspatial/__init__.py re-exports only the public morph_* functions, and the module is not star-imported anywhere, so dropping these names is safe.

Verification:

  • flake8 xrspatial/morphology.py clean
  • isort --check-only xrspatial/morphology.py clean
  • 74 morphology tests pass (test_morphology.py, test_morphology_derived.py)

Cat 1, Cat 2, and Cat 5 were clean: no E/W codes after the fix, and grep found no bare except, mutable default args, == None/True/False, or shadowed builtins.

Resolves the style-sweep findings for xrspatial/morphology.py (#3400).

Cat 3 (F-codes):
- F401: drop unused imports xarray as xr (only DataArray is used),
  has_cuda_and_cupy, and not_implemented_func.
- F841: drop the unused local size in _circle_kernel.

Cat 4 (isort): normalize import ordering with isort under line_length=100.

None of the removed names are re-exported (__init__ exports only the public
morph_* functions), so there is no behavior change. flake8 and isort are
clean and the 74 morphology tests pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

morphology: remove unused imports and dead local, fix import ordering

1 participant