The result of a call to :meth:`InteractiveShell.run_cell` Stores information about what took place.
| 303 | |
| 304 | |
| 305 | class ExecutionResult: |
| 306 | """The result of a call to :meth:`InteractiveShell.run_cell` |
| 307 | |
| 308 | Stores information about what took place. |
| 309 | """ |
| 310 | |
| 311 | execution_count: Optional[int] = None |
| 312 | error_before_exec: Optional[BaseException] = None |
| 313 | error_in_exec: Optional[BaseException] = None |
| 314 | info = None |
| 315 | result = None |
| 316 | |
| 317 | def __init__(self, info): |
| 318 | self.info = info |
| 319 | |
| 320 | @property |
| 321 | def success(self): |
| 322 | return (self.error_before_exec is None) and (self.error_in_exec is None) |
| 323 | |
| 324 | def raise_error(self): |
| 325 | """Reraises error if `success` is `False`, otherwise does nothing""" |
| 326 | if self.error_before_exec is not None: |
| 327 | raise self.error_before_exec |
| 328 | if self.error_in_exec is not None: |
| 329 | raise self.error_in_exec |
| 330 | |
| 331 | def __repr__(self): |
| 332 | name = self.__class__.__qualname__ |
| 333 | return '<%s object at %x, execution_count=%s error_before_exec=%s error_in_exec=%s info=%s result=%s>' %\ |
| 334 | (name, id(self), self.execution_count, self.error_before_exec, self.error_in_exec, repr(self.info), repr(self.result)) |
| 335 | |
| 336 | |
| 337 | @functools.wraps(io_open) |
no outgoing calls
no test coverage detected
searching dependent graphs…