Print lines of code from the current stack frame
(self, arg)
| 525 | self.skip_hidden = False |
| 526 | |
| 527 | def do_list(self, arg): |
| 528 | """Print lines of code from the current stack frame |
| 529 | """ |
| 530 | self.lastcmd = 'list' |
| 531 | last = None |
| 532 | if arg: |
| 533 | try: |
| 534 | x = eval(arg, {}, {}) |
| 535 | if type(x) == type(()): |
| 536 | first, last = x |
| 537 | first = int(first) |
| 538 | last = int(last) |
| 539 | if last < first: |
| 540 | # Assume it's a count |
| 541 | last = first + last |
| 542 | else: |
| 543 | first = max(1, int(x) - 5) |
| 544 | except: |
| 545 | print('*** Error in argument:', repr(arg), file=self.stdout) |
| 546 | return |
| 547 | elif self.lineno is None: |
| 548 | first = max(1, self.curframe.f_lineno - 5) |
| 549 | else: |
| 550 | first = self.lineno + 1 |
| 551 | if last is None: |
| 552 | last = first + 10 |
| 553 | self.print_list_lines(self.curframe.f_code.co_filename, first, last) |
| 554 | |
| 555 | # vds: >> |
| 556 | lineno = first |
| 557 | filename = self.curframe.f_code.co_filename |
| 558 | self.shell.hooks.synchronize_with_editor(filename, lineno, 0) |
| 559 | # vds: << |
| 560 | |
| 561 | do_l = do_list |
| 562 |
nothing calls this directly
no test coverage detected