(self)
| 113 | class RichPromptDisplayHook(DisplayHook): |
| 114 | """Subclass of base display hook using coloured prompt""" |
| 115 | def write_output_prompt(self): |
| 116 | sys.stdout.write(self.shell.separate_out) |
| 117 | # If we're not displaying a prompt, it effectively ends with a newline, |
| 118 | # because the output will be left-aligned. |
| 119 | self.prompt_end_newline = True |
| 120 | |
| 121 | if self.do_full_cache: |
| 122 | tokens = self.shell.prompts.out_prompt_tokens() |
| 123 | prompt_txt = "".join(s for _, s in tokens) |
| 124 | if prompt_txt and not prompt_txt.endswith("\n"): |
| 125 | # Ask for a newline before multiline output |
| 126 | self.prompt_end_newline = False |
| 127 | |
| 128 | if self.shell.pt_app: |
| 129 | print_formatted_text(PygmentsTokens(tokens), |
| 130 | style=self.shell.pt_app.app.style, end='', |
| 131 | ) |
| 132 | else: |
| 133 | sys.stdout.write(prompt_txt) |
| 134 | |
| 135 | def write_format_data(self, format_dict: Dict[str, str], md_dict: Optional[Dict[Any, Any]]=None) -> None: |
| 136 | assert self.shell is not None |
nothing calls this directly
no test coverage detected