Repository navigation
Conversation
2d50b60 to
1b3e5f8
Compare
mhils
left a comment
There was a problem hiding this comment.
Thanks for the PR! This looks good already, some comments below.
| displayval = "true" if val else "false" | ||
| elif not val: | ||
| displayval = "" | ||
| if self.opt.typespec == float: |
There was a problem hiding this comment.
Could you explain this change? In particular, why do we need to treat floats and ints differently here?
There was a problem hiding this comment.
@mhils what I noticed was that int and float options with a default value of 0 or 0.0 displayed the empty string. I think that the actual 0 or 0.0 should be displayed but since I was working only on floats I'd decided to leave int as is and instead handle the case when its a float to display the string value of it.
If you're ok with it I can make it so that the 0 and 0.0 is displayed for both int and float respectively when their values are 0
There was a problem hiding this comment.
That makes sense, thanks. Let's change that condition in line 47 to elif val in (None, ""):, then we have proper treatment for everything else.
b3f82fe to
9646aa2
Compare
mhils
left a comment
There was a problem hiding this comment.
Thank for updating this and sorry for the slow turnaround! :)
| displayval = "true" if val else "false" | ||
| elif not val: | ||
| displayval = "" | ||
| if self.opt.typespec == float: |
There was a problem hiding this comment.
That makes sense, thanks. Let's change that condition in line 47 to elif val in (None, ""):, then we have proper treatment for everything else.
| return int(optstr) | ||
| elif typespec in (float, typing.Optional[float]): | ||
| return float(optstr) | ||
| else: |
There was a problem hiding this comment.
This condition cannot be hit, no?
| typename = str(typespec).split("'")[1] | ||
| raise exceptions.OptionsError(f"Not an {typename}: {optstr}") | ||
| else: | ||
| return None |
There was a problem hiding this comment.
Do we intentionally discard invalid values for optionals here? Just from the source it looks like they should raise an error as well?
f0383ea to
7352811
Compare
60396c7 to
5a135df
Compare
Description
Add support for option
floattypes.Checklist
tox -e pytox -e flake8Fixed functionality: