| 466 | |
| 467 | |
| 468 | class Breakable(Printable): |
| 469 | |
| 470 | def __init__(self, seq, width, pretty): |
| 471 | self.obj = seq |
| 472 | self.width = width |
| 473 | self.pretty = pretty |
| 474 | self.indentation = pretty.indentation |
| 475 | self.group = pretty.group_stack[-1] |
| 476 | self.group.breakables.append(self) |
| 477 | |
| 478 | def output(self, stream, output_width): |
| 479 | self.group.breakables.popleft() |
| 480 | if self.group.want_break: |
| 481 | stream.write(self.pretty.newline) |
| 482 | stream.write(' ' * self.indentation) |
| 483 | return self.indentation |
| 484 | if not self.group.breakables: |
| 485 | self.pretty.group_queue.remove(self.group) |
| 486 | stream.write(self.obj) |
| 487 | return output_width + self.width |
| 488 | |
| 489 | |
| 490 | class Group(Printable): |
no outgoing calls
no test coverage detected
searching dependent graphs…