mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-12 15:28:21 +01:00
exp show: Add alternating row colors and update border style.
Use `box.HORIZONTALS`. rich_table: Support `box.HORIZONTALS` Closes #7128
This commit is contained in:
committed by
Peter Rowlands (변기호)
parent
970cbfa64e
commit
9bd60f62d7
@@ -373,7 +373,7 @@ def prepare_exp_id(kwargs) -> "RichText":
|
||||
|
||||
|
||||
def baseline_styler(typ):
|
||||
return {"style": "bold"} if typ == "baseline" else {}
|
||||
return {"style": "bold"} if typ == "baseline" else {"style": "default"}
|
||||
|
||||
|
||||
def show_experiments(
|
||||
@@ -437,6 +437,9 @@ def show_experiments(
|
||||
td.drop(col)
|
||||
|
||||
row_styles = lmap(baseline_styler, td.column("typ"))
|
||||
for n, row_style in enumerate(row_styles):
|
||||
if n % 2 != 0:
|
||||
row_style["style"] += " on grey23"
|
||||
|
||||
if not csv:
|
||||
merge_headers = ["Experiment", "rev", "typ", "parent"]
|
||||
@@ -471,7 +474,7 @@ def show_experiments(
|
||||
|
||||
td.render(
|
||||
pager=pager,
|
||||
borders=True,
|
||||
borders="horizontals",
|
||||
rich_table=True,
|
||||
header_styles=styles,
|
||||
row_styles=row_styles,
|
||||
|
||||
@@ -91,6 +91,7 @@ def rich_table(
|
||||
False: None,
|
||||
"simple": box.SIMPLE,
|
||||
"minimal": box.MINIMAL,
|
||||
"horizontals": box.HORIZONTALS,
|
||||
}
|
||||
|
||||
table = Table(box=border_style[borders])
|
||||
|
||||
@@ -293,7 +293,6 @@ def test_show_filter(
|
||||
from dvc.ui import ui
|
||||
|
||||
capsys.readouterr()
|
||||
div = "│" if os.name == "nt" else "┃"
|
||||
|
||||
tmp_dir.gen("copy.py", COPY_SCRIPT)
|
||||
params_file = tmp_dir / "params.yaml"
|
||||
@@ -340,11 +339,11 @@ def test_show_filter(
|
||||
cap = capsys.readouterr()
|
||||
|
||||
for i in included:
|
||||
assert f"{div} params.yaml:{i} {div}" in cap.out
|
||||
assert f"{div} metrics.yaml:{i} {div}" in cap.out
|
||||
assert f"params.yaml:{i}" in cap.out
|
||||
assert f"metrics.yaml:{i}" in cap.out
|
||||
for e in excluded:
|
||||
assert f"{div} params.yaml:{e} {div}" not in cap.out
|
||||
assert f"{div} metrics.yaml:{e} {div}" not in cap.out
|
||||
assert f"params.yaml:{e}" not in cap.out
|
||||
assert f"metrics.yaml:{e}" not in cap.out
|
||||
|
||||
|
||||
def test_show_multiple_commits(tmp_dir, scm, dvc, exp_stage):
|
||||
|
||||
Reference in New Issue
Block a user