Skip to content

MAINT: Replace defusedxml with mffpy in _get_gains and remove _extract#14007

Merged
scott-huberty merged 6 commits into
mne-tools:mainfrom
PragnyaKhandelwal:egi-mff-gains-cleanup
Jun 30, 2026
Merged

MAINT: Replace defusedxml with mffpy in _get_gains and remove _extract#14007
scott-huberty merged 6 commits into
mne-tools:mainfrom
PragnyaKhandelwal:egi-mff-gains-cleanup

Conversation

@PragnyaKhandelwal

Copy link
Copy Markdown
Contributor

Reference issue (if any)

Part of #13926 (Phase 1 — legacy helper cleanup).
Follows #13991 (which migrated _get_ep_info and _get_signalfname).

What does this implement/fix?

Replaces the defusedxml-backed _get_gains with mffpy-backed parsing and removes the internal _extract helper that was only ever called by _get_gains.
_get_gains previously parsed info[N].xml calibration data by walking raw XML nodes via defusedxml.minidom. It now delegates to mffpy.xml_files.XML.from_file() and reads the structured calibrations dict from get_content(), which is the same mffpy API already used throughout the module after #13991.
With _extract gone and _get_gains migrated, defusedxml is now fully eliminated from mne/io/egi/general.py and _soft_import for it is removed as well.

Additional information

_get_blocks and _block_r remain — they handle binary .bin block parsing which has no mffpy equivalent yet (targeted for Phase 2 / PNS migration).

@PragnyaKhandelwal PragnyaKhandelwal changed the title Egi mff gains cleanup MAINT: Replace defusedxml with mffpy in _get_gains and remove _extract Jun 30, 2026
@PragnyaKhandelwal PragnyaKhandelwal marked this pull request as ready for review June 30, 2026 17:51

@scott-huberty scott-huberty left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀 !

Note that the code on main will only return 'GCAL' or 'ICAL' data, but our new PR could in theory return both. However I don't think this will be an issue, the code on main returns a dict, and so does the code in this PR.

@scott-huberty scott-huberty merged commit 46d1f6b into mne-tools:main Jun 30, 2026
32 checks passed
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.

2 participants