| 1297 | ) |
| 1298 | |
| 1299 | def _set_glue(self, x: float, sign: int, totals: list[float], |
| 1300 | error_type: str) -> None: |
| 1301 | self.glue_order = o = next( |
| 1302 | # Highest order of glue used by the members of this list. |
| 1303 | (i for i in range(len(totals))[::-1] if totals[i] != 0), 0) |
| 1304 | self.glue_sign = sign |
| 1305 | if totals[o] != 0.: |
| 1306 | self.glue_set = x / totals[o] |
| 1307 | else: |
| 1308 | self.glue_sign = 0 |
| 1309 | self.glue_ratio = 0. |
| 1310 | if o == 0: |
| 1311 | if len(self.children): |
| 1312 | _log.warning("%s %s: %r", |
| 1313 | error_type, type(self).__name__, self) |
| 1314 | |
| 1315 | def shrink(self) -> None: |
| 1316 | for child in self.children: |