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

FIX: Exclude non-Hashables from set in .get(return_type='id') #948

Merged
merged 3 commits into from
Feb 28, 2023

Conversation

adelavega
Copy link
Collaborator

Fixing a bug I introduced in #942

The problem is that just getting the raw .entities variable from a BIDSFile will return everything, including meta-data (which is arguably a design flaw).

The problem if anywhere in the meta-data you use the same name as a BIDS entity (in my case it was task), its returns will also be returned.

This simple fix check if at least the input to set is not Hashable, to prevent an error (although it will still return something funky if a non-hashable result from meta-data sneaks in).

@adelavega adelavega changed the title Exclude non-Hashables from set Exclude non-Hashables from set in .get(return_type='id') Feb 16, 2023
@codecov
Copy link

codecov bot commented Feb 16, 2023

Codecov Report

Base: 86.35% // Head: 86.35% // No change to project coverage 👍

Coverage data is based on head (d233e3e) compared to base (18778c1).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #948   +/-   ##
=======================================
  Coverage   86.35%   86.35%           
=======================================
  Files          35       35           
  Lines        4023     4023           
  Branches      974      973    -1     
=======================================
  Hits         3474     3474           
  Misses        355      355           
  Partials      194      194           
Impacted Files Coverage Δ
bids/layout/layout.py 88.10% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@adelavega
Copy link
Collaborator Author

Oh-- ideally this should be added to the tests (by adding a hashable key that looks like an entity to a dataset). it's possible this breaks other tests as well.

This also related to Oscar's #684

bids/layout/layout.py Outdated Show resolved Hide resolved
Co-authored-by: Chris Markiewicz <[email protected]>
bids/layout/layout.py Outdated Show resolved Hide resolved
@effigies effigies changed the title Exclude non-Hashables from set in .get(return_type='id') FIX: Exclude non-Hashables from set in .get(return_type='id') Feb 28, 2023
@effigies effigies merged commit 1e086a8 into master Feb 28, 2023
@effigies effigies deleted the fix/return_type_id branch February 28, 2023 15:17
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