Repository navigation
feat(io): unregister and register file formats - #109
Merged
Merged
Conversation
Plugins defining file formats can remove them from the I/O registries when they are unloaded, and register them again, without accessing the registry internals. Assisted-by: Claude Opus 5.5
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.
Adds
unregister_formatandregister_formatto the I/O registries (SignalIORegistry,ImageIORegistry).Format classes are registered when they are defined. A plugin defining file formats (e.g. SPEC and XDI in datalab-synchrotron) had to edit the private
_io_format_instanceslist to remove them when it is unloaded. These methods let it remove its formats and register them again through a public API.unregister_format(format_class)removes the handler of this exact class (handlers of subclasses are formats of their own) and returns whether it was registered.register_format(format_class)registers the class again if it is not registered, and refuses classes of another registry.Tests:
sigima/tests/io/addnewformat_unit_test.py. Release note: 1.4.0.No computation function changes, so no contract version change.
Used by DataLab-Platform/datalab-synchrotron#3 to remove and register again its SPEC and XDI formats.