Skip to content

Conversation

@JBWilkie
Copy link
Contributor

Problem

Work introduced in darwin-py 1.0.4 introduced a bug when importing NifTI annotations in the using the legacy method. When doing this, we turn the importer into a partial function. In 1.0.4 we introduced a function that checks the format of the importer. However, it does not work with partial functions, resulting in:

Traceback (most recent call last):   File "test.py", line 12, in <module>     importer.import_annotations(dataset, parser, ANNOTATION_PATHS, append=True)   File "/Users/john/Documents/code/development/darwin-py/darwin/importer/importer.py", line 851, in import_annotations     annotation_format = _get_annotation_format(importer)   File "/Users/john/Documents/code/development/darwin-py/darwin/importer/importer.py", line 1521, in _get_annotation_format     return importer.__module__.split(".")[3] AttributeError: 'functools.partial' object has no attribute '__module__'

Solution

Allow _get_annotation_format() to work with partial functions. This is temporary, and we can remove it in a future version when we have finished migrating NifTI annotation imports from the legacy method to the new method

Changelog

Resolved bug with legacy NifTI annotation imports

@linear
Copy link

linear bot commented Aug 27, 2024

@JBWilkie JBWilkie merged commit 00fd6a9 into master Aug 27, 2024
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.

3 participants