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

Function _format_callbacks

Lib/asyncio/base_futures.py:24–41  ·  view source on GitHub ↗

helper function for Future.__repr__

(cb)

Source from the content-addressed store, hash-verified

22
23
24def _format_callbacks(cb):
25 """helper function for Future.__repr__"""
26 size = len(cb)
27 if not size:
28 cb = ''
29
30 def format_cb(callback):
31 return format_helpers._format_callback_source(callback, ())
32
33 if size == 1:
34 cb = format_cb(cb[0][0])
35 elif size == 2:
36 cb = '{}, {}'.format(format_cb(cb[0][0]), format_cb(cb[1][0]))
37 elif size > 2:
38 cb = '{}, <{} more>, {}'.format(format_cb(cb[0][0]),
39 size - 2,
40 format_cb(cb[-1][0]))
41 return f'cb=[{cb}]'
42
43
44def _future_repr_info(future):

Callers 1

_future_repr_infoFunction · 0.85

Calls 2

format_cbFunction · 0.85
formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…