What
Three style issues in xrspatial/focal.py, all flagged by the project's own setup.cfg config (flake8, isort) plus a grep for mutable default arguments. None of them change behaviour.
1. Unused import (flake8 F401)
Line 36 imports not_implemented_func from xrspatial.utils and never uses it. There's no __all__ and nothing imports it from xrspatial.focal, so it's not a re-export -- just a leftover from an earlier refactor.
2. Import ordering (isort)
The import block at the top of the file doesn't match the project's isort config (line_length=100). The stdlib imports are interleaved (import copy / from functools import partial / from math import isnan / import math), there's a stray blank line inside a grouped block, and the from-imports for xrspatial.convolution and xrspatial.utils aren't alphabetised or wrapped to the configured width. The xrspatial.dataset_support import is also out of order.
3. Mutable default argument
mean(agg, passes=1, excludes=[np.nan], ...) uses a list literal as a default. The list is never mutated here -- it's only iterated and passed through tuple() -- so behaviour is correct today. But a shared mutable default is a footgun, and the style sweep flags it. Fix is the usual sentinel: default to None, assign [np.nan] in the body. Same behaviour, plus a regression test that the default doesn't leak across calls.
Scope
xrspatial/focal.py and a test in xrspatial/tests/test_focal.py. No config widening, no autoformatter.
What
Three style issues in
xrspatial/focal.py, all flagged by the project's ownsetup.cfgconfig (flake8, isort) plus a grep for mutable default arguments. None of them change behaviour.1. Unused import (flake8 F401)
Line 36 imports
not_implemented_funcfromxrspatial.utilsand never uses it. There's no__all__and nothing imports it fromxrspatial.focal, so it's not a re-export -- just a leftover from an earlier refactor.2. Import ordering (isort)
The import block at the top of the file doesn't match the project's isort config (
line_length=100). The stdlib imports are interleaved (import copy/from functools import partial/from math import isnan/import math), there's a stray blank line inside a grouped block, and thefrom-imports forxrspatial.convolutionandxrspatial.utilsaren't alphabetised or wrapped to the configured width. Thexrspatial.dataset_supportimport is also out of order.3. Mutable default argument
mean(agg, passes=1, excludes=[np.nan], ...)uses a list literal as a default. The list is never mutated here -- it's only iterated and passed throughtuple()-- so behaviour is correct today. But a shared mutable default is a footgun, and the style sweep flags it. Fix is the usual sentinel: default toNone, assign[np.nan]in the body. Same behaviour, plus a regression test that the default doesn't leak across calls.Scope
xrspatial/focal.pyand a test inxrspatial/tests/test_focal.py. No config widening, no autoformatter.