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

BF (TST): make anonymize_script actually output anything and map determinstically #511

Merged
merged 3 commits into from
Oct 14, 2021

Conversation

yarikoptic
Copy link
Member

@yarikoptic yarikoptic commented May 6, 2021

hash() would get a new value for every run for the same sid, so not a good
choice. Without print script produced no output so code just saw empty
string and assumed that no annonymization was needed etc

was looking into the anonymization logic for #509 to realize that this script does nothing... fixed it but it seems that test is still working as expected which imho it shouldn't

TODOs

  • figure out what is up with the test or my assumptions on how it should all work

…ically

hash() would get a new value for every run for the same sid, so not a good
choice.  Without print script produced no output so code just saw empty
string and assumed that no annonymization was needed etc
@codecov
Copy link

codecov bot commented May 6, 2021

Codecov Report

Merging #511 (1d6b41b) into master (8866cc5) will increase coverage by 0.51%.
The diff coverage is 84.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #511      +/-   ##
==========================================
+ Coverage   77.04%   77.55%   +0.51%     
==========================================
  Files          41       41              
  Lines        3123     3154      +31     
==========================================
+ Hits         2406     2446      +40     
+ Misses        717      708       -9     
Impacted Files Coverage Δ
heudiconv/tests/anonymize_script.py 54.54% <33.33%> (ø)
heudiconv/utils.py 90.03% <66.66%> (-0.17%) ⬇️
heudiconv/tests/test_regression.py 93.25% <100.00%> (+1.25%) ⬆️
heudiconv/info.py 100.00% <0.00%> (ø)
heudiconv/tests/test_main.py 100.00% <0.00%> (ø)
heudiconv/tests/test_utils.py 100.00% <0.00%> (ø)
heudiconv/heuristics/reproin.py 83.87% <0.00%> (+2.64%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8866cc5...1d6b41b. Read the comment docs.

…ed output

So it will be for the script to just return original sid if it decides to
not anonymize it, which is to some degree change in behavior.  But I think
it would be beneficial in the long run due to more straight-forward and robust
operation.  Docstring for anon_cmd does not mention that empty output implies
no change in subject id
The problem was that the glob expressions were off and no files matched
in either case and then empty lists matched just fine.

I have fixed up the test so it

- does verify that anonimization changed the subject id
  if anonimization script was provided, and does not if it was not
- also converted to use f""strings instead of .format
@yarikoptic
Copy link
Member Author

figure out what is up with the test or my assumptions on how it should all work

anonymization script printed nothing, which then taken as empty sid, and thus main code just proceeded without any anonymization. In 74550b8 have made the anonymize_sid more robust and fail if anon script returned nothing or multiple words. This would be a change in behavior but IMHO for good.

In subsequent commit 1d6b41b I have fixed the test -- it was just comparing "nothing" to be equal "nothing", and thus not useful and passing.

@yarikoptic yarikoptic changed the title BF: make anonymize_script actually output anything and map determinstically BF (TST): make anonymize_script actually output anything and map determinstically Oct 13, 2021
@yarikoptic yarikoptic added the tests Add or improve existing tests label Oct 13, 2021
@yarikoptic
Copy link
Member Author

since it is relating only to the tests, I think it is not worth holding on merging. I will attend to comments if made after

@yarikoptic yarikoptic merged commit c4956b3 into nipy:master Oct 14, 2021
@yarikoptic yarikoptic deleted the bf-anon-cmd branch October 15, 2021 01:10
@yarikoptic yarikoptic added the patch Increment the patch version when merged label Apr 20, 2022
@github-actions
Copy link

🚀 PR was released in v0.11.0 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Increment the patch version when merged released tests Add or improve existing tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant