MCPcopy Create free account
hub / github.com/VectifyAI/OpenKB / _pad

Function _pad

openkb/agent/_markdown.py:343–361  ·  view source on GitHub ↗
(cell: Text, width: int, align: str | None)

Source from the content-addressed store, hash-verified

341
342
343def _pad(cell: Text, width: int, align: str | None) -> Text:
344 padding = max(0, width - cell.cell_len)
345 if not padding:
346 return cell
347 if align and "center" in align:
348 left = padding // 2
349 right = padding - left
350 out = Text(" " * left)
351 out.append_text(cell)
352 out.append(" " * right)
353 return out
354 if align and "right" in align:
355 out = Text(" " * padding)
356 out.append_text(cell)
357 return out
358 out = Text()
359 out.append_text(cell)
360 out.append(" " * padding)
361 return out
362
363
364def _rstrip_trailing_space(text: Text) -> Text:

Callers 1

_render_tableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected