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

Function _build_table

Tools/c-analyzer/c_common/tables.py:415–431  ·  view source on GitHub ↗
(columns, *, sep=' ', defaultwidth=None)

Source from the content-addressed store, hash-verified

413
414
415def _build_table(columns, *, sep=' ', defaultwidth=None):
416 header = []
417 div = []
418 rowfmt = []
419 for spec in columns:
420 width = spec.resolve_width(defaultwidth)
421 colfmt = spec.fmt
422 colfmt = f':{spec.fmt}' if spec.fmt else f':{width}'
423
424 header.append(f' {{:^{width}}} '.format(spec.label))
425 div.append('-' * (width + 2))
426 rowfmt.append(f' {{{spec.field}{colfmt}}} ')
427 return (
428 sep.join(header),
429 sep.join(div),
430 sep.join(rowfmt),
431 )

Callers 1

build_tableFunction · 0.85

Calls 4

resolve_widthMethod · 0.80
appendMethod · 0.45
formatMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…