(self)
| 77 | class RichPromptDisplayHook(DisplayHook): |
| 78 | """Subclass of base display hook using coloured prompt""" |
| 79 | def write_output_prompt(self): |
| 80 | sys.stdout.write(self.shell.separate_out) |
| 81 | # If we're not displaying a prompt, it effectively ends with a newline, |
| 82 | # because the output will be left-aligned. |
| 83 | self.prompt_end_newline = True |
| 84 | |
| 85 | if self.do_full_cache: |
| 86 | tokens = self.shell.prompts.out_prompt_tokens() |
| 87 | prompt_txt = ''.join(s for t, s in tokens) |
| 88 | if prompt_txt and not prompt_txt.endswith('\n'): |
| 89 | # Ask for a newline before multiline output |
| 90 | self.prompt_end_newline = False |
| 91 | |
| 92 | if self.shell.pt_app: |
| 93 | print_formatted_text(PygmentsTokens(tokens), |
| 94 | style=self.shell.pt_app.app.style, end='', |
| 95 | ) |
| 96 | else: |
| 97 | sys.stdout.write(prompt_txt) |
| 98 | |
| 99 | def write_format_data(self, format_dict, md_dict=None) -> None: |
| 100 | if self.shell.mime_renderers: |
nothing calls this directly
no test coverage detected