Returns the text representation of this object, i.e. including the main result or the error traceback, optionally along with the logs (stdout, stderr).
(self, include_logs: bool = True, include_results: bool = True)
| 269 | "Error object if an error occurred, None otherwise." |
| 270 | |
| 271 | def text(self, include_logs: bool = True, include_results: bool = True) -> str: |
| 272 | """Returns the text representation of this object, i.e. including the main |
| 273 | result or the error traceback, optionally along with the logs (stdout, stderr). |
| 274 | """ |
| 275 | prefix = str(self.logs) if include_logs else "" |
| 276 | if self.error: |
| 277 | return prefix + "\n----- Error -----\n" + self.error.traceback |
| 278 | |
| 279 | if include_results: |
| 280 | result_str = [ |
| 281 | ( |
| 282 | f"----- Final output -----\n{res.text}" |
| 283 | if res.is_main_result |
| 284 | else f"----- Intermediate output-----\n{res.text}" |
| 285 | ) |
| 286 | for res in self.results |
| 287 | ] |
| 288 | return prefix + "\n" + "\n".join(result_str) |
| 289 | return prefix |
| 290 | |
| 291 | @property |
| 292 | def success(self) -> bool: |
no outgoing calls