The printing (as opposed to the parsing part of a 'list' command.
(self, filename: str, first: int, last: int)
| 806 | return (bp_str, num, line) |
| 807 | |
| 808 | def print_list_lines(self, filename: str, first: int, last: int) -> None: |
| 809 | """The printing (as opposed to the parsing part of a 'list' |
| 810 | command.""" |
| 811 | toks: TokenStream = [] |
| 812 | try: |
| 813 | if filename == "<string>" and hasattr(self, "_exec_filename"): |
| 814 | filename = self._exec_filename |
| 815 | |
| 816 | for lineno in range(first, last + 1): |
| 817 | line = linecache.getline(filename, lineno) |
| 818 | if not line: |
| 819 | break |
| 820 | |
| 821 | assert self.curframe is not None |
| 822 | |
| 823 | if lineno == self.curframe.f_lineno: |
| 824 | bp, num, colored_line = self.__line_content( |
| 825 | filename, lineno, line, arrow=True |
| 826 | ) |
| 827 | toks.extend( |
| 828 | [ |
| 829 | bp, |
| 830 | (Token.LinenoEm, num), |
| 831 | (Token, " "), |
| 832 | # TODO: investigate Token.Line here |
| 833 | (Token, colored_line), |
| 834 | ] |
| 835 | ) |
| 836 | else: |
| 837 | bp, num, colored_line = self.__line_content( |
| 838 | filename, lineno, line, arrow=False |
| 839 | ) |
| 840 | toks.extend( |
| 841 | [ |
| 842 | bp, |
| 843 | (Token.Lineno, num), |
| 844 | (Token, " "), |
| 845 | (Token, colored_line), |
| 846 | ] |
| 847 | ) |
| 848 | |
| 849 | self.lineno = lineno |
| 850 | |
| 851 | print(self.theme.format(toks), file=self.stdout) |
| 852 | |
| 853 | except KeyboardInterrupt: |
| 854 | pass |
| 855 | |
| 856 | def do_skip_predicates(self, args): |
| 857 | """ |
no test coverage detected