Show the answer in a pretty way. Show code blocks and their respective feedback by inserting them in the ressponse.
(self)
| 208 | return raw |
| 209 | |
| 210 | def show_answer(self): |
| 211 | """ |
| 212 | Show the answer in a pretty way. |
| 213 | Show code blocks and their respective feedback by inserting them in the ressponse. |
| 214 | """ |
| 215 | if self.last_answer is None: |
| 216 | return |
| 217 | lines = self.last_answer.split("\n") |
| 218 | for line in lines: |
| 219 | if "block:" in line: |
| 220 | block_idx = int(line.split(":")[1]) |
| 221 | if block_idx < len(self.blocks_result): |
| 222 | self.blocks_result[block_idx].show() |
| 223 | else: |
| 224 | pretty_print(line, color="output") |
| 225 | |
| 226 | def remove_blocks(self, text: str) -> str: |
| 227 | """ |
no test coverage detected