(self)
| 699 | return "" |
| 700 | |
| 701 | def __repr__(self): |
| 702 | def add_indent(repr_str, num_spaces): |
| 703 | s = repr_str.split("\n") |
| 704 | # don't do anything for single-line stuff |
| 705 | if len(s) == 1: |
| 706 | return repr_str |
| 707 | first = s.pop(0) |
| 708 | s = [(num_spaces * " ") + line for line in s] |
| 709 | s = "\n".join(s) |
| 710 | s = first + "\n" + s |
| 711 | return s |
| 712 | |
| 713 | extra_lines = [] |
| 714 | extra_repr = self._module_info_string() |
| 715 | if extra_repr: |
| 716 | extra_lines = extra_repr.split("\n") |
| 717 | child_lines = [] |
| 718 | for name in self._modules: |
| 719 | if _is_module(self.__dict__[name]): |
| 720 | child_lines.append( |
| 721 | "(" + name + "): " + add_indent(repr(self.__dict__[name]), 2) |
| 722 | ) |
| 723 | else: |
| 724 | for k, v in _expand_structure(name, self.__dict__[name]): |
| 725 | if _is_module(v): |
| 726 | child_lines.append("(" + k + "): " + add_indent(repr(v), 2)) |
| 727 | |
| 728 | lines = extra_lines + child_lines |
| 729 | main_str = self.__class__.__name__ + "(" |
| 730 | if lines: |
| 731 | # simple one-liner info, which most builtin Modules will use |
| 732 | if len(extra_lines) == 1 and not child_lines: |
| 733 | main_str += extra_lines[0] |
| 734 | else: |
| 735 | main_str += "\n " + "\n ".join(lines) + "\n" |
| 736 | |
| 737 | main_str += ")" |
| 738 | return main_str |
nothing calls this directly
no test coverage detected