Get ready to run. Call restore when finished. You must not write to the console in between the calls to prepare and restore.
(self)
| 586 | self.arg = None |
| 587 | |
| 588 | def prepare(self) -> None: |
| 589 | """Get ready to run. Call restore when finished. You must not |
| 590 | write to the console in between the calls to prepare and |
| 591 | restore.""" |
| 592 | try: |
| 593 | self.console.prepare() |
| 594 | self.arg = None |
| 595 | self.finished = False |
| 596 | del self.buffer[:] |
| 597 | self.pos = 0 |
| 598 | self.dirty = True |
| 599 | self.last_command = None |
| 600 | self.calc_screen() |
| 601 | except BaseException: |
| 602 | self.restore() |
| 603 | raise |
| 604 | |
| 605 | while self.scheduled_commands: |
| 606 | cmd = self.scheduled_commands.pop() |
| 607 | self.do_cmd((cmd, [])) |
| 608 | |
| 609 | def last_command_is(self, cls: type) -> bool: |
| 610 | if not self.last_command: |