-
Notifications
You must be signed in to change notification settings - Fork 826
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
Layout Resolver enhancement #295
Conversation
@@ -72,9 +76,8 @@ def layout_resolve(total: int, edges: Sequence[Edge]) -> List[int]: | |||
# to the following line | |||
remainder = _Fraction(0) | |||
for index, edge in flexible_edges: | |||
size, remainder = divmod(portion * edge.fraction + remainder, 1) | |||
sizes[index] = size | |||
sizes[index], remainder = divmod(portion * edge.fraction + remainder, 1) |
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 like how this loop turned out..
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.
Me too :)
Codecov Report
@@ Coverage Diff @@
## css #295 +/- ##
==========================================
+ Coverage 38.06% 40.15% +2.09%
==========================================
Files 85 88 +3
Lines 6526 6806 +280
==========================================
+ Hits 2484 2733 +249
- Misses 4042 4073 +31
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@@ -72,9 +76,8 @@ def layout_resolve(total: int, edges: Sequence[Edge]) -> List[int]: | |||
# to the following line | |||
remainder = _Fraction(0) | |||
for index, edge in flexible_edges: | |||
size, remainder = divmod(portion * edge.fraction + remainder, 1) | |||
sizes[index] = size | |||
sizes[index], remainder = divmod(portion * edge.fraction + remainder, 1) |
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.
Me too :)
Co-authored-by: Darren Burns <[email protected]>
I can see
layout_resolve
becoming fairly critical, since it solves a common class of problem we will no doubt see a lot. I've optimized it a little, and added tests.