MAINT: Replace defusedxml with mffpy in _get_gains and remove _extract#14007
Merged
scott-huberty merged 6 commits intoJun 30, 2026
Merged
Conversation
for more information, see https://pre-commit.ci
defusedxml with mffpy in _get_gains and remove _extract
…ndelwal/mne-python into egi-mff-gains-cleanup
17 tasks
scott-huberty
approved these changes
Jun 30, 2026
scott-huberty
left a comment
Contributor
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference issue (if any)
Part of #13926 (Phase 1 — legacy helper cleanup).
Follows #13991 (which migrated
_get_ep_infoand_get_signalfname).What does this implement/fix?
Replaces the
defusedxml-backed_get_gainswithmffpy-backed parsing and removes the internal_extracthelper that was only ever called by_get_gains._get_gainspreviously parsedinfo[N].xmlcalibration data by walking raw XML nodes viadefusedxml.minidom. It now delegates tomffpy.xml_files.XML.from_file()and reads the structuredcalibrationsdict fromget_content(), which is the same mffpy API already used throughout the module after #13991.With
_extractgone and_get_gainsmigrated,defusedxmlis now fully eliminated frommne/io/egi/general.pyand_soft_importfor it is removed as well.Additional information
_get_blocksand_block_rremain — they handle binary.binblock parsing which has nomffpyequivalent yet (targeted for Phase 2 / PNS migration).