Skip to content
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

RF File's namedtuple to reflect 1-to-1 File's attributes (path, filename, dirname) #84

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yarikoptic
Copy link
Collaborator

Initially ran into the problem while trying to go through pybids's tutorial which would fail now since there is no .path in the "File" (tuple) provided to get call

  • Made File.path stored as .path of namedtuple, and then filename and dirname in corresponding fields as well
  • renamed named tuple from "File" to "FileTuple" to make it explicit

Both changes are questionable (feel welcome to fix some other way) since I am not exactly sure on the "life span" of the namedtuple here and either other ways (make File hashable) for intended use (using as dict keys?) were considered... if it was intended to be used later to "reinstantiate" File object, then it would fail since that one needs only "filename" which gets assigned to "path" (khe khe) and the other two are recomputed. Probably if that was intended, namedtuple would need to store also initial class.

Obviously that this change does brake pybids, but the point is that there seems to be this inconsistency and pybids seems to be broken anyways already according to that example failures. With this change and master of grabbit I am getting "9 failed, 101 passed, 10 warnings, 1 error" in pybids (with 111 passed without).

@tyarkoni
Copy link
Member

The tutorial hasn't been updated yet to reflect the changes in master (and that will be released in 0.7). There's an issue for this: bids-standard/pybids#259.

With respect to this particular issue, there's never been a .path in the tuple... note that the call above that in the tutorial is using return_type='obj', which returns a BIDSFile object, which does have a .path. While I agree with you that the tuple is probably unnecessary, it's the current default return type, so I'm wary of removing it--that will break a huge proportion of codebases currently using pybids, whereas even the breaking changes currently in master are only a problem for a minority of uses. So I guess I incline to leave it as is for the time being, but I could be convinced...

@tyarkoni
Copy link
Member

In 0.7.0, the default return type is object, and tuple is deprecated. So I think we no longer need this, as people shouldn't be using the tuple at all (though typing this is making me realize that I forgot to include a deprecation warning in 0.7.0—will do that). Safe to close?

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