The printing (as opposed to the parsing part of a 'list' command.
(self, filename, first, last)
| 485 | |
| 486 | |
| 487 | def print_list_lines(self, filename, first, last): |
| 488 | """The printing (as opposed to the parsing part of a 'list' |
| 489 | command.""" |
| 490 | try: |
| 491 | Colors = self.color_scheme_table.active_colors |
| 492 | ColorsNormal = Colors.Normal |
| 493 | tpl_line = '%%s%s%%s %s%%s' % (Colors.lineno, ColorsNormal) |
| 494 | tpl_line_em = '%%s%s%%s %s%%s%s' % (Colors.linenoEm, Colors.line, ColorsNormal) |
| 495 | src = [] |
| 496 | if filename == "<string>" and hasattr(self, "_exec_filename"): |
| 497 | filename = self._exec_filename |
| 498 | |
| 499 | for lineno in range(first, last+1): |
| 500 | line = linecache.getline(filename, lineno) |
| 501 | if not line: |
| 502 | break |
| 503 | |
| 504 | if lineno == self.curframe.f_lineno: |
| 505 | line = self.__format_line(tpl_line_em, filename, lineno, line, arrow = True) |
| 506 | else: |
| 507 | line = self.__format_line(tpl_line, filename, lineno, line, arrow = False) |
| 508 | |
| 509 | src.append(line) |
| 510 | self.lineno = lineno |
| 511 | |
| 512 | print(''.join(src), file=self.stdout) |
| 513 | |
| 514 | except KeyboardInterrupt: |
| 515 | pass |
| 516 | |
| 517 | def do_skip_hidden(self, arg): |
| 518 | """ |
no test coverage detected