Show More
@@ -512,28 +512,6 b' class Inspector(Colorable):' | |||||
512 | # 0-offset, so we must adjust. |
|
512 | # 0-offset, so we must adjust. | |
513 | page.page(self.format(openpy.read_py_file(ofile, skip_encoding_cookie=False)), lineno - 1) |
|
513 | page.page(self.format(openpy.read_py_file(ofile, skip_encoding_cookie=False)), lineno - 1) | |
514 |
|
514 | |||
515 | def _format_fields(self, fields, title_width=0) -> str: |
|
|||
516 | """Formats a list of fields for display. |
|
|||
517 |
|
||||
518 | Parameters |
|
|||
519 | ---------- |
|
|||
520 | fields : list |
|
|||
521 | A list of 2-tuples: (field_title, field_content) |
|
|||
522 | title_width : int |
|
|||
523 | How many characters to pad titles to. Default to longest title. |
|
|||
524 | """ |
|
|||
525 | out = [] |
|
|||
526 | header = self.__head |
|
|||
527 | if title_width == 0: |
|
|||
528 | title_width = max(len(title) + 2 for title, _ in fields) |
|
|||
529 | for title, content in fields: |
|
|||
530 | if len(content.splitlines()) > 1: |
|
|||
531 | title = header(title + ':') + '\n' |
|
|||
532 | else: |
|
|||
533 | title = header((title + ':').ljust(title_width)) |
|
|||
534 | out.append(title + cast_unicode(content)) |
|
|||
535 | return "\n".join(out) |
|
|||
536 |
|
||||
537 | def _mime_format(self, text, formatter=None): |
|
515 | def _mime_format(self, text, formatter=None): | |
538 | """Return a mime bundle representation of the input text. |
|
516 | """Return a mime bundle representation of the input text. | |
539 |
|
517 |
General Comments 0
You need to be logged in to leave comments.
Login now