Repository navigation
Extract the FormatDispatcher mixin; accept non-tuple image indices - #309
Merged
Merged
Conversation
…#233) The dispatching behaviour of a class that owns a registry of formats (the sniff*, load and from_* overrides) moves to FormatDispatcher, a mixin that owns no registry itself. FileBasedObject is now the registry-owning FormatDispatcher. A kind of object that the generic load must not return, such as the metadata of a file, can then dispatch among its own formats without being registered into the registry of FileBasedObject. No behaviour changes; the MRO test checks the overrides on FormatDispatcher. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VmK1jLTwd2hMkvYnMWEyYw
SingleScaleImage.__getitem__ handed a non-tuple index (img[::-1], img[1], img[...]) to Geometry.__getitem__, which iterates over it and raised TypeError. A single component is now wrapped in a tuple first, as an index of the first axis. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VmK1jLTwd2hMkvYnMWEyYw
The Unit constructors (__new__, _lookup, from_pint and the interning lookup) and copies return an instance of the class they are called on. Annotation only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VmK1jLTwd2hMkvYnMWEyYw
This was referenced Oct 6, 2026
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.
Part of #233, split out of #287. Three small, independent commits:
FormatDispatchermixin. The dispatchingsniff*/load/from_*methods move fromFileBasedObjectinto a mixin that owns no registry. A kind of object thatio.loadmust not return, such as file metadata further up the stack, can then dispatch among its own formats without landing inFileBasedObject's registry. Behaviour is unchanged, andtest_io_mro.pyis updated. The broader cleanup of dispatchers vs formats is Separate format dispatchers from concrete formats #297.SingleScaleImage.__getitem__now accepts an index that isn't a tuple:img[::-1],img[1]andimg[...]used to raiseTypeErrorinGeometry.__getitem__. Its test uses metadata, so it lives in Wire format metadata into images and transformations (#233) #287.tx.Selfannotations indatamodel/units.py.Stack
FormatDispatchermixin and small fixes, based onmain🤖 Generated with Claude Code
https://claude.ai/code/session_01VmK1jLTwd2hMkvYnMWEyYw
Generated by Claude Code