Skip to content

Commit c157c21

Browse files
authored
Sort surface_distance.py imports with isort (#3715)
* Sort surface_distance.py imports with isort (#3710) Alphabetize the cost_distance heap helpers, merge the two separate xrspatial.utils import statements into one, and drop the vertical-hanging-indent wrap in favour of the layout used by cost_distance, proximity, focal and zonal. Import order only; no runtime change. * Record the surface_distance style sweep in sweep-style-state.csv
1 parent 6b01431 commit c157c21

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

‎.claude/sweep-style-state.csv‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ rasterize,2026-05-27,2503,HIGH,1;3,F401 line 15 + F811 line 1193 (paired: local
2727
reproject,2026-06-09,3083,HIGH,3;4,"Re-sweep after 2026-06-08 cleanup (#3049): new findings confined to __init__.py. Cat 3 HIGH: F401 _merge_arrays_cupy imported from ._merge but never used (function kept in _merge.py, noted as dead code - no callers anywhere); F841 _use_native_cuda assigned L563/L602 never read (leftover from #2620 unconditional native-CUDA resampling). Cat 4: isort regrouped top-of-file import blocks + function-local _vertical import (~L1278). Cat 1/2 clean (flake8 reported only the two F-codes). Cat 5 grep clean (d: dict / entry: dict in _lite_crs.py are annotations, not shadows). flake8+isort clean after fix; 432 reproject tests pass incl. 43 GPU (CUDA available). PR open."
2828
resample,2026-05-27,2543,MEDIUM,4,isort drift only: 4 multi-line parenthesised imports collapsed to single/one-per-line under line_length=100 (top-of-file scipy.ndimage + xrspatial.utils; local cupyx imports in _nan_aware_interp_cupy and _interp_block_cupy); two blank-line nits after import math in _run_dask_numpy/_run_dask_cupy. flake8 clean. Cat 5 grep clean. 169 resample tests pass.
2929
slope,2026-05-29,2685,HIGH,1;3;4,"F401 line 26 (VALID_BOUNDARY_MODES unused, not re-exported). E402+E305 line 48 (geodesic import block sat after _geodesic_cuda_dims; moved up to top-of-file imports). E501 line 260 (cupy kernel launch, 108 chars) wrapped. isort: consolidated/regrouped xrspatial imports (dataset_support, geodesic, utils). Cat 2 clean. Cat 5 grep clean. 41 slope + 21 geodesic_slope tests pass."
30+
surface_distance,2026-08-16,3710,MEDIUM,4,"flake8 baseline 0 (clean, confirmed). Cat 4 isort only: _heap_push/_heap_pop out of alphabetical order, xrspatial.utils imported in two separate statements split by an unrelated import, and a vertical-hanging-indent wrap that cost_distance/proximity/focal/zonal do not use. Fixed by running isort; flake8+isort clean after; 37/37 test_surface_distance.py pass (CUDA available on host). Cat 1/2/3 none. Cat 5: no bare except (only a broad `except Exception` in _available_gpu_memory_bytes), no ==None/True, no shadowed builtins. Mutable default `target_values: list = []` on all 3 public funcs is real but never mutated (rebound via np.asarray) and matches cost_distance/proximity house signature -- left to the api-consistency sweep rather than raced into a duplicate PR. LOW, documented not fixed: dead `height, width = source_da.shape` unpack in _surface_distance_dask (pyflakes skips F841 for tuple unpacking so flake8 misses it); _precompute_dd_grid imports _available_memory_bytes from xrspatial.zonal though this module defines its own identical helper at line 100."
3031
viewshed,2026-05-29,2690,HIGH,1;4;5,"flake8 E127 x2 (L2013-2014 _viewshed_distance_sweep sig); isort .utils import reflow; shadowed builtin id->node_id (L1409,1474). Fixed via /rockout PR. No behavioural change."
3132
visibility,2026-06-10,3182,MEDIUM,4,"flake8 baseline 0. Cat 4 isort only: from .utils import (...) 3-line block collapses to one 92-char line under line_length=100; deferred from .viewshed import alphabetised to INVISIBLE, viewshed. Cat 1/2/3/5 clean (grep: no bare except, mutable defaults, ==None/True, or shadowed builtins). Fixed by running isort; flake8+isort clean after fix; 25 visibility tests pass. PR via #3182."
3233
zonal,2026-05-27,2522,HIGH,1;3;4,"F401 not_implemented_func (line 42, only present on import line). E501 line 455 (dd.concat one-liner, 117 chars) wrapped across 3 lines. isort: consolidated xrspatial.utils block (merged has_dask_array, dropped not_implemented_func, alphabetised, trimmed extra blank line). Cat 5 grep clean. 125 zonal tests pass."

‎xrspatial/surface_distance.py‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,12 @@
4747
class cupy: # type: ignore[no-redef]
4848
ndarray = False
4949

50-
from xrspatial.cost_distance import _heap_push, _heap_pop
51-
from xrspatial.proximity import _vectorized_calc_direction
52-
from xrspatial.utils import (
53-
_validate_raster,
54-
cuda_args, get_dataarray_resolution, ngjit,
55-
has_cuda_and_cupy, is_cupy_array, is_dask_cupy,
56-
)
50+
from xrspatial.cost_distance import _heap_pop, _heap_push
5751
from xrspatial.dataset_support import supports_dataset
58-
from xrspatial.utils import _dask_task_name_kwargs
52+
from xrspatial.proximity import _vectorized_calc_direction
53+
from xrspatial.utils import (_dask_task_name_kwargs, _validate_raster, cuda_args,
54+
get_dataarray_resolution, has_cuda_and_cupy, is_cupy_array,
55+
is_dask_cupy, ngjit)
5956

6057
# ---------------------------------------------------------------------------
6158
# Constants

0 commit comments

Comments
 (0)