Skip to content

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

@brendancol

Description

@brendancol

The style sweep ran flake8 and isort against xrspatial/morphology.py. The findings are flake8 Cat 3 (F-codes), which the sweep treats as HIGH severity, plus isort ordering drift (Cat 4, MEDIUM). None change behavior.

flake8 (config: max-line-length=100 from setup.cfg):

xrspatial/morphology.py:19:1: F401 xarray as xr imported but unused
xrspatial/morphology.py:35:1: F401 xrspatial.utils.has_cuda_and_cupy imported but unused
xrspatial/morphology.py:35:1: F401 xrspatial.utils.not_implemented_func imported but unused
xrspatial/morphology.py:106:5: F841 local variable size is assigned to but never used
  • xr is imported but only DataArray is used. DataArray comes in on its own line and the xr. prefix appears nowhere in the file.
  • has_cuda_and_cupy and not_implemented_func are imported from xrspatial.utils and never referenced.
  • size in _circle_kernel is computed and never read.

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

isort (config: line_length=100) also reports import-ordering drift in the same block.

Fix: drop the three unused imports and the dead local, then run isort to normalize ordering. No runtime behavior change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions