question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

get silently ignores unknown keyword arguments (in my case `ses`)

See original GitHub issue

I 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:closed
  • Created 3 years ago
  • Comments:10

github_iconTop GitHub Comments

2reactions
tyarkonicommented, May 17, 2020

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 to acquisition. :p

Will update the PR.

1reaction
tyarkonicommented, Apr 15, 2020

@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 in myfile.ses, and that will fail (and I definitely don’t want to allow aliases at file object level).

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found