get silently ignores unknown keyword arguments (in my case `ses`)
See original GitHub issueI am “inside” one of the tests, and decided to get a sample file. To my surprise - I got multiple:
431 def test_derivative_getters():
432 synth_path = join(get_test_data_path(), 'synthetic')
433 bare_layout = BIDSLayout(synth_path, derivatives=False)
434 full_layout = BIDSLayout(synth_path, derivatives=True)
435 import pdb; pdb.set_trace()
436 -> assert bare_layout.get_spaces() == []
*(Pdb) from pprint import pprint
(Pdb) pprint(bare_layout.get(subject='05', ses='02', suffix='T1w'))
[<BIDSImageFile filename='/home/yoh/proj/bids/pybids/bids/tests/data/synthetic/sub-05/ses-01/anat/sub-05_ses-01_T1w.nii'>,
<BIDSImageFile filename='/home/yoh/proj/bids/pybids/bids/tests/data/synthetic/sub-05/ses-01/anat/sub-05_ses-01_T1w.nii.gz'>,
<BIDSImageFile filename='/home/yoh/proj/bids/pybids/bids/tests/data/synthetic/sub-05/ses-02/anat/sub-05_ses-02_T1w.nii'>,
<BIDSImageFile filename='/home/yoh/proj/bids/pybids/bids/tests/data/synthetic/sub-05/ses-02/anat/sub-05_ses-02_T1w.nii.gz'>]
(Pdb) bids.__version__
'0.10.2+12.g8b5ca0e.dirty'
it does select correctly when I correctly specify session
instead of ses
. I would expect pybids to at least complain that whatever I have specified ses
was not understood. Typos, API changes, etc could silently lead to incorrect results, thus imho it warrants AT LEAST a warning (I feel now that we had some discussion like that before, sorry if I am repeating myself 😉)
Issue Analytics
- State:
- Created 3 years ago
- Comments:10
Top Results From Across the Web
How does one ignore unexpected keyword arguments passed ...
Now, if I have a dictionary such as dct = {"a":"Foo"} , I may call f(**dct) and get the result Foo printed. However,...
Read more >Unexpected kwargs error · Issue #3151 · dask/distributed
It appears that #3117 introduced a check for whether certain kwargs were used when initializing a Client. Previously, this sort of pattern ...
Read more >Accepting arbitrary keyword arguments in Python
Let's make a function that accepts arbitrary keyword arguments. Calling with arbitrary keyword arguments. We're going to make a function ...
Read more >Sending email | Django documentation
In most cases, you can send email using django.core.mail.send_mail() . ... If the keyword argument fail_silently is True , exceptions raised while sending ......
Read more >An Introduction to R - The Comprehensive R Archive Network
To get more information on any specific named function, for example solve ... the data vector only are used; in this case the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Okay, so what convinced me you’re right is that I tried it your way and immediately broke a bunch of tests that were looking for an
acq
entity, which hasn’t existed since we changed it toacquisition
. :pWill update the PR.
@effigies I still don’t like the idea of aliases, because it would require us to add an extra layer internally in a bunch of places (basically, anywhere there’s a DB query, we’d need to first check against an alias table). I also think it would encourage confusion, because currently the query names are exactly what they are in the file objects. If we allow searching for
ses
, people will probably start looking inmyfile.ses
, and that will fail (and I definitely don’t want to allow aliases at file object level).