Get ready to run. Call restore when finished. You must not write to the console in between the calls to prepare and restore.
(self)
| 629 | self.arg = None |
| 630 | |
| 631 | def prepare(self) -> None: |
| 632 | """Get ready to run. Call restore when finished. You must not |
| 633 | write to the console in between the calls to prepare and |
| 634 | restore.""" |
| 635 | try: |
| 636 | self.console.prepare() |
| 637 | self.arg = None |
| 638 | self.finished = False |
| 639 | del self.buffer[:] |
| 640 | self.pos = 0 |
| 641 | self.dirty = True |
| 642 | self.last_command = None |
| 643 | self.calc_screen() |
| 644 | except BaseException: |
| 645 | self.restore() |
| 646 | raise |
| 647 | |
| 648 | while self.scheduled_commands: |
| 649 | cmd = self.scheduled_commands.pop() |
| 650 | self.do_cmd((cmd, [])) |
| 651 | |
| 652 | def last_command_is(self, cls: type) -> bool: |
| 653 | if not self.last_command: |