xrspatial/surface_distance.py fails the project's isort check. setup.cfg configures isort with line_length = 100, but no CI job runs it, so the drift went unnoticed.
Reproduction
$ python -m isort --check-only --diff xrspatial/surface_distance.py
ERROR: xrspatial/surface_distance.py Imports are incorrectly sorted and/or formatted.
--- xrspatial/surface_distance.py:before
+++ xrspatial/surface_distance.py:after
@@ -47,15 +47,12 @@
-from xrspatial.cost_distance import _heap_push, _heap_pop
+from xrspatial.cost_distance import _heap_pop, _heap_push
+from xrspatial.dataset_support import supports_dataset
from xrspatial.proximity import _vectorized_calc_direction
-from xrspatial.utils import (
- _validate_raster,
- cuda_args, get_dataarray_resolution, ngjit,
- has_cuda_and_cupy, is_cupy_array, is_dask_cupy,
-)
-from xrspatial.dataset_support import supports_dataset
-from xrspatial.utils import _dask_task_name_kwargs
+from xrspatial.utils import (_dask_task_name_kwargs, _validate_raster, cuda_args,
+ get_dataarray_resolution, has_cuda_and_cupy, is_cupy_array,
+ is_dask_cupy, ngjit)
Three things are off:
_heap_push, _heap_pop are out of alphabetical order.
xrspatial.utils is imported twice, in two statements separated by an unrelated import.
- The wrapped
xrspatial.utils block uses a hanging-indent style that its nearest neighbours do not. cost_distance.py, proximity.py, focal.py and zonal.py all already carry the exact layout isort wants here, so this file is the outlier among the modules it borrows from.
flake8 is clean on this file (0 violations), so this is purely the isort side.
Scope
Import reordering only. No runtime behaviour change, no names added or removed.
Found by a style sweep of surface_distance. Two smaller things turned up that are not worth a code change on their own, noted here so nobody has to rediscover them:
_surface_distance_dask unpacks height, width = source_da.shape and never uses either name. pyflakes skips F841 for tuple unpacking, so flake8 misses it.
_precompute_dd_grid imports _available_memory_bytes from xrspatial.zonal even though this module defines its own copy of that helper at the top. Both work; the local one is right there.
xrspatial/surface_distance.pyfails the project's isort check.setup.cfgconfigures isort withline_length = 100, but no CI job runs it, so the drift went unnoticed.Reproduction
Three things are off:
_heap_push, _heap_popare out of alphabetical order.xrspatial.utilsis imported twice, in two statements separated by an unrelated import.xrspatial.utilsblock uses a hanging-indent style that its nearest neighbours do not.cost_distance.py,proximity.py,focal.pyandzonal.pyall already carry the exact layout isort wants here, so this file is the outlier among the modules it borrows from.flake8 is clean on this file (0 violations), so this is purely the isort side.
Scope
Import reordering only. No runtime behaviour change, no names added or removed.
Found by a style sweep of
surface_distance. Two smaller things turned up that are not worth a code change on their own, noted here so nobody has to rediscover them:_surface_distance_daskunpacksheight, width = source_da.shapeand never uses either name. pyflakes skips F841 for tuple unpacking, so flake8 misses it._precompute_dd_gridimports_available_memory_bytesfromxrspatial.zonaleven though this module defines its own copy of that helper at the top. Both work; the local one is right there.