Commit 5da4e89
committed
utils: update get_mapper call sites for maptype= rename (from PR 12 / 2a3c944c)
PR 6 renames get_mapper's `type` parameter to `maptype` (mypy Wave 3,
2a3c944c: `type` shadowed the builtin `type` used on the very next line).
cortex/utils.py has four call sites still using the old `type=` keyword;
since get_mapper has **kwargs, this wasn't a clean TypeError — the old
keyword silently landed in **kwargs, get_mapper defaulted `maptype` to
"nearest" regardless of what was requested, and the leftover kwarg then
propagated down to the sampler functions where PR 6 also added a "raise
ValueError on unexpected kwargs" check, surfacing as a confusing
ValueError several frames removed from the actual cause (or, worse, no
error at all and silently the wrong mapper class if a cache file for
"nearest" already happened to exist).
Reproduced before this commit:
get_mapper('S1', 'fullhead', type='trilinear', recache=True)
-> ValueError: nearest sampler does not take any kwargs
This isn't otherwise in PR 6 or PR 7's file list (cortex/utils.py belongs
to PR 12), but is picked from PR 12's 2a3c944c here — just the four
`type=` -> `maptype=` call-site renames in get_cortical_mask,
get_hemi_masks, get_roi_mask, and get_roi_masks — so that PR 6+7 doesn't
leave get_mapper's real callers broken. PR 12 will still add full typing
to cortex/utils.py; this commit only touches the four call sites that
would otherwise regress.
Verified: get_cortical_mask, get_hemi_masks, and get_roi_masks all run
correctly against the S1 test subject after this fix; all 4 previously
failed or behaved incorrectly before it (get_mapper('S1', 'fullhead',
type='trilinear', recache=True) reproduces the bug directly).1 parent 29137b9 commit 5da4e89
1 file changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
340 | | - | |
| 340 | + | |
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
| |||
395 | 395 | | |
396 | 396 | | |
397 | 397 | | |
398 | | - | |
| 398 | + | |
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
| |||
590 | 590 | | |
591 | 591 | | |
592 | 592 | | |
593 | | - | |
| 593 | + | |
594 | 594 | | |
595 | 595 | | |
596 | 596 | | |
| |||
790 | 790 | | |
791 | 791 | | |
792 | 792 | | |
793 | | - | |
| 793 | + | |
794 | 794 | | |
795 | 795 | | |
796 | 796 | | |
| |||
0 commit comments