MCPcopy Index your code
hub / github.com/python/cpython / _future_repr_info

Function _future_repr_info

Lib/asyncio/base_futures.py:44–61  ·  view source on GitHub ↗

helper function for Future.__repr__

(future)

Source from the content-addressed store, hash-verified

42
43
44def _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()

Callers 1

_future_reprFunction · 0.85

Calls 4

_format_callbacksFunction · 0.85
lowerMethod · 0.45
appendMethod · 0.45
reprMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…