Skip to content

MRG: delay set of gifti parser for circular import #406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 18, 2016

Conversation

matthew-brett
Copy link
Member

The GiftiImage class sets GiftiImageParser as a class attribute, but the GiftiImageParser needs to import and use the GiftiImage class. So, delay the setting of the parser class attribute until GiftiImage is fully defined, and therefore usable from parse_fast_gifti.py, which defines GiftiImageParser.

Test for issue nipy#392

It's a brittle test, because it depends on the order of file loading.
Suggested fix for nipygh-392 caused by circular import.  The image class
needs the parser class but the parser class needs the image class.
@matthew-brett
Copy link
Member Author

Closes #405 - if accepted ...

@effigies
Copy link
Member

Test fails before and succeeds after, so seems good as long as nose keeps doing things lexically.

LGTM.

@matthew-brett
Copy link
Member Author

Chris - OK to merge this one?

@effigies
Copy link
Member

👍

matthew-brett added a commit that referenced this pull request Feb 18, 2016
MRG: delay set of gifti parser for circular import

The GiftiImage class sets GiftiImageParser as a class attribute, but the GiftiImageParser needs to import and use the GiftiImage class.  So, delay the setting of the parser class attribute until GiftiImage is fully defined, and therefore usable from `parse_fast_gifti.py`, which defines GiftiImageParser.
@matthew-brett matthew-brett merged commit ff4198d into nipy:master Feb 18, 2016
@matthew-brett
Copy link
Member Author

Thanks Chris.

grlee77 pushed a commit to grlee77/nibabel that referenced this pull request Mar 15, 2016
MRG: delay set of gifti parser for circular import

The GiftiImage class sets GiftiImageParser as a class attribute, but the GiftiImageParser needs to import and use the GiftiImage class.  So, delay the setting of the parser class attribute until GiftiImage is fully defined, and therefore usable from `parse_fast_gifti.py`, which defines GiftiImageParser.
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