-
Notifications
You must be signed in to change notification settings - Fork 24
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
Return result percentage as fraction #24
Return result percentage as fraction #24
Conversation
sio/executors/checker.py
Outdated
output_is_percent = re.match(r"^[0-9]+$", output_str) | ||
output_is_fraction = re.match(r"^[0-9]+ [0-9]+$", output_str) | ||
if output_is_float: | ||
return float_to_fraction(output_str) |
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.
it can be simplified with:
Decimal(output_str).as_integer_ratio()
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.
actually it can be simplified even more. python class Fraction supports formats:
- A/B Fraction("42/123").as_integer_ratio()
- A (like Fraction("42").as_integer_ratio()
- A.B (like Fraction("42.123").as_integer_ratio())
… result-percentage-fraction # Conflicts: # sio/executors/checker.py
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.
OK
* Result percentage changed to a fraction * Fix typos * Extend tests * More tests * More error checking * Simplified result percentage string parsing. * Added division by zero error handling. * Added and changed tests. * fix: added fraction package * fixed attribute error * fixed type error * fixed tests --------- Co-authored-by: Zonkil <[email protected]> (cherry picked from commit cd195e5)
Now sioworkers will return a tuple which represents a fraction of the points that the checker assigned. There are 3 formats:
[0-9]+
[0-9]+.[0-9]+
[0-9]+ [0-9]+
This will allow more precise point assignment. Related sio2project/oioioi#332