mirror of https://github.com/pyodide/pyodide.git
Strip whitespace from micropip.list() output (#2181)
This commit is contained in:
parent
55fbd32ef3
commit
fcc8c4889f
|
@ -7,21 +7,19 @@ __all__ = ["PackageDict"]
|
|||
|
||||
|
||||
def _format_table(headers: List[str], table: List[Iterable]) -> str:
|
||||
# fmt: off
|
||||
"""
|
||||
Returns a minimal formatted table
|
||||
|
||||
>>> print(_format_table(["Header1", "Header2"], [["val1", "val2"], ["val3", "val4"]]))
|
||||
Header1 | Header2
|
||||
------- | -------
|
||||
val1 | val2
|
||||
val3 | val4
|
||||
val1 | val2
|
||||
val3 | val4
|
||||
"""
|
||||
# fmt: on
|
||||
|
||||
def format_row(values, widths, filler=""):
|
||||
row = " | ".join(f"{x:{filler}<{w}}" for x, w in zip(values, widths))
|
||||
return row
|
||||
return row.rstrip()
|
||||
|
||||
col_width = [max(len(x) for x in col) for col in zip(headers, *table)]
|
||||
rows = []
|
||||
|
|
Loading…
Reference in New Issue