mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
list expressions are faster
This commit is contained in:
@@ -51,7 +51,7 @@ def layout_resolve(total: int, edges: Sequence[Edge]) -> list[int]:
|
|||||||
if size is None
|
if size is None
|
||||||
]
|
]
|
||||||
# Remaining space in total
|
# Remaining space in total
|
||||||
remaining = total - sum(size or 0 for size in sizes)
|
remaining = total - sum([size or 0 for size in sizes])
|
||||||
if remaining <= 0:
|
if remaining <= 0:
|
||||||
# No room for flexible edges
|
# No room for flexible edges
|
||||||
return [
|
return [
|
||||||
@@ -60,7 +60,7 @@ def layout_resolve(total: int, edges: Sequence[Edge]) -> list[int]:
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Get the total fraction value for all flexible edges
|
# Get the total fraction value for all flexible edges
|
||||||
total_flexible = sum((edge.fraction or 1) for _, edge in flexible_edges)
|
total_flexible = sum([(edge.fraction or 1) for _, edge in flexible_edges])
|
||||||
while flexible_edges:
|
while flexible_edges:
|
||||||
# Calculate number of characters in a ratio portion
|
# Calculate number of characters in a ratio portion
|
||||||
portion = Fraction(remaining, total_flexible)
|
portion = Fraction(remaining, total_flexible)
|
||||||
|
|||||||
Reference in New Issue
Block a user