helper function for Future.__repr__
(future)
| 42 | |
| 43 | |
| 44 | def _future_repr_info(future): |
| 45 | # (Future) -> str |
| 46 | """helper function for Future.__repr__""" |
| 47 | info = [future._state.lower()] |
| 48 | if future._state == _FINISHED: |
| 49 | if future._exception is not None: |
| 50 | info.append(f'exception={future._exception!r}') |
| 51 | else: |
| 52 | # use reprlib to limit the length of the output, especially |
| 53 | # for very long strings |
| 54 | result = reprlib.repr(future._result) |
| 55 | info.append(f'result={result}') |
| 56 | if future._callbacks: |
| 57 | info.append(_format_callbacks(future._callbacks)) |
| 58 | if future._source_traceback: |
| 59 | frame = future._source_traceback[-1] |
| 60 | info.append(f'created at {frame[0]}:{frame[1]}') |
| 61 | return info |
| 62 | |
| 63 | |
| 64 | @reprlib.recursive_repr() |
no test coverage detected
searching dependent graphs…