| 774 | return lines |
| 775 | |
| 776 | def repr_locals(self, locals: Mapping[str, object]) -> Optional["ReprLocals"]: |
| 777 | if self.showlocals: |
| 778 | lines = [] |
| 779 | keys = [loc for loc in locals if loc[0] != "@"] |
| 780 | keys.sort() |
| 781 | for name in keys: |
| 782 | value = locals[name] |
| 783 | if name == "__builtins__": |
| 784 | lines.append("__builtins__ = <builtins>") |
| 785 | else: |
| 786 | # This formatting could all be handled by the |
| 787 | # _repr() function, which is only reprlib.Repr in |
| 788 | # disguise, so is very configurable. |
| 789 | if self.truncate_locals: |
| 790 | str_repr = saferepr(value) |
| 791 | else: |
| 792 | str_repr = safeformat(value) |
| 793 | # if len(str_repr) < 70 or not isinstance(value, (list, tuple, dict)): |
| 794 | lines.append(f"{name:<10} = {str_repr}") |
| 795 | # else: |
| 796 | # self._line("%-10s =\\" % (name,)) |
| 797 | # # XXX |
| 798 | # pprint.pprint(value, stream=self.excinfowriter) |
| 799 | return ReprLocals(lines) |
| 800 | return None |
| 801 | |
| 802 | def repr_traceback_entry( |
| 803 | self, |