| 556 | return inner |
| 557 | |
| 558 | def _repr_pretty_(self, p, cycle): |
| 559 | # dunders are to avoid clashes with kwargs, as python's name managing |
| 560 | # will kick in. |
| 561 | |
| 562 | started = False |
| 563 | def new_item(): |
| 564 | nonlocal started |
| 565 | if started: |
| 566 | p.text(",") |
| 567 | p.breakable() |
| 568 | started = True |
| 569 | |
| 570 | prefix = self.name + "(" |
| 571 | with p.group(len(prefix), prefix, ")"): |
| 572 | for arg in self.args: |
| 573 | new_item() |
| 574 | p.pretty(arg) |
| 575 | for arg_name, arg in self.kwargs.items(): |
| 576 | new_item() |
| 577 | arg_prefix = arg_name + "=" |
| 578 | with p.group(len(arg_prefix), arg_prefix): |
| 579 | p.pretty(arg) |
| 580 | |
| 581 | |
| 582 | class RawStringLiteral: |