-
Notifications
You must be signed in to change notification settings - Fork 533
REF: define related filetypes once. #1617
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
Conversation
Current coverage is 70.29% (diff: 100%)@@ master #1617 diff @@
==========================================
Files 1016 993 -23
Lines 50928 49929 -999
Methods 0 0
Messages 0 0
Branches 7238 7777 +539
==========================================
- Hits 35971 35100 -871
+ Misses 13894 13390 -504
- Partials 1063 1439 +376
|
@@ -29,6 +29,12 @@ | |||
fmlogger = logging.getLogger("filemanip") | |||
|
|||
|
|||
related_filetype_sets = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even DRYer--assuming all extensions start with a period, no need to specify the period here!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I take your point, but I think that leaving the periods makes the intent more obvious.
Would you suggest something like:
related_filetype_sets = [tuple('.' + type_ext)
for type_ext in (
('hdr', 'img', 'mat'),
('BRIK', 'HEAD'),
)]
Or just handling it later (i.e., in a function get_related_filetypes
that does what you suggest below)
I am still personally opting for leaving the dots in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was imagining handling it later--but I'm also not so much of a stickler as to insist on changing this
I would love to see some tests! |
Good suggestion on using
|
Good point on the infinite recursion--of your suggestions above, I think I prefer the add-extra-parameters option. |
Argh, tiny phone big fingers! |
@shoshber Happens to the best of us. 4ab5554 includes the extra parameter option. |
I see that! Looks good to me! |
@effigies It looks like we have a comeback of the copy tests failure here (https://s3.amazonaws.com/archive.travis-ci.org/jobs/159763024/log.txt)
|
Oh, I see the problem, now. The That said, it increases the runtime of the test from <1s to ~13s, so you may want to satisfy yourselves that the logic works and then remove the Edit: Incidentally, it's a different failure from before, but with the same cause. |
Instead of increasing test time by 13sec, can we just relax the equality requirement? Perhaps with |
I wouldn't want to do The clock-tick waits are basically the proof that the problem is solved, and the debugging technique I used to figure out the problem. The only advantage to leaving them in is that they will alert you if this problem crops up again. I'm perfectly comfortable removing them, if that's an unacceptable price. |
Ah, I see. I vote to remove |
I guess a separate PR? Whatever you like best. I tried making it myself and cherrypicking but couldn't figure it out. I may not have the right permissions. |
In response to #1612
Refactors using DRY principal, define related files once.
Additionally, can be patched to extend the related filtypes with:
Local tests run, and I have checked the above patching with some of my code using Interfiles.
Potential caveats:
copyfile
on checked for related files for.img
or.BRIK
, and not if the other file part was used. I think this way is better, but some issues may come from using.mat
files?