-
Notifications
You must be signed in to change notification settings - Fork 80
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
[MRG] Adding bounds checking for --scaled
and --num
in sourmash sketch
#1711
Conversation
Codecov Report
@@ Coverage Diff @@
## latest #1711 +/- ##
==========================================
+ Coverage 82.70% 90.10% +7.39%
==========================================
Files 114 87 -27
Lines 12207 8398 -3809
Branches 1558 1555 -3
==========================================
- Hits 10096 7567 -2529
+ Misses 1852 573 -1279
+ Partials 259 258 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@ctb I'm not being able to figure out how and where to get started. Could you provide some hints? |
hi @keyabarve, have you found the param string parsing code? |
Yes, I found it in |
ok. So that's where current value checking is happening, and where any new value checking would need to happen. |
Oh okay. So should I call the functions that I wrote in |
In general, I don't think we should have multiple functions that do the same thing, but I would say to just get something working and tested, and then I can suggest refactorings in review. |
Alright, I'll do that. Thanks! |
@ctb I have commented out the existing check statements that were in the function and also the same statements that were in one of the tests: |
Also, this check: |
I have added the tests for both |
I have changed the error statements. Could you take a look at it and let me know if it looks good? |
On Fri, Aug 13, 2021 at 03:03:41PM -0700, Keya Barve wrote:
Also, this check: `Dev env instructions / nix (pull_request) Failing after 7m ??? nix` is failing in all of my PRs and I can't seem to figure out why.
right, it's not your fault. it's failing on latest too.
|
Two thoughts - it seems like you're just adding new code with new checks, and not centralizing the code so that there is one place for the value checking. In that case, why change the error messages at all? You can just add new ones without changing the old error messages. That having been said, we will now run into the problem where the code for doing the checking becomes potentially inconsistent. So I suggest refactoring things so there are two functions, one for each of num and scaled value checking, located in sourmash_args.py. Each function prints out errors or warnings, and may error exit. Then you rework the argparse stuff and the param_string stuff so that those functions are called. (I'm not quite sure how to get it all to work with argparse properly, though.) |
So then I'll keep the error checking statements for
Right, because all the other commands are using the functions from
So then would I have to completely remove the 2 functions from
Hmm, I'll take a look into it. |
Not necessarily - IIRC, the functions in utils.py are argparse-specific, and you could have them call a function in sourmash_args? I think my suggestion would be to get the value checking and error messages about values working in one function (one for num, one for scaled), and then use/display the error messages from that one function in argparse code and in the param_string code, and then we can revisit. |
I'm still a little confused, but I'll try something out, push it, and ask for a review. |
I'm still a little confused, but I'll try something out, push it, and ask for a review.
sounds good :)
|
@ctb I moved the 2 functions from |
@ctb Please review. |
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.
looks like it's heading in the right direction!
@ctb Please review. |
@ctb I accidentally wrote a function and pushed it on the current branch (KB_1708) instead of the branch it was actually supposed to be pushed on (KB_1707), but I immediately deleted the function and pushed again. Hence the 2 commits above. |
@bluegenes Could you please review this? |
Co-authored-by: Tessa Pierce Ward <bluegenes@users.noreply.github.com>
Co-authored-by: Tessa Pierce Ward <bluegenes@users.noreply.github.com>
This is looking good to me. Why don't you clean up the commented out bits of code and merge in |
Sure! I'll do that and ask for a review. Thanks! |
--scaled
and --num
in sourmash sketch
--scaled
and --num
in sourmash sketch
@ctb Should I merge this? |
Fixes #1708
scaled
andnum
insourmash sketch
.