From a6f5712d4ac094a493a68fc44835016fa1c31e23 Mon Sep 17 00:00:00 2001 From: Brendan Collins Date: Thu, 18 Jun 2026 19:44:50 -0700 Subject: [PATCH] Fix isort import-ordering drift in xrspatial/proximity.py Re-wrap the `from xrspatial.utils import (...)` block to match the project's configured isort (line_length=100 in setup.cfg). The block wrapped one name too early; pull has_cuda_and_cupy onto the first continuation line so both lines stay under 100 columns. isort-only change, no behavioural effect. flake8 was already clean and stays clean. Also records the 2026-06-18 style re-audit result in .claude/sweep-style-state.csv. --- .claude/sweep-style-state.csv | 2 +- xrspatial/proximity.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.claude/sweep-style-state.csv b/.claude/sweep-style-state.csv index 02629c5a2..a3216ca97 100644 --- a/.claude/sweep-style-state.csv +++ b/.claude/sweep-style-state.csv @@ -10,7 +10,7 @@ interpolate-kriging,2026-06-04,2916,MEDIUM,1;4,"flake8 E128 x2: continuation-lin mcda,2026-06-10,3143,HIGH,3;4,F401 dead function-local warnings import in standardize.py; isort drift in weights.py combine.py __init__.py; flake8 otherwise clean; Cat 5 greps clean; fixed via PR for #3143 polygon_clip,2026-06-10,3184,HIGH,3;4,"Cat 3 F401: dropped unused typing imports Sequence/Tuple/Union (line 10, only Optional used) and the dead 'import cupy' inside the _apply_mask dask+cupy closure (line 245); the other 'import cupy' at line 261 is used (cupy.asarray) and kept. None re-exported (__init__ re-exports only clip_polygon). Cat 4 isort: reflowed the 5-name xrspatial.utils from-import block to line_length=100. Cat 1/2/5 grep clean (no E/W codes, no bare except, mutable defaults, ==None/True, or shadowed builtins). flake8+isort clean after fix; 23 test_polygon_clip tests pass. PR open." polygonize,2026-05-27,2534,HIGH,1;3;4,"F401 line 58 (is_cupy_array unused, not re-exported). E127 lines 83/88 (overload continuation indent in generated_jit). isort: 5-line .utils import block collapses to one line at 100-char limit. Cat 2 clean. Cat 5 grep clean." -proximity,2026-05-29,2725,HIGH,1;3;4;5,"F841 line 1274 original_chunks dead local in unbounded dask+cupy branch (refactor leftover). Cat 5 mutable default target_values: list = [] in proximity/allocation/direction -> None sentinel, normalized to [] in body (never mutated, behaviour preserved). E128 line 291 np.where continuation under-indent in _vectorized_calc_direction. isort: re-sorted xrspatial import block + blank line after inline import cupy as cp. flake8+isort clean after fix; 69 proximity tests pass + new parametrized regression test. Pre-existing E127 (test_proximity.py 726/752) + test-file isort drift left untouched (out of module scope)." +proximity,2026-06-18,,MEDIUM,4,"Re-audit 2026-06-18 (file last modified 2026-06-14). Cat 4 isort: from xrspatial.utils import (...) block wrapped one name early for line_length=100; pulled has_cuda_and_cupy onto first continuation line (both lines <=100, flake8 clean). isort+flake8 now clean. Fix applied + verified imports resolve. Cat 1/2/3 clean. Cat 5 grep: target_values: list = None on L1540/1700/1859 are type annotations not builtin-shadowing vars (false positive); mutable-default already None-sentinel from prior #2725. MEDIUM. /rockout issue+PR creation BLOCKED by auto-mode classifier (external publish denied); fix committed to deep-sweep branch only." rasterize,2026-05-27,2503,HIGH,1;3,F401 line 15 + F811 line 1193 (paired: local import warnings shadowed unused module-level import); E306 line 1775 (nested @cuda.jit). isort clean. Cat 5 grep clean. Fix in PR #2507. 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." 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. diff --git a/xrspatial/proximity.py b/xrspatial/proximity.py index bbcdf05f9..9fa665a8a 100644 --- a/xrspatial/proximity.py +++ b/xrspatial/proximity.py @@ -25,8 +25,8 @@ class cupy(object): from xrspatial.dataset_support import supports_dataset from xrspatial.pathfinding import _available_memory_bytes -from xrspatial.utils import (_dask_task_name_kwargs, _validate_raster, cuda_args, - has_cuda_and_cupy, is_cupy_array, is_dask_cupy, ngjit) +from xrspatial.utils import (_dask_task_name_kwargs, _validate_raster, cuda_args, has_cuda_and_cupy, + is_cupy_array, is_dask_cupy, ngjit) EUCLIDEAN = 0 GREAT_CIRCLE = 1