added ruff code reivew

This commit is contained in:
ykcheungab
2026-09-27 19:21:55 +08:00
parent 07da372204
commit e2ac36269c
110 changed files with 890 additions and 426 deletions
+13 -11
View File
@@ -56,7 +56,9 @@ def build_masked_factor(lap):
options=dict(SymmetricMode=True),
)
return lu.solve, numpy.float32
except Exception:
except Exception: # noqa: S112 - try the next pivoting strategy
# Probe: try the next pivoting strategy; the float64 fallback below is
# returned if every candidate fails, so this failure is not lost.
continue
# Last resort: the original pivoting LU on the float64 matrix.
return sparse_linalg.factorized(lap_csc), numpy.float64
@@ -82,20 +84,20 @@ class MaskedDomain:
"""Reduced Laplacian system on active mask pixels (2D only)."""
__slots__ = (
"shape",
"mask",
"index_map",
"factor",
"factor_dtype",
"lap",
"num_active",
"pinned",
"active_coords",
"active_linear_indices",
"_rhs_buffer",
"_rhs_pair_buffer",
"_scatter_buffer",
"_scatter_pair_buffer",
"active_coords",
"active_linear_indices",
"factor",
"factor_dtype",
"index_map",
"lap",
"mask",
"num_active",
"pinned",
"shape",
)
def __init__(