Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
The best size is computed by invoking the solver with a zero
size suggestion at a strength of 0.1 * weak. The resulting
values for width and height are taken as the best size.
Returns
-------
result : tuple
The 2-tuple of (width, height) best size values.
"""
d = self._root_item.constrainable()
width = d.width
height = d.height
solver = self._solver
strength = 0.1 * kiwi.strength.weak
pairs = ((width, strength), (height, strength))
with self._edit_context(pairs):
solver.suggestValue(width, 0.0)
solver.suggestValue(height, 0.0)
solver.updateVariables()
result = (width.value(), height.value())
return result