Skip to content

Move _check_mask into core/mask.py and drop dead numpy 1.21/1.22 guards - #607

Open
eriknw wants to merge 1 commit into
26-constructor-and-error-clarityfrom
27-check-mask-move
Open

Move _check_mask into core/mask.py and drop dead numpy 1.21/1.22 guards#607
eriknw wants to merge 1 commit into
26-constructor-and-error-clarityfrom
27-check-mask-move

Conversation

@eriknw

@eriknw eriknw commented Aug 4, 2026

Copy link
Copy Markdown
Member

Two cleanups that share matrix.py and vector.py in disjoint regions.

_check_mask lived in base.py, so mask.py had to defer-import it inside
three methods (Mask.new, Mask.and, Mask.or) to dodge the import
cycle. It is mask logic, so it now lives in mask.py and those three
calls are direct. base.py, matrix.py, and vector.py import it from
mask.py; no new cycle appears, because mask.py has no module-level
import of base. expr.py still needs a function-level import (the import
cycle closes through mask.py's own module-level import of graphblas.binary
names), now pointed at mask.py.

Matrix.from_dicts and Vector.from_dict each carried a np.version
fallback for subarray dtypes on numpy 1.21 and 1.22, where np.fromiter
could not build them. pyproject.toml requires numpy >=1.24, so neither
branch was reachable. The np.fromiter path stays.

What this does not change: same function, same signature, same error
messages. The wrong-kind-mask TypeError and its assignment carve-out
move across intact. The suite count under the pinned config (--backend
suitesparse --blocking --no-mapnumpy) is identical before and
after (1073 passed, 141 skipped).


Stack created with GitHub Stacks CLIGive Feedback 💬

@eriknw
eriknw marked this pull request as ready for review August 4, 2026 16:07
@eriknw
eriknw force-pushed the 27-check-mask-move branch from d0b3ed6 to 854f67a Compare August 4, 2026 16:12
@eriknw
eriknw force-pushed the 27-check-mask-move branch from 854f67a to 2cae853 Compare August 5, 2026 00:06
@eriknw
eriknw force-pushed the 27-check-mask-move branch 2 times, most recently from 22e899c to 533a9a8 Compare August 5, 2026 17:44
@eriknw
eriknw force-pushed the 27-check-mask-move branch from 533a9a8 to 0def607 Compare August 5, 2026 18:03
@eriknw
eriknw force-pushed the 27-check-mask-move branch 2 times, most recently from cac378d to b7fdc67 Compare August 6, 2026 07:59
@eriknw
eriknw force-pushed the 27-check-mask-move branch from b7fdc67 to 521602f Compare August 6, 2026 15:39
@eriknw
eriknw force-pushed the 27-check-mask-move branch 3 times, most recently from 3b188f3 to 47deb54 Compare August 6, 2026 20:41
@eriknw
eriknw force-pushed the 27-check-mask-move branch from 47deb54 to 3a71140 Compare August 7, 2026 02:48
Two cleanups that share matrix.py and vector.py in disjoint regions.

_check_mask lived in base.py, so mask.py had to defer-import it inside
three methods (Mask.new, Mask.__and__, Mask.__or__) to dodge the import
cycle. It is mask logic, so it now lives in mask.py and those three
calls are direct. base.py, matrix.py, and vector.py import it from
mask.py; no new cycle appears, because mask.py has no module-level
import of base. expr.py still needs a function-level import (the import
cycle closes through mask.py's own module-level import of graphblas.binary
names), now pointed at mask.py.

Matrix.from_dicts and Vector.from_dict each carried a np.__version__
fallback for subarray dtypes on numpy 1.21 and 1.22, where np.fromiter
could not build them. pyproject.toml requires numpy >=1.24, so neither
branch was reachable. The np.fromiter path stays.

What this does not change: same function, same signature, same error
messages. The wrong-kind-mask TypeError and its assignment carve-out
move across intact. The suite count under the pinned config (--backend
suitesparse --blocking --no-mapnumpy) is identical before and
after (1073 passed, 141 skipped).
@eriknw
eriknw force-pushed the 27-check-mask-move branch from 3a71140 to 9bbad15 Compare August 7, 2026 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant