MCPcopy Create free account
hub / github.com/diasurgical/DevilutionX / CompareRows

Function CompareRows

tools/cpp_format_struct_table.py:269–282  ·  view source on GitHub ↗
(a: list[str], b: list[str])

Source from the content-addressed store, hash-verified

267
268
269def CompareRows(a: list[str], b: list[str]):
270 a_width = max(len(x) for x in a) + 2
271 b_width = max(len(x) for x in b) + 2
272 shared_len = min(len(a), len(b))
273 result = []
274 for i in range(shared_len):
275 result.append(f"{f'[{a[i]}]'.ljust(a_width)} | {f'[{b[i]}]'.ljust(b_width)}")
276 if len(a) > len(b):
277 for i in range(shared_len, len(a)):
278 result.append(f"{f'[{a[i]}]'.ljust(a_width)} |")
279 else:
280 for i in range(shared_len, len(b)):
281 result.append(f"{''.ljust(a_width)} | {f'[{b[i]}]'.ljust(b_width)}")
282 return "\n".join(result)
283
284
285def ProcessLine(line: str, line_state: LineState, state: ColumnsState) -> LineState:

Callers 1

ProcessLineFunction · 0.85

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected