Skip to content

Commit 593fa88

Browse files
committed
exclude sample output
1 parent 4bf9f3d commit 593fa88

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

scripts/diffable.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,6 @@ def is_vid(cell):
1616
return text == "<IPython.core.display.Video object>"
1717

1818

19-
def fix_sample(line):
20-
"""Ensure calls to .sample() are deterministic by passing in a seed value
21-
22-
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.sample.html"""
23-
return re.sub(r"\.sample\((\d+)\)", r".sample(\1, random_state=1)", line)
24-
25-
2619
def has_html_output(output):
2720
return "data" in output and "text/html" in output["data"]
2821

@@ -45,7 +38,9 @@ def has_html_output(output):
4538
if cell["source"][0].startswith("!"):
4639
cell["outputs"] = []
4740

48-
cell["source"] = [fix_sample(line) for line in cell["source"]]
41+
# ignore sample() output
42+
if any(".sample(" in line for line in cell["source"]):
43+
cell["outputs"] = []
4944

5045
# filter out pip upgrade warnings
5146
cell["outputs"] = [line for line in cell["outputs"] if not is_pip_upgrade_msg(line)]

0 commit comments

Comments
 (0)